Handle the iteration through the flowbox children better
This commit is contained in:
parent
34defb3768
commit
9903bd851d
|
@ -72,11 +72,8 @@ class DrawingPerspective(Gtk.Stack):
|
||||||
# When the orientation changes, we just re-generate all SVGs. This
|
# When the orientation changes, we just re-generate all SVGs. This
|
||||||
# isn't something that should happen very often anyway so meh.
|
# isn't something that should happen very often anyway so meh.
|
||||||
self.known_drawings = []
|
self.known_drawings = []
|
||||||
child = self.flowbox_drawings.get_child_at_index(0)
|
|
||||||
while child is not None:
|
|
||||||
self.flowbox_drawings.remove(child)
|
|
||||||
child = self.flowbox_drawings.get_child_at_index(0)
|
|
||||||
|
|
||||||
|
self.flowbox_drawings.foreach(lambda child: self.flowbox_drawings.remove(child))
|
||||||
self._update_drawings(Config.load(), None)
|
self._update_drawings(Config.load(), None)
|
||||||
|
|
||||||
def _cache_drawings(self, device, pspec):
|
def _cache_drawings(self, device, pspec):
|
||||||
|
@ -110,15 +107,13 @@ class DrawingPerspective(Gtk.Stack):
|
||||||
# Remove deleted ones
|
# Remove deleted ones
|
||||||
deleted = [d for d in self.known_drawings if d not in config.drawings]
|
deleted = [d for d in self.known_drawings if d not in config.drawings]
|
||||||
for d in deleted:
|
for d in deleted:
|
||||||
child = self.flowbox_drawings.get_child_at_index(0)
|
def delete_matching_child(child, drawing):
|
||||||
while child is not None:
|
if child.get_child().timestamp == drawing['timestamp']:
|
||||||
if child.get_child().timestamp == d['timestamp']:
|
|
||||||
self.flowbox_drawings.remove(child)
|
self.flowbox_drawings.remove(child)
|
||||||
self.known_drawings.remove(d)
|
self.known_drawings.remove(drawing)
|
||||||
self.notification_delete_undo.deleted_drawing = d['timestamp']
|
self.notification_delete_undo.deleted_drawing = drawing['timestamp']
|
||||||
self.overlay_undo.set_reveal_child(True)
|
self.overlay_undo.set_reveal_child(True)
|
||||||
break
|
self.flowbox_drawings.foreach(delete_matching_child, d)
|
||||||
child = self.flowbox_drawings.get_child_at_index(0)
|
|
||||||
|
|
||||||
@GObject.Property
|
@GObject.Property
|
||||||
def device(self):
|
def device(self):
|
||||||
|
|
Loading…
Reference in New Issue