ae.lisz_app_data

Lisz Demo App

This module provides common constants, functions and methods for the showcase/demo application Lisz, which is demonstrating the usage of the GUI framework packages provided by the ae namespace.

usage demonstration of ae namespace portions

The usage of the following ae namespace portions get demonstrated by this application:

  • ae.base: basic constants and helper functions

  • ae.files: file collection, grouping and caching

  • ae.deep: deep data structure search and replace

  • ae.i18n: internationalization / Localization helpers

  • ae.paths: generic file path helpers

  • ae.inspector: inspection and debugging helper functions

  • ae.updater: application environment updater

  • ae.core: application core constants, helper functions and base classes

  • ae.literal: literal type detection and evaluation

  • ae.console: console application environment

  • ae.parse_date: parse date strings more flexible and less strict

  • ae.gui_app: base class for python applications with a graphical user interface

  • ae.gui_help: main app base class with context help for flow and app state changes

Hint

The Kivy variant of this demo app uses additionally the following ae namespace portions: ae.kivy_auto_width, ae.kivy_dyn_chi, ae.kivy_help, ae.kivy_relief_canvas, ae.kivy_app and ae.kivy_user_prefs.

features of the Lisz demo app

  • internationalization of texts, user messages, help texts, button/label texts (ae.i18n)

  • easy mapping of files in complex folder structures (ae.files, ae.paths)

  • providing help screens (ae.gui_help, ae.kivy_help)

  • colors changeable by user (ae.kivy_user_prefs, ae.enaml_app)

  • font and button sizes are changeable by user (ae.gui_app)

  • dark and light theme switchable by user

  • sound output support with sound volume configurable by user

  • recursive item data tree manipulation: add, edit and delete item

  • each item can be selected/check marked

  • filtering of selected/checked and unselected/unchecked items

  • an item represents either a sub-node (sub-list) or a leaf of the data tree

  • item order changeable via drag & drop

  • item can be moved to the parent or a sub-node

  • easy navigation within the item tree (up/down navigation in tree and quick jump)

lisz application data model

The Lisz demo app is managing a recursive item tree - a list of lists - that can be used e.g. as to-do or shopping list.

To keep this demo app simple, the data managed by the Lisz application is a minimalistic tree structure that gets stored as an application status, without the need of any database. The root node and with that the whole recursive data structure gets stored in the app state variable root_node.

The root of the tree structure is a list of the type LiszNode containing list items of type LiszItem. A LiszItem element represents a dict of the type Dict[str, Any].

Each LiszItem element of the tree structure is either a leaf or a node. And each node is a sub-list with a recursive structure identical to the root node and of the type LiszNode.

The following graph is showing an example data tree:

digraph {
    node [shape=record, width=3]
    rec1 [label="{<rec1>Root Node | { <A>Item A | <C>Item C | <D>... } }"]
    "root_node app state variable" -> rec1 [arrowhead=crow style=tapered penwidth=3]
    rec1:A -> "Leaf Item A" [minlen=3]
    rec2 [label="{<rec2>Node Item C (sub-node) | { <CA>Item CA | <CB>Item CB | <CN>... } }"]
    rec1:C -> rec2
    rec2:CA -> "Leaf Item CA" [minlen=2]
    rec3 [label="{<rec3>Node Item CB (sub-sub-node) | { <CBA>Item CBA | <CDn>... } }"]
    rec2:CB -> rec3
    rec3:CBA -> "Leaf Item CBA"
}

The above example tree structure is containing the root node items A (which is a leaf) and C (which is a sub-node).

The node C consists of the items CA and CB where CA is a leaf and CB is a node.

Finally the first item of the node CB is another sub-node with the leaf item CBA.

GUI framework demo implementations

The plan is to integrate the following GUI frameworks on top of the abstract base class (implemented in the ae.gui_app portion of the ae namespace):

The main app base mixin class LiszDataMixin provided by this module is used to manage the common data structures, functions and methods for the various demo applications variants based on ae.gui_app and the related GUI framework implementation portions (like e.g. ae.kivy_app and ae.enaml_app) of the ae namespace.

gui framework implementation variants

kivy

The kivy lisz app is based on the kivy framework, a pypi package documented here.

root list of a dark themed kivy lisz app

Fig. 9 kivy lisz app root list

fruits sub-list of a dark themed kivy lisz app

Fig. 10 fruits sub-list

fruits sub-list of a light themed kivy lisz app

