Mercurial > rinkhals
comparison gamelib/gameboard.py @ 169:946f09ed37cd
Make equipment dialog close after selecting an item to sell.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Thu, 03 Sep 2009 22:44:20 +0000 |
parents | 1014bfcddc4c |
children | 92d11e0544bc |
comparison
equal
deleted
inserted
replaced
168:1014bfcddc4c | 169:946f09ed37cd |
---|---|
326 tbl.tr() | 326 tbl.tr() |
327 tbl.td(gui.Spacer(100, 0)) | 327 tbl.td(gui.Spacer(100, 0)) |
328 tbl.td(close_button) | 328 tbl.td(close_button) |
329 | 329 |
330 self.disp.open(tbl) | 330 self.disp.open(tbl) |
331 return tbl | |
331 | 332 |
332 def open_building_dialog(self, building): | 333 def open_building_dialog(self, building): |
333 """Create dialog for manipulating the contents of a building.""" | 334 """Create dialog for manipulating the contents of a building.""" |
334 def select_occupant(place, button): | 335 def select_occupant(place, button): |
335 """Select occupant in place.""" | 336 """Select occupant in place.""" |
451 | 452 |
452 def sell_item(item, button): | 453 def sell_item(item, button): |
453 """Select item of equipment.""" | 454 """Select item of equipment.""" |
454 self.add_cash(item.sell_price()) | 455 self.add_cash(item.sell_price()) |
455 chicken.unequip(item) | 456 chicken.unequip(item) |
456 self.disp.close(tbl) | 457 self.disp.close(dialog) |
457 | 458 |
458 kwargs = { 'style': { 'padding_left': 10, 'padding_bottom': 10 }} | 459 kwargs = { 'style': { 'padding_left': 10, 'padding_bottom': 10 }} |
459 | 460 |
460 tbl.tr() | 461 tbl.tr() |
461 tbl.td(gui.Button("Sell ... "), align=-1, **kwargs) | 462 tbl.td(gui.Button("Sell ... "), align=-1, **kwargs) |
464 tbl.tr() | 465 tbl.tr() |
465 button = gui.Button(item.name().title()) | 466 button = gui.Button(item.name().title()) |
466 button.connect(gui.CLICK, sell_item, item, button) | 467 button.connect(gui.CLICK, sell_item, item, button) |
467 tbl.td(button, align=1, **kwargs) | 468 tbl.td(button, align=1, **kwargs) |
468 | 469 |
469 self.open_dialog(tbl) | 470 dialog = self.open_dialog(tbl) |
470 | 471 |
471 def event(self, e): | 472 def event(self, e): |
472 if e.type == KEYDOWN: | 473 if e.type == KEYDOWN: |
473 if e.key == K_UP: | 474 if e.key == K_UP: |
474 self.tvw.move_view(0, -self.TILE_DIMENSIONS[1]) | 475 self.tvw.move_view(0, -self.TILE_DIMENSIONS[1]) |