* src/ImageSelect.py: eliminate recursive error loop when a thumbnail

cannot be created.
* src/plugins/ReorderIds.py: handle IDs better when reordering


svn: r1825
This commit is contained in:
Don Allingham 2003-07-06 03:52:38 +00:00
parent b8bdcbdb3c
commit b2e7958a1e
2 changed files with 16 additions and 5 deletions

View File

@ -222,6 +222,7 @@ class Gallery(ImageSelect):
icon_list.connect("drag_begin", self.on_drag_begin)
_iconlist_refs.append(icon_list)
self.in_event = 0
# Remember arguments
self.path = path;
@ -261,6 +262,9 @@ class Gallery(ImageSelect):
def item_event(self, widget, event=None):
if self.in_event:
return
self.in_event = 1
if self.button and event.type == gtk.gdk.MOTION_NOTIFY :
if widget.drag_check_threshold(self.remember_x,self.remember_y,
event.x,event.y):
@ -273,6 +277,7 @@ class Gallery(ImageSelect):
gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE,
self.button, event)
self.in_event = 0
return gtk.TRUE
style = self.iconlist.get_style()
@ -296,6 +301,7 @@ class Gallery(ImageSelect):
self.remember_x = event.x
self.remember_y = event.y
self.button = event.button
self.in_event = 0
return gtk.TRUE
elif event.button == 3:
@ -303,6 +309,7 @@ class Gallery(ImageSelect):
if item:
(i,t,b,self.photo,oid) = self.p_map[item]
self.show_popup(self.photo)
self.in_event = 0
return gtk.TRUE
elif event.type == gtk.gdk.BUTTON_RELEASE:
self.button = 0
@ -311,6 +318,7 @@ class Gallery(ImageSelect):
if item:
(i,t,b,self.photo,oid) = self.p_map[item]
LocalMediaProperties(self.photo,self.path,self)
self.in_event = 0
return gtk.TRUE
elif event.type == gtk.gdk.MOTION_NOTIFY:
if event.state & gtk.gdk.BUTTON1_MASK:
@ -321,11 +329,13 @@ class Gallery(ImageSelect):
self.remember_x = new_x
self.remember_y = new_y
self.in_event = 0
return gtk.TRUE
if event.type == gtk.gdk.EXPOSE:
self.load_images()
self.in_event = 0
return gtk.FALSE
def savephoto(self, photo):

View File

@ -56,7 +56,7 @@ class ReorderIds:
if possible. Otherwise, blindly renumber those that can't."""
dups = []
newids = []
newids = {}
key_list = []
# search all ids in the map
@ -79,14 +79,15 @@ class ReorderIds:
index = match.groups()[0]
newid = prefix % int(index)
if newid == id:
newids[newid] = id
continue
elif data_map.has_key(newid):
dups.append(id)
else:
newids.append(id)
data = data_map[id]
data.setId(newid)
data_map[newid] = data
newids[newid] = id
data.setId(newid)
del data_map[id]
if update:
update(newid,id)
@ -102,10 +103,10 @@ class ReorderIds:
for id in dups:
while 1:
newid = prefix % index
if newid not in newids:
if not newids.has_key(newid):
break
index = index + 1
newids.append(newid)
newids[newid] = newid
data = data_map[id]
data.setId(newid)
data_map[newid] = data