comparison browser_side/dialog.py @ 39:305e81c7a32c

Tarot game: a game can now be finished
author Goffi <goffi@goffi.org>
date Sun, 22 May 2011 00:15:01 +0200
parents 6b8da70b0799
children 7782a786b2f0
comparison
equal deleted inserted replaced
38:7bea2ae0c4fb 39:305e81c7a32c
79 self.callback(self.contacts_list.getSelectedValues()) 79 self.callback(self.contacts_list.getSelectedValues())
80 80
81 def onCancel(self): 81 def onCancel(self):
82 self.hide() 82 self.hide()
83 83
84 class ConfirmDialog(DialogBox):
85
86 def __init__(self, callback, text='Are you sure ?'):
87 """
88 Dialog to confirm an action
89 @param callback: method to call when contacts have been choosed
90 """
91 self.callback = callback
92 DialogBox.__init__(self, centered=True)
93
94 content = VerticalPanel()
95 content.setWidth('100%')
96 button_panel = HorizontalPanel()
97 self.confirm_button = Button("OK", self.onConfirm)
98 button_panel.add(self.confirm_button)
99 button_panel.add(Button("Cancel", self.onCancel))
100 content.add(button_panel)
101 self.setHTML(text)
102 self.setWidget(content)
103
104 def onConfirm(self):
105 self.hide()
106 self.callback(True)
107
108 def onCancel(self):
109 self.hide()
110 self.callback(False)
111