Mercurial > libervia-backend
diff frontends/src/wix/main_window.py @ 1106:e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
- there are now XMLUIPanel and XMLUIDialog both inheriting from XMLUIBase
- following dialogs are managed:
- MessageDialog
- NoteDialog
- ConfirmDialog
- FileDialog
- XMLUI creation is now made using xmlui.create(...) instead of instanciating directly XMLUI
- classes must be registed in frontends
- "parent" attribute renamed to "_xmlui_parent" to avoid name conflicts with frontends toolkits
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 13 Aug 2014 14:48:49 +0200 |
parents | a096b8579a3c |
children | 75025461141f |
line wrap: on
line diff
--- a/frontends/src/wix/main_window.py Mon Aug 11 19:10:24 2014 +0200 +++ b/frontends/src/wix/main_window.py Wed Aug 13 14:48:49 2014 +0200 @@ -25,7 +25,7 @@ import wx from sat_frontends.wix.contact_list import ContactList from sat_frontends.wix.chat import Chat -from sat_frontends.wix.xmlui import XMLUI +from sat_frontends.wix import xmlui from sat_frontends.wix.profile import Profile from sat_frontends.wix.profile_manager import ProfileManager import os.path @@ -192,16 +192,16 @@ popup.Show() wx.CallLater(5000,popup.Destroy) - def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None): - if 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': + elif type_ == 'error': flags = wx.OK | wx.ICON_ERROR - elif type == 'yes/no': + elif type_ == 'yes/no': flags = wx.YES_NO | wx.ICON_QUESTION else: flags = wx.OK | wx.ICON_INFORMATION - log.error(_('unmanaged dialog type: %s'), type) + log.error(_('unmanaged dialog type: %s'), type_) dlg = wx.MessageDialog(self, message, title, flags) answer = dlg.ShowModal() dlg.Destroy() @@ -243,7 +243,8 @@ pass elif "xmlui" in data: log.debug (_("XML user interface received")) - XMLUI(self, xml_data = data['xmlui']) + ui = xmlui.create(self, xml_data = data['xmlui']) + ui.show() elif "authenticated_profile" in data: assert("caller" in data) if data["caller"] == "profile_manager": @@ -345,7 +346,7 @@ title = _('Registration') misc['target'] = data['target'] misc['action_back'] = self.bridge.gatewayRegister - XMLUI(self, title=title, xml_data = data['xml'], misc = misc) + xmlui.create(self, title=title, xml_data = data['xml'], misc = misc) elif type_ == "RESULT": self.current_action_ids.remove(id_) if self.current_action_ids_cb.has_key(id_): @@ -413,7 +414,7 @@ def onParam(self, e): log.debug(_("Param request")) def success(params): - XMLUI(self, xml_data=params, title=_("Configuration")) + xmlui.create(self, xml_data=params, title=_("Configuration")) def failure(error): dlg = wx.MessageDialog(self, error.message,