Fig. 11 using light theme

user preferences drop down

Fig. 12 lisz user preferences

kivy lisz color editor

Fig. 13 kivy lisz color editor

lisz app using bigger font size

Fig. 14 bigger font size

kivy wish list

  • kv language looper pseudo widget (like enaml is providing) to easily generate sets of similar widgets.

enaml

The enaml lisz demo app is based on the enaml framework, a pypi package documented here at ReadTheDocs.

fruits sub-list of dark themed enaml lisz app

Fig. 15 enaml/qt lisz app

fruits sub-list of a light themed enaml lisz app in landscape

Fig. 16 light themed in landscape

automatic update of widget attributes

Dependencies have to be executed/read_from, so e.g. the icon attribute will not be updated if app.app_state_light_theme gets changed:

icon << main_app.cached_icon('font_size') or app.app_state_light_theme

In contrary the icon will be updated by the following two statements:

icon << main_app.cached_icon('font_size') if app.app_state_light_theme else main_app.cached_icon('font_size')
icon << app.app_state_light_theme == None or main_app.cached_icon('font_size')

KeyEvent implementation based on this SO answer posted by the enamlx author frmdstryr/Jairus Martin: https://stackoverflow.com/questions/20380940/how-to-get-key-events-when-using-enaml. Alternative and more complete implementation can be found in the enamlx package (https://github.com/frmdstryr/enamlx).

enaml wish list

  • type and syntax checking, code highlighting and debugging of enaml files within PyCharm.

  • fix freezing of linux/Ubuntu system in debugging of opening/opened PopupViews in PyCharm.

Module Attributes

FLOW_PATH_ROOT_ID

pseudo item id needed for flow path jumper and for drop onto leave item button

FLOW_PATH_TEXT_SEP

flow path separator for flow_path_text()

FOCUS_FLOW_PREFIX

prefix shown in front of flow key of focused item

INVALID_ITEM_ID_PREFIX_CHARS

invalid initial chars in item id (to detect id | literal in flow key)

NODE_FILE_PREFIX

file name prefix for node imports/exports

NODE_FILE_EXT

file extension for node imports/exports

IMPORT_NODE_MAX_FILE_LEN

maximum file length of importable <file.NODE_FILE_EXT> file

IMPORT_NODE_MAX_ITEMS

maximum number of items to import or paste from clipboard

Functions

check_item_id(item_id)

check if the passed item id string is valid.

correct_item_id(item_id)

strip and replace extra/invalid characters from the passed item id string.

flow_path_items_from_text(text)

parse and interpret text block for (optional) flow path text and node data (in pprint.pformat/repr format).

item_sel_filter(item)

callable to filter selected LiszItems.

item_unsel_filter(item)

callable to filter unselected LiszItems.

Classes

LiszDataMixin()

lisz data model - independent from used GUI framework.

FLOW_PATH_ROOT_ID = '^^^^'

pseudo item id needed for flow path jumper and for drop onto leave item button

FLOW_PATH_TEXT_SEP = ' / '

flow path separator for flow_path_text()

FOCUS_FLOW_PREFIX = '->'

prefix shown in front of flow key of focused item

INVALID_ITEM_ID_PREFIX_CHARS = '[{'

invalid initial chars in item id (to detect id | literal in flow key)

NODE_FILE_PREFIX = 'node_'

file name prefix for node imports/exports

NODE_FILE_EXT = '.txt'

file extension for node imports/exports

IMPORT_NODE_MAX_FILE_LEN = 8192

maximum file length of importable <file.NODE_FILE_EXT> file

IMPORT_NODE_MAX_ITEMS = 12

maximum number of items to import or paste from clipboard

LiszItem

node item data (nid) type

alias of Dict[str, Any]

LiszNode

node/list type

alias of List[Dict[str, Any]]

NodeFileInfo

tuple of (node-parent-name, node-list, file_path, error-message)

alias of Tuple[str, List[Dict[str, Any]], str, str]

NodeFilesInfo

list of node file info tuples

alias of List[Tuple[str, List[Dict[str, Any]], str, str]]

check_item_id(item_id)[source]

check if the passed item id string is valid.

Parameters

item_id (str) – item id to check.

Return type

str

Returns

“” if all chars in the passed item id are valid, else one of the translated message strings.

correct_item_id(item_id)[source]

strip and replace extra/invalid characters from the passed item id string.

Parameters

item_id (str) – item id string to correct.

Return type

str

