comparison gamelib/gameboard.py @ 287:21b0c4a99c0a

Add close button to price dialog
author Neil Muller <drnlmuller@gmail.com>
date Sat, 05 Sep 2009 16:00:01 +0000
parents 49418fd43748
children 5539744cfd40
comparison
equal deleted inserted replaced
286:49418fd43748 287:21b0c4a99c0a
141 max_width = thing.style.width 141 max_width = thing.style.width
142 for thing in doc.widgets: 142 for thing in doc.widgets:
143 if hasattr(thing, 'style'): 143 if hasattr(thing, 'style'):
144 thing.style.width = max_width + 10 144 thing.style.width = max_width + 10
145 145
146 tbl = gui.Table()
147 tbl.tr()
146 doc = gui.Document(width=400) 148 doc = gui.Document(width=400)
147 space = doc.style.font.size(" ") 149 space = doc.style.font.size(" ")
148 for header in ['Item', 'Buy Price', 'Sell Price']: 150 for header in ['Item', 'Buy Price', 'Sell Price']:
149 doc.add(make_box(header)) 151 doc.add(make_box(header))
150 doc.br(space[1]) 152 doc.br(space[1])
161 fix_widths(doc) 163 fix_widths(doc)
162 for word in "Damaged equipment will be sold for less than" \ 164 for word in "Damaged equipment will be sold for less than" \
163 " the sell price.".split(): 165 " the sell price.".split():
164 doc.add(gui.Label(word)) 166 doc.add(gui.Label(word))
165 doc.space(space) 167 doc.space(space)
166 dialog = gui.Dialog(gui.Label('Price Reference'), doc) 168 close_button = gui.Button("Close")
169 tbl.td(doc, colspan=3)
170 tbl.tr()
171 tbl.td(gui.Label(''))
172 tbl.td(gui.Label(''))
173 tbl.td(close_button)
174 dialog = gui.Dialog(gui.Label('Price Reference'), tbl)
175 close_button.connect(gui.CLICK, dialog.close)
167 dialog.open() 176 dialog.open()
168 177
169 update_cash_counter = mkcountupdate('cash_counter') 178 update_cash_counter = mkcountupdate('cash_counter')
170 update_fox_counter = mkcountupdate('killed_foxes') 179 update_fox_counter = mkcountupdate('killed_foxes')
171 update_chicken_counter = mkcountupdate('chicken_counter') 180 update_chicken_counter = mkcountupdate('chicken_counter')
263 def event(self, e): 272 def event(self, e):
264 if e.type == MOUSEBUTTONDOWN: 273 if e.type == MOUSEBUTTONDOWN:
265 self.gameboard.use_tool(e) 274 self.gameboard.use_tool(e)
266 elif e.type == MOUSEMOTION and self.gameboard.sprite_cursor: 275 elif e.type == MOUSEMOTION and self.gameboard.sprite_cursor:
267 self.gameboard.update_sprite_cursor(e) 276 self.gameboard.update_sprite_cursor(e)
268
269 277
270 class GameBoard(object): 278 class GameBoard(object):
271 TILE_DIMENSIONS = (20, 20) 279 TILE_DIMENSIONS = (20, 20)
272 TOOLBAR_WIDTH = 140 280 TOOLBAR_WIDTH = 140
273 281