Main Menu

Implements MainMenu.

class acg.custom_widgets.main_menu.CheckBehavior(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.MultiStateBehavior

Two-State-Behavior with states True and False.

class acg.custom_widgets.main_menu.ChildrenFromDataBehavior(**kwargs)[source]

Generates widgets dynamically from data and adds them to root_for_children.

Bindings can be applied and other functions executed by the definition of before_add_child() and after_add_child().

add_child(self, child_dict=None)

Add one child-widget.

after_add_child(self, child)

Do something after child is added to parent_widget. Placeholder.

before_add_child(self, child)

Do something before child is added to parent_widget. Placeholder.

child_bindings

binding_fn}.

Type:DictProperty of the form {“on_event”
child_class_name

StringProperty class name for children. Needs to be available via get().

data

ListProperty containing the dictionaries from which the child-widgets are constructed.

get_child(self, name)

Return child with name name.

on_data(self, *_)

Update children on change of data.

remove_child(self)

Remove one child-widget.

root_for_children

ObjectProperty the widget, where the children should be added to Defaults to self.

update_num_children(self)

Add/remove children until correct number is reached.

class acg.custom_widgets.main_menu.DrawerItem(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.CheckBehavior, kivymd.uix.list.OneLineIconListItem

List item that changes color based on current_state.

icon[source]

name of icon.

Type:StringProperty
kv_file_name[source]

name of the screens kv-file.

Type:StringProperty
name[source]

name of the screen.

Type:StringProperty
class acg.custom_widgets.main_menu.DrawerList(**kwargs)[source]

Bases: kivymd.theming.ThemableBehavior, acg.custom_widgets.behaviors.ChildrenFromDataBehavior, kivymd.uix.list.MDList

List containing DrawerItem.

It has one active element at all times whose screen_name attribute is saved in current.

current[source]

StringProperty of currently active DrawerItem.screen_name.

on_child_release(self, instance)[source]

Set states of child’s according to check_one.

Gets called if a child dispatches on_release-event.

on_current(self, *_)[source]

Update state of current by calling :meth:´on_child_release´.

class acg.custom_widgets.main_menu.KvScreen(**kwargs)[source]

Bases: kivy.uix.screenmanager.Screen

Screen that automatically adds content of kv-file at path as child.

If path does not exist, create file.

kv_path[source]

StringProperty defaults to "screen_default.kv"

class acg.custom_widgets.main_menu.MainMenu(**kwargs)[source]

Bases: kivy.uix.stacklayout.StackLayout

Contains everything related to the NavigationDrawer and the Screens.

get_item_text(self, screen)[source]

Get the text of the DrawerItem corresponding to a screen.

static get_right_action_items(screen)[source]

Return right_action_items attribute of screens root widget if present. Else return empty list.

get_screen(self, screen_name)[source]

Return screen by name.

get_screen_names(self)[source]

Return screen names.

on_dropdown_item(self, _, item)[source]

Close menu and set app.current_template_name.

on_parent(self, *_)[source]

Set up screen using name and path from screen_dicts.

The screens are added to the screen_man and corresponding entries to the drawer_list. Then DrawerList.current is bound to screen_man.current and vice-versa.

screen_dicts[source]

ListProperty containing the dictionaries describing all screens.

set_screen(self, _=None, screen_name='')[source]

Switch screens dynamically.