Mercurial > libervia-backend
diff frontends/wix/main_window.py @ 22:bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Dec 2009 04:56:08 +0100 |
parents | 6928e3cb73a8 |
children | 925ab466c5ec |
line wrap: on
line diff
--- a/frontends/wix/main_window.py Sun Nov 08 01:49:08 2009 +0100 +++ b/frontends/wix/main_window.py Tue Dec 01 04:56:08 2009 +0100 @@ -284,11 +284,46 @@ 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 @@ def onParam(self, e): debug("Param request") - param=Param(self.bridge) + param=Param(self) def onExit(self, e): self.Close()