[Sugar-devel] [sugar-toolkit PATCH] sl#3317: Batch Operations on Journal Entries (Copy, Erase)

Ajay Garg ajay at activitycentral.com
Sun Feb 5 15:47:47 EST 2012


A new function has been added, which provides the ability to have a callback executed, 
after the alert is shown.

Note that, in usual cases (that is, prior addition of this function), the alert is shown;
and the action taken only after user clicks one of the action-buttons (eg. 'OK', 'Cancel', etc.).
However, if it was needed that an alert shown, and some other work done (WITHOUT 
USER CLICKING ANY ACTION-BUTTON), that would not be possible.


 src/sugar/graphics/window.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 src/sugar/graphics/window.py

diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py
old mode 100644
new mode 100755
index b269efc..0f5ebf6
--- a/src/sugar/graphics/window.py
+++ b/src/sugar/graphics/window.py
@@ -224,6 +224,11 @@ class Window(gtk.Window):
             else:
                 self.__vbox.reorder_child(alert, 0)
 
+    def add_alert_and_callback(self, alert, callback, data):
+        self.add_alert(alert)
+        if callback is not None:
+            gobject.idle_add(callback, data)
+
     def remove_alert(self, alert):
         if alert in self._alerts:
             self._alerts.remove(alert)
-- 
1.7.4.4



More information about the Sugar-devel mailing list