diff urwid_satext/sat_widgets.py @ 56:22ab98a06492

GenericList: click/change signals fix
author Goffi <goffi@goffi.org>
date Tue, 16 Oct 2012 01:09:51 +0200
parents d34f2b0f68d3
children d493f95724a7
line wrap: on
line diff
--- a/urwid_satext/sat_widgets.py	Sat Oct 08 21:18:28 2011 +0200
+++ b/urwid_satext/sat_widgets.py	Tue Oct 16 01:09:51 2012 +0200
@@ -336,8 +336,10 @@
             if selected:
                 self.unselectAll(invisible=True)
                 widget.setState(True, invisible=True)
-        self._emit("click")
+        self._emit("change")
 
+    def __onClick(self, widget):
+        self._emit("click", widget)
 
     def unselectAll(self, invisible=False):
         for widget in self.content:
@@ -384,10 +386,11 @@
             if not self.first_display and option in old_selected:
                 widget.setState(True)
             widgets.append(widget)
-            try:
-                urwid.connect_signal(widget, 'change', self.__onStateChange)
-            except NameError:
-                pass #the widget given doesn't support 'change' signal
+            for signal, callback in (('change', self.__onStateChange), ('click', self.__onClick)):
+                try:
+                    urwid.connect_signal(widget, signal, callback)
+                except NameError:
+                    pass #the widget given doesn't support the signal
         self.content[:] = widgets
         if self.first_display and self.single and new_values and not self.no_first_select:
             self.content[0].setState(True)