Mercurial > rinkhals
comparison gamelib/misc.py @ 575:95c71a13468c
Convert failed save/restore print messages to warning dialogs.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 28 Nov 2009 20:31:48 +0000 |
parents | 7963fc09fac2 |
children |
comparison
equal
deleted
inserted
replaced
574:ecad90bbdc61 | 575:95c71a13468c |
---|---|
115 self.clicked(False) | 115 self.clicked(False) |
116 return True | 116 return True |
117 return gui.Dialog.event(self, e) | 117 return gui.Dialog.event(self, e) |
118 | 118 |
119 | 119 |
120 class WarnDialog(gui.Dialog): | |
121 def __init__(self, title, message, **params): | |
122 title = gui.Label(title) | |
123 | |
124 body = gui.Table() | |
125 body.tr() | |
126 body.td(gui.Label(message), colspan=3) | |
127 body.tr() | |
128 body.td(gui.Spacer(0, 15), colspan=3) | |
129 | |
130 ok_button = gui.Button("Ok") | |
131 ok_button.connect(gui.CLICK, self.clicked) | |
132 | |
133 body.tr() | |
134 body.td(gui.Spacer(0, 0), colspan=2) | |
135 body.td(ok_button, align=-1) | |
136 | |
137 gui.Dialog.__init__(self, title, body, **params) | |
138 | |
139 def clicked(self): | |
140 self.close() | |
141 | |
142 def event(self, e): | |
143 if e.type == KEYDOWN and e.key == K_ESCAPE: | |
144 self.clicked() | |
145 return True | |
146 return gui.Dialog.event(self, e) | |
147 | |
148 | |
120 # Utility layout functions | 149 # Utility layout functions |
121 | 150 |
122 def make_box(text, markup=False): | 151 def make_box(text, markup=False): |
123 style = { | 152 style = { |
124 'border' : 1, | 153 'border' : 1, |