changeset 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 03be16420e8b
children 56a3a3f54e3d
files gamelib/gameboard.py gamelib/toolbar.py
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameboard.py	Sat Nov 28 10:12:00 2009 +0000
+++ b/gamelib/gameboard.py	Sat Nov 28 10:46:19 2009 +0000
@@ -224,8 +224,7 @@
         self.toolbar.update_chicken_counter(len(self.chickens))
         self.toolbar.update_cash_counter(self.cash)
         self.toolbar.update_wood_counter(self.wood)
-        if self.killed_foxes:
-            self.toolbar.update_fox_counter(self.killed_foxes)
+        self.toolbar.update_fox_counter(self.killed_foxes)
 
     def update(self):
         self.tvw.reupdate()
--- a/gamelib/toolbar.py	Sat Nov 28 10:12:00 2009 +0000
+++ b/gamelib/toolbar.py	Sat Nov 28 10:46:19 2009 +0000
@@ -82,12 +82,13 @@
         self.tr()
         self.td(gui.Spacer(self.rect.w/2, 0))
         self.td(gui.Spacer(self.rect.w/2, 0))
-        self.add_counter(icons.DAY_ICON, self.day_counter)
+        self._counter_col = 0
         self.add_counter(icons.GROATS_ICON, self.cash_counter)
         self.add_counter(icons.WOOD_ICON, self.wood_counter)
+        self.add_counter(icons.CHKN_ICON, self.chicken_counter)
         self.add_counter(icons.EGG_ICON, self.egg_counter)
-        self.add_counter(icons.CHKN_ICON, self.chicken_counter)
         self.add_counter(icons.KILLED_FOX, self.killed_foxes)
+        self.add_counter(icons.DAY_ICON, self.day_counter)
         self.add_spacer(5)
 
     def start_night(self):
@@ -239,9 +240,16 @@
             item.pcls = ""
 
     def add_counter(self, icon, label):
-        self.tr()
-        self.td(icon, width=self.rect.w/2)
-        self.td(label, width=self.rect.w/2)
+        if self._counter_col == 0:
+            self.add_spacer(5)
+            self.tr()
+        tbl = gui.Table()
+        tbl.tr()
+        tbl.td(icon, width=self.rect.w/2)
+        tbl.tr()
+        tbl.td(label, width=self.rect.w/2)
+        self.td(tbl)
+        self._counter_col = (self._counter_col + 1) % 2
 
     def resize(self, width=None, height=None):
         width, height = gui.Table.resize(self, width, height)