diff --git a/content/gui/xml/ingame/tabwidget/island_inventory.xml b/content/gui/xml/ingame/tabwidget/island_inventory.xml
index 79978364571..1ba6a2ba4d9 100644
--- a/content/gui/xml/ingame/tabwidget/island_inventory.xml
+++ b/content/gui/xml/ingame/tabwidget/island_inventory.xml
@@ -10,29 +10,39 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
diff --git a/content/gui/xml/ingame/tabwidget/overview/overview_enemywarehouse.xml b/content/gui/xml/ingame/tabwidget/overview/overview_enemywarehouse.xml
index 5c0fcdda57f..cdf4e5a132c 100644
--- a/content/gui/xml/ingame/tabwidget/overview/overview_enemywarehouse.xml
+++ b/content/gui/xml/ingame/tabwidget/overview/overview_enemywarehouse.xml
@@ -15,20 +15,24 @@
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/content/gui/xml/ingame/tabwidget/ships/overview_trade_ship.xml b/content/gui/xml/ingame/tabwidget/ships/overview_trade_ship.xml
index c66943e9801..172548529b3 100644
--- a/content/gui/xml/ingame/tabwidget/ships/overview_trade_ship.xml
+++ b/content/gui/xml/ingame/tabwidget/ships/overview_trade_ship.xml
@@ -48,12 +48,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/content/gui/xml/ingame/tabwidget/ships/overview_war_ship.xml b/content/gui/xml/ingame/tabwidget/ships/overview_war_ship.xml
index 46fdd76fe1b..89354879739 100644
--- a/content/gui/xml/ingame/tabwidget/ships/overview_war_ship.xml
+++ b/content/gui/xml/ingame/tabwidget/ships/overview_war_ship.xml
@@ -48,12 +48,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/content/gui/xml/ingame/tabwidget/ships/tradetab.xml b/content/gui/xml/ingame/tabwidget/ships/tradetab.xml
index f7bf35d3548..37f12c02361 100644
--- a/content/gui/xml/ingame/tabwidget/ships/tradetab.xml
+++ b/content/gui/xml/ingame/tabwidget/ships/tradetab.xml
@@ -23,7 +23,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
@@ -93,11 +93,11 @@
-
+
-
diff --git a/horizons/gui/util.py b/horizons/gui/util.py
index 7b1b2b9a7be..298af3ffde1 100644
--- a/horizons/gui/util.py
+++ b/horizons/gui/util.py
@@ -150,7 +150,7 @@ def create_resource_selection_dialog(on_click, inventory, db, widget='select_tra
dlg = load_uh_widget(widget)
- button_width = ImageFillStatusButton.DEFAULT_BUTTON_SIZE[0] # used for dummy button
+ button_width = ImageFillStatusButton.CELL_SIZE[0] # used for dummy button
vbox = dlg.findChild(name="resources")
amount_per_line = vbox.width / button_width
current_hbox = pychan.widgets.HBox(name="hbox_0", padding=0)
diff --git a/horizons/gui/widgets/imagefillstatusbutton.py b/horizons/gui/widgets/imagefillstatusbutton.py
index 5e5e3bbcc43..6e663b642b6 100644
--- a/horizons/gui/widgets/imagefillstatusbutton.py
+++ b/horizons/gui/widgets/imagefillstatusbutton.py
@@ -28,7 +28,7 @@
class ImageFillStatusButton(pychan.widgets.Container):
- DEFAULT_BUTTON_SIZE = (55, 50)
+ CELL_SIZE = (54, 50) # 32x32 icon, fillbar to the right, label below, padding
def __init__(self, up_image, down_image, hover_image, text, res_id, helptext="", \
filled=0, uncached=False, **kwargs):
@@ -41,7 +41,7 @@ def __init__(self, up_image, down_image, hover_image, text, res_id, helptext="",
self.helptext = _(helptext)
# res_id is used by the TradeTab for example to determine the resource this button represents
self.res_id = res_id
- self.text_position = (17, 36)
+ self.text_position = (9, 30)
self.uncached = uncached # force no cache. needed when the same icon has to appear several times at the same time
self.filled = filled # <- black magic at work! this calls _draw()
@@ -55,9 +55,9 @@ def init_for_res(cls, db, res, amount=0, filled=0, use_inactive_icon=True, uncac
@param use_inactive_icon: wheter to use inactive icon if amount == 0
@param uncached: force no cache. see __init__()
@return: ImageFillStatusButton instance"""
- icon = get_res_icon_path(res, 50)
+ icon = get_res_icon_path('placeholder', size=32)
if use_inactive_icon:
- icon_disabled = get_res_icon_path(res, 50, greyscale=True)
+ icon_disabled = get_res_icon_path(res, size=50, greyscale=True)
else:
icon_disabled = icon
helptext = db.get_res_name(res)
@@ -65,11 +65,10 @@ def init_for_res(cls, db, res, amount=0, filled=0, use_inactive_icon=True, uncac
return cls(up_image=image, down_image=image, hover_image=image,
text=unicode(amount),
helptext=helptext,
- size=cls.DEFAULT_BUTTON_SIZE,
- res_id = res,
- filled = filled,
- uncached = uncached,
- opaque=False)
+ size=cls.CELL_SIZE,
+ res_id=res,
+ filled=filled,
+ uncached=uncached)
def _set_filled(self, percent):
""""@param percent: int percent that fillstatus will be green"""
@@ -106,6 +105,8 @@ def _draw(self):
self.label = pychan.widgets.Label(text=self.text)
self.label.position = self.text_position
self.fill_bar = pychan.widgets.Icon(image="content/gui/images/tabwidget/green_line.png")
- self.fill_bar.position = (self.button.width-self.fill_bar.width-1, \
- self.button.height-int(self.button.height/100.0*self.filled))
+ fill_level = (self.button.height * self.filled) // 100
+ self.fill_bar.size = (2*self.fill_bar.size[0]//3, fill_level)
+ # move fillbar down after resizing, since its origin is top aligned
+ self.fill_bar.position = (self.button.width, self.button.height - fill_level)
self.addChildren(self.button, self.fill_bar, self.label)
diff --git a/horizons/gui/widgets/inventory.py b/horizons/gui/widgets/inventory.py
index 914ce0142c1..c2d1c0b9d07 100644
--- a/horizons/gui/widgets/inventory.py
+++ b/horizons/gui/widgets/inventory.py
@@ -125,14 +125,16 @@ def _draw(self):
self.parent.removeChildren(icons[self.ITEMS_PER_LINE-1:])
vbox.addChild(current_hbox)
self.addChild(vbox)
+ height = ImageFillStatusButton.CELL_SIZE[1] * len(self._res_order) // self.ITEMS_PER_LINE
+ self.min_size = (self.min_size[0], height)
if self.display_legend:
if isinstance(self._inventory, TotalStorage):
# Add total storage indicator
sum_stored_res = self._inventory.get_sum_of_stored_resources()
label = pychan.widgets.Label()
label.text = unicode(sum_stored_res) + u"/" + unicode(self._inventory.get_limit(None))
- label.position = (170, 53)
- self.__icon.position = (150, 53)
+ label.position = (150, 53)
+ self.__icon.position = (130, 53)
self.addChildren(label, self.__icon)
elif isinstance(self._inventory, PositiveSizedSlotStorage):
label = pychan.widgets.Label()