Package horizons :: Package gui :: Module ingamegui :: Class IngameGui
[hide private]
[frames] | no frames]

Class IngameGui

source code

util.living.LivingObject --+
                           |
                          IngameGui

Class handling all the ingame gui events. Assumes that only 1 instance is used (class variables)

Instance Methods [hide private]
 
__init__(self, session) source code
 
end(self)
Put all the code the object needs to end safely here.
source code
 
show_select_savegame(self, mode) source code
 
toggle_pause(self) source code
 
toggle_help(self) source code
 
minimap_to_front(self)
Make sure the full right top gui is visible and not covered by some dialog
source code
 
show_diplomacy_menu(self) source code
 
show_multi_select_tab(self, instances) source code
 
show_build_menu(self, update=False) source code
 
deselect_all(self) source code
 
_build(self, building_id, unit=None)
Calls the games buildingtool class for the building_id.
source code
 
toggle_road_tool(self) source code
 
get_cur_menu(self)
Returns menu that is currently displayed
source code
 
show_menu(self, menu)
Shows a menu
source code
 
hide_menu(self) source code
 
save(self, db) source code
 
save_selection(self, db) source code
 
load(self, db) source code
 
load_selection(self, db) source code
 
show_change_name_dialog(self, instance)
Shows a dialog where the user can change the name of an object.
source code
 
on_escape(self) source code
 
on_return(self) source code
 
_on_speed_changed(self, message) source code
 
_display_speed(self, tps) source code
 
on_key_press(self, action, evt)
Handle a key press in-game.
source code
 
handle_selection_group(self, num, ctrl_pressed)
Select existing or assign new unit selection group.
source code
 
toggle_cursor(self, which)
Alternate between the cursor *which* and the default cursor.
source code
 
set_cursor(self, which='default', *args, **kwargs)
Sets the mousetool (i.e.
source code
 
toggle_destroy_tool(self)
Initiate the destroy tool
source code
 
_update_zoom(self, message)
Enable/disable zoom buttons
source code
 
_on_new_disaster(self, message)
Called when a building is 'infected' with a disaster.
source code
 
_on_new_settlement(self, message) source code
 
_on_player_level_upgrade(self, message)
Called when a player's population reaches a new level.
source code
 
_on_mine_empty(self, message) source code
 
_on_gui_click_action(self, msg)
Make a sound when a button is clicked
source code
 
_on_gui_cancel_action(self, msg)
Make a sound when a cancelButton is clicked
source code
 
_on_gui_hover_action(self, msg)
Make a sound when the mouse hovers over a button
source code
 
_replace_hotkeys_in_widgets(self)
Replaces the `{key}` in the (translated) widget helptext with the actual hotkey
source code
 
_on_language_changed(self, msg)
Replace the hotkeys after translation.
source code
Class Variables [hide private]
  message_widget = livingProperty()
  minimap = livingProperty()
  keylistener = livingProperty()
Method Details [hide private]

__init__(self, session)
(Constructor)

source code 
Parameters:
  • session (horizons.session.Session) - instance of session the world belongs to.

end(self)

source code 

Put all the code the object needs to end safely here. Make sure it always contains the super(YOUROBJECT, self).end() call, to ensure all parentobjects are deinited correctly.

Overrides: util.living.LivingObject.end
(inherited documentation)

show_build_menu(self, update=False)

source code 
Parameters:
  • update - set when build possibilities change (e.g. after inhabitant tier upgrade)

_build(self, building_id, unit=None)

source code 

Calls the games buildingtool class for the building_id.

Parameters:
  • building_id - int with the building id that is to be built.
  • unit - weakref to the unit, that builds (e.g. ship for warehouse)

show_menu(self, menu)

source code 

Shows a menu

Parameters:
  • menu - str with the guiname or pychan object.

on_key_press(self, action, evt)

source code 

Handle a key press in-game.

Returns True if the key was acted upon.

handle_selection_group(self, num, ctrl_pressed)

source code 

Select existing or assign new unit selection group.

Ctrl+number creates or overwrites the group of number `num` with the currently selected units. Pressing the associated key selects a group and centers the camera around these units.

set_cursor(self, which='default', *args, **kwargs)

source code 

Sets the mousetool (i.e. cursor). This is done here for encapsulation and control over destructors. Further arguments are passed to the mouse tool constructor.

_on_language_changed(self, msg)

source code 

Replace the hotkeys after translation.

NOTE: This should be called _after_ the texts are replaced. This currently relies on import order with `horizons.gui`.