Returns

corrected item id (can result in an empty string).

flow_path_items_from_text(text)[source]

parse and interpret text block for (optional) flow path text and node data (in pprint.pformat/repr format).

Parameters

text (str) –

text block to be parsed. The text block can optionally be prefixed with a extra line (separated by a new line ‘n’ character) containing the destination flow path in text format (using FLOW_PATH_TEXT_SEP to separate the flow path items).

The (rest of the) text block represents the node/item data in one of the following formats:

  • single text line (interpreted as single leaf item).

  • multiple text lines (interpreted as multiple leaf items).

  • dict repr string (starting with ‘{‘ character).

  • list repr string (starting with ‘[‘ character).

Return type

Tuple[str, str, List[Dict[str, Any]]]

Returns

tuple of error message (empty string if no error occurred), flow path (empty string if root or not given) and node list.

item_sel_filter(item)[source]

callable to filter selected LiszItems.

Parameters

item (Dict[str, Any]) – item data structure to check.

Return type

bool

Returns

True if item is a selected leaf or if item is a node with only selected sub-leaves, else False.

item_unsel_filter(item)[source]

callable to filter unselected LiszItems.

Parameters

item (Dict[str, Any]) – item data structure to check.

Return type

bool

Returns

True if item is an unselected leaf or if item is a node with only unselected leaves, else False.

class LiszDataMixin[source]

Bases: object

lisz data model - independent from used GUI framework.

root_node: List[Dict[str, Any]] = []

root of lisz data structure

current_node_items: List[Dict[str, Any]]

node item data of the current node / sub list (stored as app state via root_node)

filtered_indexes: List[int]

indexes of the filtered/displayed items in the current node

filter_selected: bool = False

True to hide/filter selected node items

filter_unselected: bool = False

True to hide/filter unselected node items

debug_level: int

debug_level

flow_id: str

current attr:flow id <ae.gui_app.MainAppBase.flow_id>

flow_path: List[str]

flow path ref. current node

_refreshing_data: bool = False

DEBUG True while running refresh_all() method

call_method: Callable
call_method_delayed: Callable
change_app_state: Callable
change_flow: Callable
flow_path_action: Callable
play_sound: Callable
refresh_node_widgets: Callable
add_item(nid, node_to_add_to=None, new_item_index=0)[source]

add item (leaf or node) to currently displayed node.

Parameters
  • nid (Dict[str, Any]) – LiszItem to add (has to have a non-empty item id).

  • node_to_add_to (Optional[List[Dict[str, Any]]]) – node where the passed item will be added to (def=current node).

  • new_item_index (int) – index where the new item will be inserted (default=0, ignored if item already exists).

Return type

str

Returns

error message if any error happened, else empty string.

add_items(items, node_to_add_to=None)[source]

add item to currently displayed node.

Parameters
  • items (List[Dict[str, Any]]) – LiszNode list to add (each item has to have a non-empty item id).

  • node_to_add_to (Optional[List[Dict[str, Any]]]) – node where the passed item will be added to (def=current node).

Return type

str

Returns

error message if any error happened (multiple error messages are separated by \n), else empty string.

change_sub_node_sel(node, set_sel_to)[source]

change the selection of all the sub-leaves of the passed node to the specified value.

Parameters
  • node (List[Dict[str, Any]]) – node of which to change the selection of the sub-item leaves.

  • set_sel_to (bool) – True will only toggle the unselected sub-item leaves, False only the selected ones.

current_item_or_node_literal()[source]

return the currently focused/displayed item or node as repr string.

Return type

str

Returns

pformat repr string of the currently focused item id/node or of the displayed node.

delete_items(*item_ids, parent_node=None, node_only=False)[source]

delete either complete items or sub node of the items (identified by the passed item ids).

Parameters
  • item_ids (str) – tuple of item ids to identify the items/sub-nodes to be deleted.

  • parent_node (Optional[List[Dict[str, Any]]]) – node from where the item has to be removed from (default=current node).

  • node_only (bool) – True if only delete the sub-node of the identified item, False to delete the item.

Return type

List[Dict[str, Any]]

edit_validate(old_item_index, new_id=None, want_node=None, parent_node=None, new_item_index=0)[source]

validate the user changes after adding a new item or editing an existing item.

Parameters
  • old_item_index (int) – index in the current node of the edited item or -1 if a new item (to be added).

  • new_id (Optional[str]) – new/edited id string.

  • want_node (Optional[bool]) – True if the new/edited item will have a sub-node, False if not.

  • parent_node (Optional[List[Dict[str, Any]]]) – node where the edited/added item as to be updated/inserted (default=current list).

  • new_item_index (int) – index where the new item have to be inserted (default=0, ignored in edit item mode).

Return type

str

Returns

empty string on successful edit validation or on cancellation of new item (with empty id string), else error string or ‘request_delete_confirmation_for_item’ if the user has to confirm the deletion after the user wiped the item id string or ‘request_delete_confirmation_for_node’ if the user has to confirm the removal of the sub-node.

export_node(flow_path, file_path='.', node=None)[source]

export node specified by the passed flow_path argument.

Parameters
  • flow_path (List[str]) – flow path of the node to export.

  • file_path (str) – folder to store the node data into (def=current working directory).

  • node (Optional[List[Dict[str, Any]]]) – explicit/filtered node items (if not passed then all items will be exported).

Return type

str

Returns

empty string if node got exported without errors, else the error message/raised exception.

find_item_index(item_id, searched_node=None)[source]

determine list index of the passed item id in the searched node or in the current node.

Parameters
  • item_id (str) – item id to find.

  • searched_node (Optional[List[Dict[str, Any]]]) – searched node. if not passed then the current node will be searched instead.

Return type

int

Returns

item list index in the searched node or -1 if item id was not found.

flow_key_text(flow_id, landscape)[source]

determine shortest possible text fragment of the passed flow key that is unique in the current node.

Used to display unique part of the key of the focused item/node.

Parameters
  • flow_id (str) – flow id to get key to check from (pass the observed value to update GUI automatically, either self.app_state_flow_id or self.app_states[‘flow_id’]).

  • landscape (bool) – True if window has landscape shape (resulting in larger abbreviation). Pass the observed attribute, mostly situated in the framework_win (e.g. self.framework_win.landscape).

Return type

str

Returns

display text containing flow key.

flow_path_from_text(text, skip_check=False)[source]

restore the full complete flow path from the shortened flow keys generated by flow_path_text().

Parameters
  • text (str) – flow path text - like returned by flow_path_text().

  • skip_check (bool) – pass True to skip the check if the flow path exists in the current self.root_node.

Return type

List[str]

Returns

flow path list.

flow_path_node(flow_path=None, create=False)[source]

determine the node specified by the passed flow path, optionally create missing nodes of the flow path.

Parameters
  • flow_path (Optional[List[str]]) – flow path list.

  • create (bool) – pass True to create missing nodes. Only on False this method will return empty list on invalid/broken flow_path.

Return type

List[Dict[str, Any]]

Returns

node list at flow_path (if found -or- created is True and no-creation-errors) or empty list (if flow_path not found and created is False or on creation error).

flow_path_quick_jump_nodes()[source]

determine the current flow paths of all nodes excluding the current, to quick-jump from current node.

Return type

List[str]

Returns

list of flow path texts of all nodes apart from the current one.

flow_path_text(flow_path, min_len=3, display_root=False, separator=' / ')[source]

generate shortened display text from the passed flow path.

Parameters
  • flow_path (List[str]) – flow path list.

  • min_len (int) – minimum length of node ids (flow id keys). Pass zero value to not shorten ids.

  • display_root (bool) – pass True to return FLOW_PATH_ROOT_ID on empty/root path.

  • separator (str) – path item separator (default=FLOW_PATH_TEXT_SEP).

Return type

str

Returns

shortened display text string of the passed flow path (which can be converted back to a flow path list with the method flow_path_from_text()).

focus_neighbour_item(delta)[source]

move flow id to previous/next displayed/filtered node item.

Parameters

delta (int) – moving step (if greater 0 then forward, else backward).

global_variables(**patches)[source]

overridden to add app-specific globals.

Return type

Dict[str, Any]

importable_node_files(folder_path='.')[source]

load and check all nodes found in the documents app folder of this app.

Parameters

folder_path (str) – path to the folder where the node files are situated (def=current working directory).

Return type

List[Tuple[str, List[Dict[str, Any]], str, str]]

Returns

list of node file tuples of (node_name, node, file_path, error-message).

static import_file_info(file_path, node_name='')[source]

load node file and determine node content.

Parameters
  • file_path (str) – path to the node file to import.

  • node_name (str) – optional name/id of the parent node name. If not passed then it will be determined from the file name (removing NODE_FILE_PREFIX and file extension).

Return type

Tuple[str, List[Dict[str, Any]], str, str]

Returns

node file info tuple as: (node name, node-data or empty list, file path, error message).

import_items(node, parent=None, item_index=0)[source]

import passed node items into the passed parent/destination node at the given index.

Parameters
  • node (List[Dict[str, Any]]) – node with items to import/add.

  • parent (Optional[List[Dict[str, Any]]]) – destination node to add the node items to (def=current node list).

  • item_index (int) – list index in the destination node where the items have to be inserted (default=0).

Return type

str

Returns

empty string if all items of node got imported correctly, else error message string.

import_node(node_id, node, parent=None, item_index=0)[source]

import passed node as new node into the passed parent node at the given index.

Parameters
  • node_id (str) – id of the new node to import/add.

  • node (List[Dict[str, Any]]) – node with items to import/add.

  • parent (Optional[List[Dict[str, Any]]]) – destination node to add the new node to (def=current node list).

  • item_index (int) – list index in the parent node where the items have to be inserted (default=0).

Return type

str

Returns

empty string if node got added/imported correctly, else error message string.

item_by_id(item_id, searched_node=None)[source]

search item in either the passed or the current node.

Parameters
  • item_id (str) – item id to find.

  • searched_node (Optional[List[Dict[str, Any]]]) – searched node. if not passed then the current node will be searched instead.

Return type

Dict[str, Any]

Returns

found item or if not found a new dict with the single key=value ‘id’=item_id.

move_item(dragged_node, dragged_id, dropped_path=None, dropped_id='')[source]

move item id from passed dragged_node to the node and index specified by dropped_path and dropped_id.

Parameters
  • dragged_node (List[Dict[str, Any]]) – node where the item got dragged/moved from.

  • dragged_id (str) – id of the dragged/moved item.

  • dropped_path (Optional[List[str]]) – optional destination/drop node path, if not passed use dragged_node.

  • dropped_id (str) – optional destination item where the dragged item will be moved before it. if empty string passed or not passed then the item will be placed at the end of the destination node.

Return type

bool

node_info(node, what=(), recursive=True)[source]

determine statistics info for the node specified by flow_path.

Parameters
  • node (List[Dict[str, Any]]) – node to get info for.

  • what (Tuple[str, …]) –

    pass tuple of statistic info fields to include only these into the returned dict (passing an empty tuple or nothing will include all the following fields):

    • ’count’: number of items (nodes and leaves) in this node (including sub-nodes).

    • ’leaf_count’: number of sub-leaves.

    • ’node_count’: number of sub-nodes.

    • ’selected_leaf_count’: number of selected sub-leaves.

    • ’unselected_leaf_count’: number of unselected sub-leaves.

    • ’names’: list of all sub-item/-node names/ids.

    • ’leaf_names’: list of all sub-leaf names.

    • ’selected_leaf_names’: list of all selected sub-leaf names.

    • ’unselected_leaf_names’: list of all unselected sub-leaf names.

  • recursive (bool) – pass False if only the passed node has to be investigated.

Return type

Dict[str, Union[int, str, List[str]]]

Returns

dict with the node info specified by the what argument.

on_app_state_root_node_save(root_node)[source]

shrink root_node app state variable before it get saved to the config file.

Return type

List[Dict[str, Any]]

on_filter_toggle(toggle_attr, _event_kwargs)[source]

toggle filter on click of either the selected or the unselected filter button.

Note that the inverted filter may be toggled to prevent both filters active.

Parameters
  • toggle_attr (str) – specifying the filter button to toggle, either ‘filter_selected’ or ‘filter_unselected’.

  • _event_kwargs (Dict[str, Any]) – unused.

Return type

bool

Returns

True to process flow id change.

on_item_enter(_key, event_kwargs)[source]

entering sub node from current node.

Parameters
  • _key (str) – flow key (item id).

  • event_kwargs (dict) – event kwargs.

Return type

bool

Returns

True to process/change flow id.

on_item_leave(_key, event_kwargs)[source]

leaving sub node, setting current node to parent node.

Parameters
  • _key (str) – flow key (item id).

  • event_kwargs (dict) – event kwargs.

Return type

bool

Returns

True to process/change flow id.

on_item_sel_toggle(item_id, event_kwargs)[source]

toggle selection of leaf item.

Parameters
  • item_id (str) – item id of the leaf to toggle selection for.

  • event_kwargs (dict) – event kwargs.

Return type

bool

Returns

True to process/change flow id.

on_item_sel_change(item_id, event_kwargs)[source]

toggle, set or reset in the current node the selection of a leaf item or of the sub-leaves of a node item.

Parameters
  • item_id (str) – item id of the leaf/node to toggle selection for.

  • event_kwargs (dict) – event kwargs, containing a set_sel_to key with a boolean value, where True will select and False deselect the item (or the sub-items if the item is a non-empty node).

Return type

bool

Returns

True to process/change flow id.

This flow change event can be used alternatively to on_item_sel_toggle() for more sophisticated Lisz app implementations, like e.g. the kivy lisz demo app .

on_item_sel_confirming(item_id, event_kwargs)

confirming sub-list item de-/selection from ItemSelConfirmPopup

Return type

bool

on_key_press(modifiers, key_code)[source]

check key press event to be handled and processed as command/action.

Parameters
  • modifiers (str) – modifier keys string.

  • key_code (str) – key code string.

Return type

bool

Returns

True if key event got processed/used, else False.

on_node_extract(flow_path_text, event_kwargs)[source]

extract the leaves of the node specified by flow_path_text.

Parameters
  • flow_path_text (str) – flow path text or list literal (identifying the start node to extract from).

  • event_kwargs (dict) –

    extra arguments specifying extract options (only extract_type is mandatory):

    extract_type specifies extract destination and an optional filter on un-/selected items. The first part defines the extract action (copy/cut/delete/export/share) and an optional second part (separated by an underscore) the filter. E.g. the following string values can be passed for a ‘copy’ extract action:

    • ’copy’ is copying all items of the specified node to the clipboard.

    • ’copy_sel’ is copying only the selected items of the node to the clipboard.

    • ’copy_unsel’ is copying only the unselected items to the clipboard.

    recursive specifies if False that the extraction affects only the leaves of the current node specified by flow_path_text and if True the extraction affects also the leaves of the sub-nodes (default=True).

    export_path specifies the destination folder of the export action (default=’.’/CWD).

Return type

bool

Returns

True to process/change flow.

on_node_jump(flow_path_text, event_kwargs)[source]

FlowButton clicked event handler restoring flow path from the flow key.

Used to jump to node specified by the flow path text in the passed flow_id key.

Parameters
  • flow_path_text (str) – flow path text (identifying where to jump to).

  • event_kwargs (Dict[str, Any]) – event arguments (used to reset flow id).

Return type

bool

Returns

True to process/change flow.

refresh_all()[source]

changed flow event handler refreshing currently displayed items after changing current node/flow path.

refresh_current_node_items_from_flow_path()[source]

refresh current node including the depending display node.

shrink_node_size(node, item_filter=None, recursive=True)[source]

shrink node size by removing unneeded items and sel keys, e.g. to export or save space in config file.

Parameters
  • node (List[Dict[str, Any]]) – start or root node to shrink (in-place!).

  • item_filter (Optional[Callable[[Dict[str, Any]], bool]]) – pass callable to remove items from the passed node and its sub-nodes. The callable is getting passed each item as argument and has to return True to remove it from its node.

  • recursive (bool) – pass False if only the passed start node has to be shrunk.

sub_item_ids(node=None, item_ids=(), leaves_only=True, hide_sel_val=None, recursive=True, sub_ids=None)[source]

return item names/ids of the specified items including their sub-node items (if exists and recursive==True).

Used to determine the affected item ids if user want to delete or de-/select the sub-items of the item(s) specified by the passed arguments.

Parameters
  • node (Optional[List[Dict[str, Any]]]) – searched node, if not passed use the current node as default.

  • item_ids (Tuple[str, …]) – optional item id filter, if passed only items with an id in this tuple will be returned. This filter will not be used for sub-node filtering (if recursive==True).

  • leaves_only (bool) – pass False to also include/return node item ids.

  • hide_sel_val (Optional[bool]) – pass False/True to exclude un-/selected leaf items from the returned list of ids. If None or not passed then all found items will be included.

  • recursive (bool) – pass False if only the passed start node has to be investigated/included.

  • sub_ids (Optional[List[str]]) – already found sub item ids (used for the recursive calls of this method).

Return type

List[str]

Returns

list of found item ids.

toggle_item_sel(node_idx)[source]

toggle the item selection of the item identified by the list index in the current node.

Parameters

node_idx (int) – list index of the item in the current node to change the selection for.