diff frontends/wix/main_window.py @ 182:556c2bd7c344

Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
author Goffi <goffi@goffi.org>
date Wed, 18 Aug 2010 12:45:48 +0800
parents fdb961f27ae9
children 9ee4a1d0d7fb
line wrap: on
line diff
--- a/frontends/wix/main_window.py	Mon Aug 16 21:59:52 2010 +0800
+++ b/frontends/wix/main_window.py	Wed Aug 18 12:45:48 2010 +0800
@@ -206,7 +206,7 @@
         popup.Show()
         wx.CallLater(5000,popup.Destroy)
     
-    def showDialog(self, message, title="", type="info"):
+    def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None):
         if type == 'info':
             flags = wx.OK | wx.ICON_INFORMATION
         elif type == 'error':
@@ -219,7 +219,9 @@
         dlg = wx.MessageDialog(self, message, title, flags)
         answer = dlg.ShowModal()
         dlg.Destroy()
-        return True if (answer == wx.ID_YES or answer == wx.ID_OK) else False
+        if answer_cb:
+            data = [answer_data] if answer_data else []
+            answer_cb(True if (answer == wx.ID_YES or answer == wx.ID_OK) else False, *data)
        
     def setStatusOnline(self, online=True):
         """enable/disable controls, must be called when local user online status change"""