Module qlibs.gui.widgets.behaviors¶
- class qlibs.gui.widgets.behaviors.ButtonB(name: str, callback, text=None)¶
Basic button. Callback will be called with button’s name as parameter. text is displayed text
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- type = 'button'¶
- class qlibs.gui.widgets.behaviors.CentererB(sep_x, sep_y, child=None, **kwargs)¶
Makes it’s children smaller by sep_x and sep_y from each side
- property child¶
- recalc_size()¶
- type = 'centerer'¶
- class qlibs.gui.widgets.behaviors.ColumnPlacerB(spacing=0, **kwargs)¶
Places children vertically. See RCPlacerB for more.
- type = 'rcplacer'¶
- class qlibs.gui.widgets.behaviors.CustomRenderB(render, **kwargs)¶
render is a callback. This will be called by rendering, with viewport set to node’s position and size. Recieves this node as an argument.
- type = 'customrender'¶
- class qlibs.gui.widgets.behaviors.DiagramDatum(value: float, tag: Optional[str] = None)¶
- tag: Optional[str] = None¶
- value: float¶
- class qlibs.gui.widgets.behaviors.NodeB(name=None, text=None)¶
Basic node behavior, does not do any anything to position it’s children Rendering is separate from behaviors, which only handles events(including resizing)
- add_child(child: qlibs.gui.widgets.behaviors.NodeB)¶
- get_node_by_name(name: str)¶
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- property position¶
- recalc_size()¶
- selectable = False¶
- property size¶
- property text¶
- type = 'node'¶
- class qlibs.gui.widgets.behaviors.ProgressBarB(name=None, **kwargs)¶
Progress bar. self.fraction is how full it is, with value from 0 to 1 inclusively.
- type = 'progressbar'¶
- class qlibs.gui.widgets.behaviors.QlibsNodeTypes(value)¶
An enumeration.
- BUTTON = 'button'¶
- CENTERER = 'centerer'¶
- COLUMN_DIAGRAM = 'column_diagram'¶
- CUSTOM_RENDER = 'customrender'¶
- NODE = 'node'¶
- PROGRESS_BAR = 'progressbar'¶
- RADIO_BUTTON = 'radiobutton'¶
- RC_PLACER = 'rcplacer'¶
- ROOT = 'root'¶
- SCROLLABLE_LIST = 'scrollable_list'¶
- TEXT = 'text'¶
- TEXT_INPUT = 'textinput'¶
- TOGGLE_BUTTON = 'togglebutton'¶
- WINDOW = 'window'¶
- class qlibs.gui.widgets.behaviors.RCPlacerB(spacing=0, vertical=True, max_size=1, size_hint_func=None, **kwargs)¶
Places it’s children either horizontally or vertically, with size_hint controlling their (relative) size.
- add_child(child, size_hint=None)¶
- recalc_size()¶
- type = 'rcplacer'¶
- class qlibs.gui.widgets.behaviors.RadioButtonB(group: qlibs.gui.widgets.behaviors.RadioButtonGroup, **kwargs)¶
Just like ToggleButtonB, but only one button from the group can be active at once.
- handle_event(event)¶
- type = 'radiobutton'¶
- class qlibs.gui.widgets.behaviors.RadioButtonGroup¶
Group of buttons.
- class qlibs.gui.widgets.behaviors.RootNodeB(**kwargs)¶
- property children¶
- del_node(node)¶
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- property main_node¶
- make_current()¶
- recalc_if_needed()¶
- recalc_size()¶
- request_update_in(dt: float)¶
- set_layer_node(node, layer, priority=0)¶
- type = 'root'¶
- class qlibs.gui.widgets.behaviors.RowPlacerB(spacing=0, **kwargs)¶
Places children horizontally. See RCPlacerB for more.
- type = 'rcplacer'¶
- class qlibs.gui.widgets.behaviors.ScrollBarB(direction='vertical', callback=None, cb=None, **kwargs)¶
ScrollBar. direction can be one of [“vertical”, “horizontal”]. callback is called when updated, with self.pos as an argument. self.pos is a position (ranges from 0 to 1 inclusive).
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- type = 'scrollbar'¶
- class qlibs.gui.widgets.behaviors.ScrollableListB(shown_items=10, target_size=50, **kwargs)¶
List which can be scrolled. If target_size is not None(default), amount of shown items will be adjusted automatically.
- add_child(child)¶
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- recalc_size()¶
- scrollbar_cb(pos)¶
- type = 'scrollable_list'¶
- update_view()¶
- class qlibs.gui.widgets.behaviors.ScrollableStringListB(callback=None, shown_items=10, target_size=50, override_node_type=True, name=None, **kwargs)¶
Scrollable list of strings. Has full_list property which contains used list. Callback should be a function with one argument - index of clicked string. override_node_type changes type of buttons to node, so that they are renderer like usual NodeB. Call
self.update_view()
after changing self.full_list to update. If target_size is not None(default), amount of shown items will be adjusted automatically.- callback_adapter(num)¶
- update_view()¶
- class qlibs.gui.widgets.behaviors.SizeLimitB(targ_x, targ_y, child=None, **kwargs)¶
Limits size of it’s children.
- recalc_size()¶
- type = 'centerer'¶
- class qlibs.gui.widgets.behaviors.TextInputB(text='', name='default', callback=None, **kwargs)¶
Allows to edit it’s text. callback is called on enter and gets current text as an argument.
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- selectable = True¶
- property text¶
- type = 'textinput'¶
- class qlibs.gui.widgets.behaviors.ToggleButtonB(name, callback, text=None, state=False, **kwargs)¶
Just like button, but toggleable. Callback also recieves self.state, which is True is button is active
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- type = 'togglebutton'¶
- class qlibs.gui.widgets.behaviors.WindowNodeB(closeable=False, **kwargs)¶
- close()¶
- property ext_docked¶
- ext_set_focus(focus)¶
- handle_event(event: qlibs.gui.widgets.events.GUIEvent)¶
- recalc_size()¶
- set_child(node)¶
- set_node(node)¶
- type = 'window'¶
- qlibs.gui.widgets.behaviors.hint_func_abs(placer, hints)¶
- qlibs.gui.widgets.behaviors.hint_func_rel(placer, hints)¶