dabo Commit
Revision 5926
Date: 2010-07-14 11:42:45 -0700 (Wed, 14 Jul 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5926

Changed:
U   trunk/dabo/ui/uiwx/dDialog.py

Log:
Added some protective code around the dDialog.EndModal() calls, as sometimes 
due to the Modal hacks, my customers are getting wx.PyAssertionErrors when 
closing the modal dialog.

Also, discovered that the constants returned from EndModal() weren't going 
anywhere,
as we didn't return them from ShowModal(). This should be fixed now but I don't
use these so I didn't test too hard.


Diff:
Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py       2010-07-14 18:40:29 UTC (rev 5925)
+++ trunk/dabo/ui/uiwx/dDialog.py       2010-07-14 18:42:45 UTC (rev 5926)
@@ -48,8 +48,13 @@
 
        def EndModal(self, *args, **kwargs):
                self.saveSizeAndPosition()
+               self.hide()
                if self.Modal:
-                       super(dDialog, self).EndModal(*args, **kwargs)
+                       try:
+                               super(dDialog, self).EndModal(*args, **kwargs)
+                       except wx._core.PyAssertionError:
+                               # The modal hack is causing problems in some 
edge cases.
+                               pass
 
 
        def _afterInit(self):
@@ -62,9 +67,10 @@
                self._gtk_show_fix(show)
                wx.Dialog.Show(self, show, *args, **kwargs)
 
+
        def ShowModal(self, *args, **kwargs):
                self._gtk_show_fix(True)
-               wx.Dialog.ShowModal(self, *args, **kwargs)
+               return wx.Dialog.ShowModal(self, *args, **kwargs)
 
 
        def showModal(self):
@@ -95,13 +101,10 @@
                # risk the dialog being too jumpy.
                self._afterShow()
                dabo.ui.callAfter(self._afterShow)
-               retVals = {wx.ID_OK : kons.DLG_OK, 
-                               wx.ID_CANCEL : kons.DLG_CANCEL}
                if self.Modal:
                        ret = self.ShowModal()
-               else:
-                       ret = self.Show(True)
-               return retVals.get(ret)
+                       return {wx.ID_OK: kons.DLG_OK, wx.ID_CANCEL: 
kons.DLG_CANCEL}.get(ret, ret)
+               return self.Show(True)
                
 
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to