* 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:
parent
bce6246370
commit
bd4191ca2d
@ -222,6 +222,7 @@ class Gallery(ImageSelect):
|
|||||||
icon_list.connect("drag_begin", self.on_drag_begin)
|
icon_list.connect("drag_begin", self.on_drag_begin)
|
||||||
|
|
||||||
_iconlist_refs.append(icon_list)
|
_iconlist_refs.append(icon_list)
|
||||||
|
self.in_event = 0
|
||||||
|
|
||||||
# Remember arguments
|
# Remember arguments
|
||||||
self.path = path;
|
self.path = path;
|
||||||
@ -261,6 +262,9 @@ class Gallery(ImageSelect):
|
|||||||
|
|
||||||
def item_event(self, widget, event=None):
|
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 self.button and event.type == gtk.gdk.MOTION_NOTIFY :
|
||||||
if widget.drag_check_threshold(self.remember_x,self.remember_y,
|
if widget.drag_check_threshold(self.remember_x,self.remember_y,
|
||||||
event.x,event.y):
|
event.x,event.y):
|
||||||
@ -273,6 +277,7 @@ class Gallery(ImageSelect):
|
|||||||
gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE,
|
gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE,
|
||||||
self.button, event)
|
self.button, event)
|
||||||
|
|
||||||
|
self.in_event = 0
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
|
|
||||||
style = self.iconlist.get_style()
|
style = self.iconlist.get_style()
|
||||||
@ -296,6 +301,7 @@ class Gallery(ImageSelect):
|
|||||||
self.remember_x = event.x
|
self.remember_x = event.x
|
||||||
self.remember_y = event.y
|
self.remember_y = event.y
|
||||||
self.button = event.button
|
self.button = event.button
|
||||||
|
self.in_event = 0
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
|
|
||||||
elif event.button == 3:
|
elif event.button == 3:
|
||||||
@ -303,6 +309,7 @@ class Gallery(ImageSelect):
|
|||||||
if item:
|
if item:
|
||||||
(i,t,b,self.photo,oid) = self.p_map[item]
|
(i,t,b,self.photo,oid) = self.p_map[item]
|
||||||
self.show_popup(self.photo)
|
self.show_popup(self.photo)
|
||||||
|
self.in_event = 0
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
elif event.type == gtk.gdk.BUTTON_RELEASE:
|
elif event.type == gtk.gdk.BUTTON_RELEASE:
|
||||||
self.button = 0
|
self.button = 0
|
||||||
@ -311,6 +318,7 @@ class Gallery(ImageSelect):
|
|||||||
if item:
|
if item:
|
||||||
(i,t,b,self.photo,oid) = self.p_map[item]
|
(i,t,b,self.photo,oid) = self.p_map[item]
|
||||||
LocalMediaProperties(self.photo,self.path,self)
|
LocalMediaProperties(self.photo,self.path,self)
|
||||||
|
self.in_event = 0
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
elif event.type == gtk.gdk.MOTION_NOTIFY:
|
elif event.type == gtk.gdk.MOTION_NOTIFY:
|
||||||
if event.state & gtk.gdk.BUTTON1_MASK:
|
if event.state & gtk.gdk.BUTTON1_MASK:
|
||||||
@ -321,11 +329,13 @@ class Gallery(ImageSelect):
|
|||||||
self.remember_x = new_x
|
self.remember_x = new_x
|
||||||
self.remember_y = new_y
|
self.remember_y = new_y
|
||||||
|
|
||||||
|
self.in_event = 0
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
|
|
||||||
if event.type == gtk.gdk.EXPOSE:
|
if event.type == gtk.gdk.EXPOSE:
|
||||||
self.load_images()
|
self.load_images()
|
||||||
|
|
||||||
|
self.in_event = 0
|
||||||
return gtk.FALSE
|
return gtk.FALSE
|
||||||
|
|
||||||
def savephoto(self, photo):
|
def savephoto(self, photo):
|
||||||
|
@ -56,7 +56,7 @@ class ReorderIds:
|
|||||||
if possible. Otherwise, blindly renumber those that can't."""
|
if possible. Otherwise, blindly renumber those that can't."""
|
||||||
|
|
||||||
dups = []
|
dups = []
|
||||||
newids = []
|
newids = {}
|
||||||
key_list = []
|
key_list = []
|
||||||
|
|
||||||
# search all ids in the map
|
# search all ids in the map
|
||||||
@ -79,14 +79,15 @@ class ReorderIds:
|
|||||||
index = match.groups()[0]
|
index = match.groups()[0]
|
||||||
newid = prefix % int(index)
|
newid = prefix % int(index)
|
||||||
if newid == id:
|
if newid == id:
|
||||||
|
newids[newid] = id
|
||||||
continue
|
continue
|
||||||
elif data_map.has_key(newid):
|
elif data_map.has_key(newid):
|
||||||
dups.append(id)
|
dups.append(id)
|
||||||
else:
|
else:
|
||||||
newids.append(id)
|
|
||||||
data = data_map[id]
|
data = data_map[id]
|
||||||
data.setId(newid)
|
|
||||||
data_map[newid] = data
|
data_map[newid] = data
|
||||||
|
newids[newid] = id
|
||||||
|
data.setId(newid)
|
||||||
del data_map[id]
|
del data_map[id]
|
||||||
if update:
|
if update:
|
||||||
update(newid,id)
|
update(newid,id)
|
||||||
@ -102,10 +103,10 @@ class ReorderIds:
|
|||||||
for id in dups:
|
for id in dups:
|
||||||
while 1:
|
while 1:
|
||||||
newid = prefix % index
|
newid = prefix % index
|
||||||
if newid not in newids:
|
if not newids.has_key(newid):
|
||||||
break
|
break
|
||||||
index = index + 1
|
index = index + 1
|
||||||
newids.append(newid)
|
newids[newid] = newid
|
||||||
data = data_map[id]
|
data = data_map[id]
|
||||||
data.setId(newid)
|
data.setId(newid)
|
||||||
data_map[newid] = data
|
data_map[newid] = data
|
||||||
|
Loading…
Reference in New Issue
Block a user