Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgnacio Rodriguez <ignacio@sugarlabs.org>2013-12-12 19:27:17 (GMT)
committer Ignacio Rodriguez <ignacio@sugarlabs.org>2013-12-12 19:27:17 (GMT)
commit9d6a29af5ec0724967244cc8a64d9b512dc01651 (patch)
tree68e3482fd14355f03cd2369268cc74509a892d27
parent19e85abda0214d5577e161dc32c2c32de63153f1 (diff)
Show watch cursor when invert colors function is called
-rw-r--r--Area.py12
-rw-r--r--toolbox.py10
2 files changed, 15 insertions, 7 deletions
diff --git a/Area.py b/Area.py
index 06f744f..68c0e1c 100644
--- a/Area.py
+++ b/Area.py
@@ -1198,7 +1198,7 @@ class Area(Gtk.DrawingArea):
self._do_process(widget, proc_grayscale)
- def invert_colors(self, widget):
+ def invert_colors(self, widget, old_cursor, source_id, window):
"""Apply invert effect.
@param self -- the Area object (GtkDrawingArea)
@@ -1206,7 +1206,7 @@ class Area(Gtk.DrawingArea):
"""
- def internal_invert(self, old_cursor):
+ def internal_invert(self, old_cursor, source_id, window):
# load a array with the surface data
for array_type in ['H', 'I', 'L']:
pixels = array.array(array_type)
@@ -1237,11 +1237,11 @@ class Area(Gtk.DrawingArea):
self.queue_draw()
self.enable_undo()
- self.get_window().set_cursor(old_cursor)
+ GObject.source_remove(source_id)
+ window.set_cursor(old_cursor)
- old_cursor = self.get_window().get_cursor()
- self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
- GObject.idle_add(internal_invert, self, old_cursor)
+ GObject.idle_add(internal_invert, self, old_cursor,
+ source_id, window)
def mirror(self, widget, horizontal=True):
"""Apply mirror horizontal/vertical effect.
diff --git a/toolbox.py b/toolbox.py
index b4e624e..0646892 100644
--- a/toolbox.py
+++ b/toolbox.py
@@ -814,4 +814,12 @@ class ImageToolbar(Gtk.Toolbar):
self.properties['name'] = self._EFFECT_RAINBOW_NAME
def invert_colors(self, widget):
- self._activity.area.invert_colors(widget)
+ window = self.get_window()
+ old_cursor = window.get_cursor()
+ source_id = GObject.idle_add(self.set_watch_cursor, window)
+ self._activity.area.invert_colors(widget, old_cursor,
+ source_id, window)
+
+ def set_watch_cursor(self, window):
+ window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
+ return True