added action cb mechanism for buttons. Tested with a temporary new user registration button.

This commit is contained in:
Goffi 2009-12-01 04:56:08 +01:00
commit a103e8b41b

View file

@ -284,11 +284,46 @@ class MainWindow(wx.Frame, QuickApp):
answer = wx.ID_NO
if answer==wx.ID_NO:
self.bridge.confirmationAnswer(id, False, answer_data)
dlg.Destroy()
elif type == "YES/NO":
debug ("Yes/No confirmation asked")
dlg = wx.MessageDialog(self, data["message"],
'Confirmation',
wx.YES_NO | wx.ICON_QUESTION
)
answer=dlg.ShowModal()
if answer==wx.ID_YES:
self.bridge.confirmationAnswer(id, True, {})
if answer==wx.ID_NO:
self.bridge.confirmationAnswer(id, False, {})
dlg.Destroy()
def actionResult(self, type, id, data):
debug ("actionResult: type = [%s] id = [%s] data =[%s]" % (type, id, data))
if type == "SUPPRESS":
self.current_action_ids.remove(id)
elif type == "SUCCESS":
dlg = wx.MessageDialog(self, data["message"],
'Success',
wx.OK | wx.ICON_INFORMATION
)
dlg.ShowModal()
dlg.Destroy()
elif type == "ERROR":
dlg = wx.MessageDialog(self, data["message"],
'Error',
wx.OK | wx.ICON_ERROR
)
dlg.ShowModal()
dlg.Destroy()
else:
error ("FIXME FIXME FIXME: type [%s] not implemented" % type)
raise NotImplementedError
def progressCB(self, id, title, message):
data = self.bridge.getProgress(id)
@ -340,7 +375,7 @@ class MainWindow(wx.Frame, QuickApp):
def onParam(self, e):
debug("Param request")
param=Param(self.bridge)
param=Param(self)
def onExit(self, e):
self.Close()