comparison gamelib/toolbar.py @ 544:84964077626a

Counter display more compact, although not as pretty as it should be.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 28 Nov 2009 10:46:19 +0000
parents 450de9dfa106
children 56a3a3f54e3d
comparison
equal deleted inserted replaced
543:03be16420e8b 544:84964077626a
80 80
81 def add_labels(self): 81 def add_labels(self):
82 self.tr() 82 self.tr()
83 self.td(gui.Spacer(self.rect.w/2, 0)) 83 self.td(gui.Spacer(self.rect.w/2, 0))
84 self.td(gui.Spacer(self.rect.w/2, 0)) 84 self.td(gui.Spacer(self.rect.w/2, 0))
85 self.add_counter(icons.DAY_ICON, self.day_counter) 85 self._counter_col = 0
86 self.add_counter(icons.GROATS_ICON, self.cash_counter) 86 self.add_counter(icons.GROATS_ICON, self.cash_counter)
87 self.add_counter(icons.WOOD_ICON, self.wood_counter) 87 self.add_counter(icons.WOOD_ICON, self.wood_counter)
88 self.add_counter(icons.CHKN_ICON, self.chicken_counter)
88 self.add_counter(icons.EGG_ICON, self.egg_counter) 89 self.add_counter(icons.EGG_ICON, self.egg_counter)
89 self.add_counter(icons.CHKN_ICON, self.chicken_counter)
90 self.add_counter(icons.KILLED_FOX, self.killed_foxes) 90 self.add_counter(icons.KILLED_FOX, self.killed_foxes)
91 self.add_counter(icons.DAY_ICON, self.day_counter)
91 self.add_spacer(5) 92 self.add_spacer(5)
92 93
93 def start_night(self): 94 def start_night(self):
94 self.clear_tool() 95 self.clear_tool()
95 self._set_all_disabled(True) 96 self._set_all_disabled(True)
237 self.group.value = None 238 self.group.value = None
238 for item in self.group.widgets: 239 for item in self.group.widgets:
239 item.pcls = "" 240 item.pcls = ""
240 241
241 def add_counter(self, icon, label): 242 def add_counter(self, icon, label):
242 self.tr() 243 if self._counter_col == 0:
243 self.td(icon, width=self.rect.w/2) 244 self.add_spacer(5)
244 self.td(label, width=self.rect.w/2) 245 self.tr()
246 tbl = gui.Table()
247 tbl.tr()
248 tbl.td(icon, width=self.rect.w/2)
249 tbl.tr()
250 tbl.td(label, width=self.rect.w/2)
251 self.td(tbl)
252 self._counter_col = (self._counter_col + 1) % 2
245 253
246 def resize(self, width=None, height=None): 254 def resize(self, width=None, height=None):
247 width, height = gui.Table.resize(self, width, height) 255 width, height = gui.Table.resize(self, width, height)
248 width = constants.TOOLBAR_WIDTH 256 width = constants.TOOLBAR_WIDTH
249 return width, height 257 return width, height