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

@ -22,7 +22,7 @@ import urwid
from urwid_satext import sat_widgets
from sat_frontends.tools.games import TarotCard
from sat_frontends.quick_frontend.quick_card_game import QuickCardGame
from sat_frontends.primitivus.xmlui import XMLUI
from sat_frontends.primitivus import xmlui
class CardDisplayer(urwid.Text):
@ -269,7 +269,7 @@ class CardGame(QuickCardGame, urwid.WidgetWrap):
def chooseContrat(self, xml_data):
"""Called when the player has to select his contrat
@param xml_data: SàT xml representation of the form"""
form = XMLUI(self.parent.host, xml_data, title=_('Please choose your contrat'), flags=['NO_CANCEL'])
form = xmlui.create(self.parent.host, xml_data, title=_('Please choose your contrat'), flags=['NO_CANCEL'])
form.show(valign='top')
def showCards(self, game_stage, cards, data):
@ -288,7 +288,7 @@ class CardGame(QuickCardGame, urwid.WidgetWrap):
title = _("Draw game")
else:
title = _('You win \o/') if self.player_nick in winners else _('You loose :(')
form = XMLUI(self.parent.host, xml_data, title=title, flags=['NO_CANCEL'])
form = xmlui.create(self.parent.host, xml_data, title=title, flags=['NO_CANCEL'])
form.show()
def invalidCards(self, phase, played_cards, invalid_cards):