Main Menu¶
Implements MainMenu.
-
class
acg.custom_widgets.main_menu.CheckBehavior(**kwargs)[source]¶ Bases:
acg.custom_widgets.behaviors.MultiStateBehaviorTwo-State-Behavior with states
TrueandFalse.
-
class
acg.custom_widgets.main_menu.ChildrenFromDataBehavior(**kwargs)[source]¶ Generates widgets dynamically from
dataand adds them toroot_for_children.Bindings can be applied and other functions executed by the definition of
before_add_child()andafter_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: DictPropertyof the form {“on_event”
-
child_class_name¶ StringPropertyclass name for children. Needs to be available viaget().
-
data¶ ListPropertycontaining the dictionaries from which the child-widgets are constructed.
-
get_child(self, name)¶ Return child with name
name.
-
remove_child(self)¶ Remove one child-widget.
-
root_for_children¶ ObjectPropertythe 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.OneLineIconListItemList 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.MDListList containing
DrawerItem.It has one active element at all times whose screen_name attribute is saved in
current.-
current[source]¶ StringPropertyof currently activeDrawerItem.screen_name.
-
-
class
acg.custom_widgets.main_menu.KvScreen(**kwargs)[source]¶ Bases:
kivy.uix.screenmanager.ScreenScreen that automatically adds content of kv-file at
pathas child.If
pathdoes not exist, create file.-
kv_path[source]¶ StringPropertydefaults to"screen_default.kv"
-
-
class
acg.custom_widgets.main_menu.MainMenu(**kwargs)[source]¶ Bases:
kivy.uix.stacklayout.StackLayoutContains everything related to the NavigationDrawer and the Screens.
-
get_item_text(self, screen)[source]¶ Get the text of the
DrawerItemcorresponding to a screen.
-
static
get_right_action_items(screen)[source]¶ Return
right_action_itemsattribute ofscreens root widget if present. Else return empty list.
-
on_parent(self, *_)[source]¶ Set up screen using
nameandpathfromscreen_dicts.The screens are added to the screen_man and corresponding entries to the drawer_list. Then
DrawerList.currentis bound to screen_man.current and vice-versa.
-
screen_dicts[source]¶ ListPropertycontaining the dictionaries describing all screens.
-