Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
This commit is contained in:
parent
fded7958f4
commit
b3bff009e8
1 changed files with 74 additions and 20 deletions
|
|
@ -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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue