[POS-commit] r118 - stoqlib/stoqlib/interface

Evandro Vale Miquelito evandro at async.com.br
Sat Mar 12 10:38:56 BRT 2005


Author: evandro
Date: 2005-03-12 10:38:56 -0300 (Sat, 12 Mar 2005)
New Revision: 118

Modified:
   stoqlib/stoqlib/interface/dialogs.py
Log:
Updating close method and keyactions. Both weren't working properly.


Modified: stoqlib/stoqlib/interface/dialogs.py
===================================================================
--- stoqlib/stoqlib/interface/dialogs.py	2005-03-11 20:43:11 UTC (rev 117)
+++ stoqlib/stoqlib/interface/dialogs.py	2005-03-12 13:38:56 UTC (rev 118)
@@ -35,7 +35,8 @@
     def close(self, *args):
         """Handles action to be performed when window is closed.
 Defaults to _shutdown()"""
-        return self._shutdown()
+        self.hide()
+        return True
 
     def run(self):
         """Handles action to be performed when window is opened.
@@ -44,10 +45,6 @@
         self._open()
         return self.retval
 
-    def _shutdown(self):
-        self.hide_and_quit()
-        return True
-
     def _open(self):
 #         # For some odd reason, when spawning a modal dialog using a
 #         # double-click, you can get a weird focus bug. Check here if
@@ -55,15 +52,15 @@
 #         if self.toplevel['modal']:
 #             self.toplevel.set_modal(0)
 #             gtk.idle_add(self._restore_modality)
-        self.show()
+        self.show_all()
 
     def _restore_modality(self, *args):
         time.sleep(0.2)
         # FIXME
         # I think use time.add here could be much better
         gtk.idle_add(self.toplevel.set_modal, 1)
-        
 
+
 #
 # Abstract classes: inherit only, do not use.
 #
@@ -109,16 +106,10 @@
     # window managers that want to set the title as Unnamed or ? when an
     # empty string is set to it.
     def __init__(self):
-        _AbstractDialog.__init__(self, delete_handler=self.cancel)
+        _AbstractDialog.__init__(self, delete_handler=self.hide_and_quit)
+        # gtk.Escape is redefined on subclasses, when necessary
+        self.keyactions = { gtk.keysyms.Escape: self.confirm }
 
-        #TODO: We must implement keyactions on kiwi2. See bug 1844
-        # self.keyactions = { GDK.Escape : self.on_escape_pressed }
-#         self.keyactions = {
-#             # GDK.Escape is redefined on subclasses, when necessary
-#             GDK.Escape : self.confirm,
-#         }
-        
-
     def _initialize(self, text=None, title=" ", header=None, size=None): 
         self.set_title(title)
         if size:
@@ -175,6 +166,6 @@
         _BasicDialog.__init__(self)
         _BasicDialog._initialize(self, text, title, header, size)
         self.cancel_button.hide()
-#         self.keyactions.update({ GDK.Return : self.confirm,
-#                                  GDK.KP_Enter : self.confirm })
+        self.keyactions.update({ gtk.keysyms.Return : self.confirm,
+                                 gtk.keysyms.KP_Enter : self.confirm })
 



More information about the POS-commit mailing list