diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-04-11 18:42:30 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-04-11 18:42:30 (GMT) |
commit | adca5ab2e983fe9cfce2021a97ee59af3fe6b9bf (patch) | |
tree | 91ac95a50e6bdb8de7aa92612bc869b4a2682ae6 /Area.py | |
parent | 14c3d90fc0cdb5d2abbff9f07ae8f5bbb2d26f10 (diff) |
SHow a clock cursor when is doing slow operations - OLPC #10563
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'Area.py')
-rw-r--r-- | Area.py | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -627,9 +627,9 @@ class Area(gtk.DrawingArea): fill_color) else: width, height = self.window.get_size() - fill(self.pixmap, self.gc, coords[0], coords[1], width, - height, self.gc_line.foreground.pixel) - widget.queue_draw() + self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) + gobject.idle_add(self.fast_flood_fill, widget, coords[0], + coords[1], width, height) elif self.tool['name'] == 'triangle': self.d.triangle(widget, coords, False, self.tool['fill']) @@ -663,6 +663,12 @@ class Area(gtk.DrawingArea): if not private_undo: self.enableUndo(widget) + def fast_flood_fill(self, widget, x, y, width, height): + fill(self.pixmap, self.gc, x, y, width, + height, self.gc_line.foreground.pixel) + widget.queue_draw() + self.window.set_cursor(None) + def flood_fill(self, x, y, fill_color): width, height = self.window.get_size() @@ -1048,10 +1054,12 @@ class Area(gtk.DrawingArea): self._do_process(widget, proc_mirror) def _do_process(self, widget, apply_process): - width, height = self.window.get_size() - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - self.drain_events() + gobject.idle_add(self._do_process_internal, widget, apply_process) + + def _do_process_internal(self, widget, apply_process): + + width, height = self.window.get_size() if self.selmove: size = self.pixmap_sel.get_size() @@ -1093,6 +1101,7 @@ class Area(gtk.DrawingArea): self.enableUndo(widget) self.set_tool_cursor() + def drain_events(self, block=gtk.FALSE): while gtk.events_pending(): gtk.mainiteration(block) |