Mercurial > libervia-backend
comparison frontends/src/wix/card_game.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 | 5a6354ff468c |
children |
comparison
equal
deleted
inserted
replaced
1105:018bdd687747 | 1106:e2e1e27a3680 |
---|---|
23 import os.path, glob | 23 import os.path, glob |
24 from sat.core.log import getLogger | 24 from sat.core.log import getLogger |
25 log = getLogger(__name__) | 25 log = getLogger(__name__) |
26 from sat_frontends.tools.games import TarotCard | 26 from sat_frontends.tools.games import TarotCard |
27 from sat_frontends.quick_frontend.quick_card_game import QuickCardGame | 27 from sat_frontends.quick_frontend.quick_card_game import QuickCardGame |
28 from sat_frontends.wix.xmlui import XMLUI | 28 from sat_frontends.wix import xmlui |
29 | 29 |
30 CARD_WIDTH = 74 | 30 CARD_WIDTH = 74 |
31 CARD_HEIGHT = 136 | 31 CARD_HEIGHT = 136 |
32 MIN_WIDTH = 950 #Minimum size of the panel | 32 MIN_WIDTH = 950 #Minimum size of the panel |
33 MIN_HEIGHT = 500 | 33 MIN_HEIGHT = 500 |
101 QuickCardGame.contratSelected(self, contrat) | 101 QuickCardGame.contratSelected(self, contrat) |
102 | 102 |
103 def chooseContrat(self, xml_data): | 103 def chooseContrat(self, xml_data): |
104 """Called when the player has to select his contrat | 104 """Called when the player has to select his contrat |
105 @param xml_data: SàT xml representation of the form""" | 105 @param xml_data: SàT xml representation of the form""" |
106 XMLUI(self.parent.host, xml_data, title=_('Please choose your contrat'), flags=['NO_CANCEL']) | 106 xmlui.create(self.parent.host, xml_data, title=_('Please choose your contrat'), flags=['NO_CANCEL']) |
107 | 107 |
108 def showScores(self, xml_data, winners, loosers): | 108 def showScores(self, xml_data, winners, loosers): |
109 """Called when the round is over, display the scores | 109 """Called when the round is over, display the scores |
110 @param xml_data: SàT xml representation of the form""" | 110 @param xml_data: SàT xml representation of the form""" |
111 if not winners and not loosers: | 111 if not winners and not loosers: |
112 title = _("Draw game") | 112 title = _("Draw game") |
113 else: | 113 else: |
114 title = _('You win \o/') if self.player_nick in winners else _('You loose :(') | 114 title = _('You win \o/') if self.player_nick in winners else _('You loose :(') |
115 XMLUI(self.parent.host, xml_data, title=title, flags=['NO_CANCEL']) | 115 xmlui.create(self.parent.host, xml_data, title=title, flags=['NO_CANCEL']) |
116 | 116 |
117 def cardsPlayed(self, player, cards): | 117 def cardsPlayed(self, player, cards): |
118 """A card has been played by player""" | 118 """A card has been played by player""" |
119 QuickCardGame.cardsPlayed(self, player, cards) | 119 QuickCardGame.cardsPlayed(self, player, cards) |
120 self.Refresh() | 120 self.Refresh() |