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
This commit is contained in:
Goffi 2014-08-13 14:48:49 +02:00
commit b6563c596b

View file

@ -25,7 +25,7 @@ from sat_frontends.quick_frontend.quick_app import QuickApp
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 @@ class MainWindow(wx.Frame, QuickApp):
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 @@ class MainWindow(wx.Frame, QuickApp):
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 @@ class MainWindow(wx.Frame, QuickApp):
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 @@ class MainWindow(wx.Frame, QuickApp):
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,