xoinvader.gui

Graphical user interface widgets.

class xoinvader.gui.Bar(pos, prefix='', postfix='', left='[', right=']', marker='█', marker_style=None, empty='-', empty_style=None, count=10, maxval=100, general_style=None, stylemap=None, callback=None)[source]

Progress bar widget.

Parameters:
  • pos (xoinvader.utils.Point) – Bar’s global position
  • prefix (string) – text before the bar
  • postfix (string) – text after the bar
  • left (string) – left edge of the bar
  • right (string) – right edge of the bar
  • marker (string) – symbol that fills the bar
  • marker_style (integer(curses style)) – curses style for marker (passes to render)
  • empty (string) – symbols that fills empty bar space (without marker)
  • empty_style – curses style for empty marker (passes to render)
  • count (integer) – number of markers in the bar
  • maxval (integer) – max value of displayed parameter (affects the accuracy)
  • general_style (integer(curses style)) – style of other characters(prefix, postfix, etc)
  • stylemap (dict(function, integer(curses style)) – mapping of compare functions and integers to curses style
  • callback (function) – calls if not None to get new percentage value
get_render_data()[source]
render_priority = 1
update(val=None)[source]

Update bar if there’s need for it.

class xoinvader.gui.MenuItemWidget(pos, text, template=('* ', ' *'), style=None)[source]

Selectable menu item widget.

Parameters:
  • pos (xoinvader.utils.Point) – widget’s global position
  • text (string) – contained text
  • template (tuple of two strings) – left and right markers

Note

add [ [style] ... ] support

Parameters:style (integer(curses style)) – curses style for text
deselect()[source]

Deselect and refresh image.

get_render_data()[source]
render_priority = 1
select()[source]

Select and refresh image.

selected

Shows is item selected or not.

Warning

Complete menu workflow.

Getter:yes
Setter:no
Type:boolean
toggle_select()[source]

Draw or not selector characters.

class xoinvader.gui.PopUpNotificationWidget(pos, text, style=None, timeout=1.0, callback=None)[source]

Widget that allows to show short messages with timeout.

Warning

Experimental stuff. Fix constructor 6/5.

Parameters:
  • pos (xoinvader.utils.Point) – global position
  • text (string) – text for display
  • style (int | [int]) – curses style
  • timeout (float) – timer timeout
  • callback (function) – callback for removal object
update(text=None, style=None)[source]
class xoinvader.gui.TextWidget(pos, text, style=None)[source]

Simple text widget.

Parameters:
  • pos (xoinvader.utils.Point) – widget’s global position
  • text (string) – contained text

Note

add [ [style], ...] support

Parameters:style (integer(curses style)) – curses style for text
get_render_data()[source]
render_priority = 1
update(text=None, style=None)[source]

Obtain (or not) new data and refresh image.

Parameters:
  • text – new text
  • style – new style
Type:

string

Type:

integer(curses style)

class xoinvader.gui.WeaponWidget(pos, get_data)[source]

Widget for displaying weapon information.

Warning

!!! Duplicates TextWidget !!!

Parameters:
get_render_data()[source]

Return render specific data.

render_priority = 1
update()[source]

Obtain new data and refresh image.