Package horizons :: Package component :: Module selectablecomponent :: Class SelectableComponent
[hide private]
[frames] | no frames]

Class SelectableComponent

source code

Component --+
            |
           SelectableComponent

Stuff you can select. Has to be subdivided in buildings and units, which is further specialized to ships.

Provides: show_menu(): shows tabs select(): highlight instance visually deselect(): inverse of select

show_menu() and select() are frequently used in combination.

The definitions must contain type, tabs and enemy_tabs.

Instance Methods [hide private]
 
__init__(self, tabs, enemy_tabs, active_tab=None)
Used for initialization code that does not require any other components.
source code
 
show_menu(self, jump_to_tabclass=None)
Shows tabwidget tabs of this instance.
source code
 
select(self, reset_cam=False) source code
 
deselect(self) source code
 
selected(self) source code
 
remove(self)
Removes component and reference to instance
source code
    Inherited from Component
 
__gt__(self, other) source code
 
__lt__(self, other) source code
 
initialize(self)
This is called by the ComponentHolder after it set the instance.
source code
 
load(self, db, worldid)
This does on load what __init() and initalize() together do on constructions at runtime.
source code
 
save(self, db)
Will do nothing, but will be always called in componentholder code, even if not implemented.
source code
 
session(self) source code
Class Methods [hide private]
 
get_instance(cls, arguments)
This function is used to instantiate classes from yaml data.
source code
Class Variables [hide private]
  NAME = "selectablecomponent"
hash(x)
    Inherited from Component
  DEPENDENCIES = []
Method Details [hide private]

get_instance(cls, arguments)
Class Method

source code 

This function is used to instantiate classes from yaml data. Override this if the component has more than just a basic constructor with primitive types (takes custom classes as arguments, e.g. Storages)

Overrides: Component.get_instance
(inherited documentation)

__init__(self, tabs, enemy_tabs, active_tab=None)
(Constructor)

source code 

Used for initialization code that does not require any other components. This is always called first, on construction and on load.

Overrides: Component.__init__
(inherited documentation)

show_menu(self, jump_to_tabclass=None)

source code 

Shows tabwidget tabs of this instance.

Opens the first such tab unless jump_to_tabclass specifies otherwise.

Parameters:
  • jump_to_tabclass - open the first tab that is a subclass to this parameter

selected(self)

source code 
Decorators:
  • @property

remove(self)

source code 

Removes component and reference to instance

Overrides: Component.remove
(inherited documentation)