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.
This commit is contained in:
parent
bc2d308c3e
commit
a154d9acbb
1 changed files with 17 additions and 11 deletions
|
|
@ -105,7 +105,7 @@ class XMLUI(urwid.WidgetWrap):
|
|||
self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
|
||||
elif type_=="list":
|
||||
style=[] if elem.getAttribute("multi")=='yes' else ['single']
|
||||
ctrl = sat_widgets.List(options=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=style, on_change=self.onParamChange)
|
||||
ctrl = sat_widgets.List(options=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=style, on_change=self.onParamChange if self.type == "param" else None)
|
||||
ctrl.selectValue(elem.getAttribute("value"))
|
||||
self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
|
||||
elif type_=="button":
|
||||
|
|
@ -210,15 +210,18 @@ class XMLUI(urwid.WidgetWrap):
|
|||
ret_wid.addFooter(grid_wid)
|
||||
return ret_wid
|
||||
|
||||
def show(self,show_type = 'popup'):
|
||||
def show(self, show_type='popup', valign='middle'):
|
||||
"""Show the constructed UI
|
||||
@param show_type: how to show the UI:
|
||||
- popup
|
||||
- window"""
|
||||
- window
|
||||
@param valign: vertical alignment when show_type is 'popup'.
|
||||
Ignored when show_type is 'window'.
|
||||
"""
|
||||
self.__dest = "popup"
|
||||
decorated = sat_widgets.LabelLine(self, sat_widgets.SurroundedText(self.title or ''))
|
||||
if show_type == 'popup':
|
||||
self.host.showPopUp(decorated)
|
||||
self.host.showPopUp(decorated, valign=valign)
|
||||
elif show_type == 'window':
|
||||
self.host.addWindow(decorated)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue