Package horizons :: Package gui :: Package widgets :: Module logbook :: Class LogBook
[hide private]
[frames] | no frames]

Class LogBook

source code

pickbeltwidget.PickBeltWidget --+
                                |
               windows.Window --+
                                |
                               LogBook

Implementation of the logbook as described here: http://wiki.unknown-horizons.org/w/Message_System

It displays longer messages, which are essential for scenarios. Headings can be specified for each entry.

Instance Methods [hide private]
 
__init__(self, session, windows) source code
 
_init_gui(self)
Initial gui setup for all subpages accessible through pickbelts.
source code
 
update_view(self, number=0)
update_view from PickBeltWidget, cleaning up the logbook subwidgets
source code
 
save(self, db) source code
 
load(self, db) source code
 
show(self, msg_id=None)
Show the window.
source code
 
display_messages(self)
Display all messages in self._messages_to_display and map the to the current logbook page
source code
 
hide(self)
Hide the window.
source code
 
is_visible(self) source code
 
_redraw_captainslog(self)
Redraws gui.
source code
 
parse_logbook_item(self, parameter) source code
 
_display_parameters_on_page(self, parameters, page) source code
 
add_captainslog_entry(self, parameters, show_logbook=True)
Adds an entry to the logbook VBoxes consisting of a parameter list.
source code
 
clear(self)
Remove all entries
source code
 
get_cur_entry(self) source code
 
set_cur_entry(self, cur_entry) source code
 
_scroll(self, direction)
Scroll back or forth one message.
source code
 
show_logbookwidget(self)
Shows logbook with Logbook page selected
source code
 
show_statswidget(self, widget='players')
Shows logbook with Statistics page selected
source code
 
toggle_stats_visibility(self, widget='players')
Only hides logbook if hotkey of current stats selection pressed.
source code
 
_show_ships(self) source code
 
_show_settlements(self) source code
 
_show_players(self) source code
 
_hide_statswidgets(self) source code
 
_send_chat_message(self)
Sends a chat message.
source code
 
display_message_history(self) source code
 
_display_chat_history(self) source code
 
_chatfield_onfocus(self)
Removes text in chat input field when it gets focused.
source code
    Inherited from pickbeltwidget.PickBeltWidget
 
get_widget(self) source code
    Inherited from windows.Window
 
_hide_modal_background(self) source code
 
_show_modal_background(self)
Loads transparent background that de facto prohibits access to other gui elements by eating all input events.
source code
 
close(self)
Closes the window.
source code
 
on_escape(self)
Define what happens when ESC is pressed.
source code
 
on_return(self)
Define what happens when RETURN is pressed.
source code
 
open(self, **kwargs)
Open the window.
source code
Class Variables [hide private]
  log = logging.getLogger('gui.widgets.logbook')
  widget_xml = 'captains_log.xml'
  page_pos = 170, 38
  sections = 'logbook', LazyT('Logbook'), ('statistics', LazyT('...
    Inherited from pickbeltwidget.PickBeltWidget
  pickbelt_start_pos = 5, 150
Method Details [hide private]

__init__(self, session, windows)
(Constructor)

source code 
Overrides: windows.Window.__init__

update_view(self, number=0)

source code 

update_view from PickBeltWidget, cleaning up the logbook subwidgets

Overrides: pickbeltwidget.PickBeltWidget.update_view

show(self, msg_id=None)

source code 

Show the window.

After this call, the window should be visible. You should *never* call this directly in your code.

Overrides: windows.Window.show
(inherited documentation)

hide(self)

source code 

Hide the window.

After this call, the window should not be visible anymore. However, it remains in the stack of open windows and will be visible once it becomes the topmost window again.

You should *never* call this directly in your code, other than in `close()` when you overwrote it in your subclass.

Overrides: windows.Window.hide
(inherited documentation)

_redraw_captainslog(self)

source code 

Redraws gui. Necessary when current message has changed.

_display_parameters_on_page(self, parameters, page)

source code 
Parameters:
  • parameters - parameter list, cf. docstring of add_captainslog_entry
  • page - 'left' or 'right'

add_captainslog_entry(self, parameters, show_logbook=True)

source code 

Adds an entry to the logbook VBoxes consisting of a parameter list. Check e.g. content/scenarios/tutorial_en.yaml for real-life usage.

Parameters:
  • parameters - Each item in here is a list like the following: [Label, "Awesome text to be displayed as a label"] "Shortcut notation for a Label" [Headline, "Label to be styled as headline (in small caps)"] [BoldLabel, "Like Label but with bold font, use to highlight lines"] [Image, "content/gui/images/path/to/the/file.png"] [Gallery, ["/path/1.png", "/path/file.png", "/file/3.png"]] [Message, "Text to display as a notification on logbook close"] [Pagebreak]

_scroll(self, direction)

source code 

Scroll back or forth one message.

Parameters:
  • direction - -1 or 1

toggle_stats_visibility(self, widget='players')

source code 

Only hides logbook if hotkey of current stats selection pressed. Otherwise, switch to displaying the new widget instead of hiding.

Parameters:
  • widget - 'players' or 'settlements' or 'ships'

_send_chat_message(self)

source code 

Sends a chat message. Called when user presses enter in the input field


Class Variable Details [hide private]

sections

Value:
'logbook', LazyT('Logbook'), ('statistics', LazyT('Statistics')), ('ch\
at_overview', LazyT('Chat'))