Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core

This commit is contained in:
Goffi 2010-08-18 12:45:48 +08:00
commit b3bff009e8

View file

@ -206,7 +206,7 @@ class MainWindow(wx.Frame, QuickApp):
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 @@ class MainWindow(wx.Frame, QuickApp):
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"""