Package horizons :: Package gui :: Package widgets :: Module inventory :: Class Inventory
[hide private]
[frames] | no frames]

Class Inventory

source code

fife.extensions.pychan.widgets.Container --+
                                           |
                                          Inventory

The inventory widget displays information about the goods in a Storage. It uses ImageFillStatusButtons to display icons and a fill bar for these resources. It can be used like any other widget in xml files, but for full functionality the inventory has to be manually set, or use the TabWidget, which will autoset it (was made to be done this way).

XML use: <Inventory />, can take all parameters of a Container.

Instance Methods [hide private]
 
__init__(self, uncached=False, display_legend=True, items_per_line=4, **kwargs) source code
 
init_needed(self, inventory) source code
 
init(self, db, inventory, ordinal=None)
This inits the logic of the inventory.
source code
 
update(self) source code
 
_draw(self, vbox, current_hbox, index=0)
Draws the inventory.
source code
 
apply_to_buttons(self, action, filt=None)
Applies action to all buttons shown in inventory
source code
Class Variables [hide private]
  ATTRIBUTES = Container.ATTRIBUTES+ [BoolAttr('uncached'), Bool...
  UNUSABLE_SLOT_IMAGE = "content/gui/icons/resources/none_gray.png"
Method Details [hide private]

init(self, db, inventory, ordinal=None)

source code 

This inits the logic of the inventory. @see __init__().

Parameters:
  • ordinal - {res: (min, max)} Display ordinal scale with these boundaries instead of numbers for a particular resource. Currently implemented via ImageFillStatusButton.

apply_to_buttons(self, action, filt=None)

source code 

Applies action to all buttons shown in inventory

Parameters:
  • action - function called that touches button
  • filt - function used to filter the buttons both functions take one parameter which is the button

Class Variable Details [hide private]

ATTRIBUTES

Value:
Container.ATTRIBUTES+ [BoolAttr('uncached'), BoolAttr('display_legend'\
), IntAttr("items_per_line")]