[Sugar-devel] [sugar-toolkit PATCH] Introduce a new alert, that takes arbitrary number of buttons.

Ajay Garg ajay at activitycentral.com
Fri Aug 17 13:44:14 EDT 2012


Whenever any of these buttons is clicked, the corresponding "response_id"
is received in the "response" callback-function attached to this alert.



This patch adds the "Multi-Select" facility, to easy copying/erasing multiple
items in one go (after selecting the required "target" entries).

Note that, the corresponding "sugar" and "sugar-artwork" patches also need to be applied,
for this feature to work.




====================
Courtesy Gary Martin, this feature has been made fully robust and bullet-proof.
====================

In particular, following things are intended via this patch ::

a)
Solves the basic purpose ( of course :P )


b)
There should be no sequence of events, that renders the UI in unusable state.


c)
There should be no moment, wherein the user may act "impatient", and may 
cause an undesirable sequence of actions (may/may-not be leading to
an unusable state).


d)
Speed optimisation, as far, and as logically, as possible.


Again, all credit goes to Gary, for having rendered this feature such robustness !!!






===========================================






The only "issue" that may be hit while testing this feature, is the bug ::
http://bugs.sugarlabs.org/ticket/3813

which actually, has nothing to do with this feature as per say; it occurs even with
this patch unapplied.



 src/sugar/graphics/alert.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py
index b5aa0c0..e6d339c 100644
--- a/src/sugar/graphics/alert.py
+++ b/src/sugar/graphics/alert.py
@@ -487,3 +487,15 @@ class NotifyAlert(Alert):
             self._response(gtk.RESPONSE_OK)
             return False
         return True
+
+
+class NButtonAlert(Alert):
+    def __init__(self, **kwargs):
+        Alert.__init__(self, **kwargs)
+
+    def _populate_buttons(self, buttons_info_list):
+        for button_info in buttons_info_list:
+            icon_name, response_code, button_text = button_info
+            icon = Icon(icon_name=icon_name)
+            self.add_button(response_code, button_text, icon)
+            icon.show()
-- 
1.7.4.4



More information about the Sugar-devel mailing list