Mercurial > libervia-backend
diff frontends/src/primitivus/card_game.py @ 687:af0d08a84cc6
primitivus card_game: bug fix and improvement
- changeset 56f8a9c99194 introduced a bug because it connected all the list widgets to the parameter change callback. This is not OK because the Tarot is using a list form that is not a parameter.
- some list processing was raising an error when the data is not initialized
- display the "choose contrat" dialog with valign='top' to allow the user see his hand while taking the decision.
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 28 Oct 2013 19:04:49 +0100 |
parents | ae95b0327412 |
children | 56aa0e98c92e |
line wrap: on
line diff
--- a/frontends/src/primitivus/card_game.py Mon Oct 28 18:49:01 2013 +0100 +++ b/frontends/src/primitivus/card_game.py Mon Oct 28 19:04:49 2013 +0100 @@ -109,9 +109,12 @@ def update(self, hand): """Update the hand displayed in this widget @param hand: list of Card""" - del self.columns.widget_list[:] - del self.columns.column_types[:] - self.columns.contents.append((urwid.Text(''),('weight',1, False))) + try: + del self.columns.widget_list[:] + del self.columns.column_types[:] + except IndexError: + pass + self.columns.contents.append((urwid.Text(''), ('weight', 1, False))) for card in hand: widget = CardDisplayer(card) self.columns.widget_list.append(widget) @@ -260,7 +263,7 @@ @param xml_data: SàT xml representation of the form""" misc = {'callback': self.contratSelected} form = XMLUI(self.parent.host, xml_data, title=_('Please choose your contrat'), options=['NO_CANCEL'], misc=misc) - form.show() + form.show(valign='top') def showCards(self, game_stage, cards, data): """Display cards in the middle of the game (to show for e.g. chien ou poignée)"""