Scroll Widgets

Implements Different classes to display elements in a scroll view.

ScrollList and LeftStatusIndicatorListItem.

class acg.custom_widgets.scroll_widgets.CallbackBehavior[source]

Bases: kivy.event.EventDispatcher

Mixin Class to implement a number of callbacks.

Useful e.g. in combination with RecycleView. There, the content is generated dynamically from a dictionary such that this class can be used to bind multiple callbacks to different events of the widgets.

Warning

Callbacks are not unbound by on_callbacks(). Does this pose a problem?

callback_wrapper(self, callback, *_)

Call callback with first argument as self in new thread.

callbacks

callback_fn}. callback_fn(self) -> Any

Type:DictProperty of the form {“on_event”
on_callbacks(self, *_)

Binds the callbacks to the specified events on definition.

class acg.custom_widgets.scroll_widgets.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.scroll_widgets.LeftStatusIndicator(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.MultiStateBehavior, kivymd.uix.list.ILeftBody, kivy.uix.anchorlayout.AnchorLayout

Contains MDSpinner and MDIcon.

spinner_active[source]

ObjectProperty set to MDSpinner.

class acg.custom_widgets.scroll_widgets.LeftStatusIndicatorListItem[source]

Bases: acg.custom_widgets.behaviors.CallbackBehavior, kivymd.uix.list.OneLineAvatarListItem

Contains LeftStatusIndicator as left element.

Depending on current_state, either the spinner is active or an icon is shown.

current_state[source]

OptionProperty with options ["loading", "queued", "waiting", "ready", "done", "error", "exported"].

class acg.custom_widgets.scroll_widgets.MultiStateBehavior(**kwargs)[source]

Bases: kivy.uix.widget.Widget

Changes properties of widget based on current_state and the corresponding entry in state_dict.

The properties in animated_properties change via animation.

animated_properties

ListProperty containing the list of property-names that get changed via animation.

current_state

Property current state of the widget.

default_state

Property current state of the widget.

state_dicts

DictProperty. E.g.,

state_dicts = {
        state_1 : {"some_property": some_value, ...},
        ...
    }
update_properties(self, *_)

Update properties if they differ from the corresponding entry in current_properties.

class acg.custom_widgets.scroll_widgets.RecycleList(**kwargs)[source]

Bases: kivy.uix.recycleview.RecycleView

RecycleView object containing a RecycleViewBoxLayout.

class acg.custom_widgets.scroll_widgets.RecycleViewBox(**kwargs)[source]

Bases: kivy.uix.recycleview.RecycleView

RecycleView object containing a RecycleViewBoxLayout.

class acg.custom_widgets.scroll_widgets.ScrollBox(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.ChildrenFromDataBehavior, kivy.uix.scrollview.ScrollView

ScrollView containing a BoxLayout.

Children are constructed from child_dict and added to the BoxLayout.

class acg.custom_widgets.scroll_widgets.ScrollGrid(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.ChildrenFromDataBehavior, kivy.uix.scrollview.ScrollView

ScrollView containing a GridLayout.

Children are constructed from child_dict and added to the BoxLayout.

class acg.custom_widgets.scroll_widgets.ScrollList(**kwargs)[source]

Bases: acg.custom_widgets.behaviors.ChildrenFromDataBehavior, kivy.uix.scrollview.ScrollView

Scrollable List whose items are constructed as instances of item_type from item_dicts.

Automatically updates upon change of item_dicts.

data[source]

ListProperty containing the dictionaries from which the items are constructed.

list[source]

ObjectProperty set to MDList. Contains the items.