Graphics

Collection of widgets used by the Ceed GUI.

class ceed.graphics.ShowMoreSelection

Bases: object

This class is meant to be co-inherited from with a kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior.

When a right or left keyboard key is pressed while a child of the resulting widget is selected (i.e. a node is selected) this class sets the exapnd_prop property of the selected widget to True or False for right and left respectively.

exapnd_prop

The name of the property of the selected widget that will be set to True or False. See class description.

class ceed.graphics.ShowMoreBehavior(**kwargs)

Bases: object

Behavior that displays or hides the more widget when show_more is set to True or False respectively.

show_more

Whether the more widget is displayed as a child of this instance or removed.

more

The widget to display as a child of the instance when show_more is True.

class ceed.graphics.TouchSelectBehavior

Bases: object

Behavior meant to be used as the child of a kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior and adds touch selection to the child.

Specifically, when the child is touched this will select/de-select this instance using the controller.

controller

The kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior instance through which this instance is selected.

use_parent

Whether the parent of this widget should be selected upon touch (True) or whether the widget in selectee should be selected (False) upon the touch.

selectee

When use_parent is False, the widget stored in selectee is selected rather than the parent of this widget.

class ceed.graphics.BoxSelector(**kwargs)

Bases: ceed.graphics.TouchSelectBehavior, kivy.uix.boxlayout.BoxLayout

Combines the touch selection with a box layout.

class ceed.graphics.WidgetList(**kwargs)

Bases: kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior, kivy.uix.behaviors.focus.FocusBehavior

A kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior based class with some convenience methods.

Mainly, when a keyboard key is typed it’ll try to select the widget whose text property called child_name_attr_name starts with that string.

child_name_attr_name = 'name'

The propery name to use when sorting or searching for text associated with the widgets to be selected. This is the property used to jump to a widget when its “name” is typed.

keyboard_on_key_down(window, keycode, text, modifiers)

The method bound to the keyboard when the instance has focus.

When the instance becomes focused, this method is bound to the keyboard and will be called for every input press. The parameters are the same as kivy.core.window.WindowBase.on_key_down().

When overwriting the method in the derived widget, super should be called to enable tab cycling. If the derived widget wishes to use tab for its own purposes, it can call super after it has processed the character (if it does not wish to consume the tab).

Similar to other keyboard functions, it should return True if the key was consumed.

keyboard_on_key_up(window, keycode)

The method bound to the keyboard when the instance has focus.

When the instance becomes focused, this method is bound to the keyboard and will be called for every input release. The parameters are the same as kivy.core.window.WindowBase.on_key_up().

When overwriting the method in the derived widget, super should be called to enable de-focusing on escape. If the derived widget wishes to use escape for its own purposes, it can call super after it has processed the character (if it does not wish to consume the escape).

See keyboard_on_key_down()

select_node(node)

Selects a node.

It is called by the controller when it selects a node and can be called from the outside to select a node directly. The derived widget should overwrite this method and change the node state to selected when called.

Parameters
node

The node to be selected.

Returns

bool, True if the node was selected, False otherwise.

Warning

This method must be called by the derived widget using super if it is overwritten.

deselect_node(node)

Deselects a possibly selected node.

It is called by the controller when it deselects a node and can also be called from the outside to deselect a node directly. The derived widget should overwrite this method and change the node to its unselected state when this is called

Parameters
node

The node to be deselected.

Warning

This method must be called by the derived widget using super if it is overwritten.

goto_node(key, last_node, last_node_idx)

(internal) Used by the controller to get the node at the position indicated by key. The key can be keyboard inputs, e.g. pageup, or scroll inputs from the mouse scroll wheel, e.g. scrollup. ‘last_node’ is the last node selected and is used to find the resulting node. For example, if the key is up, the returned node is one node up from the last node.

It can be overwritten by the derived widget.

Parameters
key

str, the string used to find the desired node. It can be any of the keyboard keys, as well as the mouse scrollup, scrolldown, scrollright, and scrollleft strings. If letters are typed in quick succession, the letters will be combined before it’s passed in as key and can be used to find nodes that have an associated string that starts with those letters.

last_node

The last node that was selected.

last_node_idx

The cached index of the last node selected in the get_selectable_nodes() list. If the list hasn’t changed it saves having to look up the index of last_node in that list.

Returns

tuple, the node targeted by key and its index in the get_selectable_nodes() list. Returning (last_node, last_node_idx) indicates a node wasn’t found.

class ceed.graphics.CeedDragNDrop(**kwargs)

Bases: kivy_garden.drag_n_drop.DraggableController

Ceed drag and drop controller.

class ceed.graphics.CeedDraggableObjectBehavior

Bases: kivy_garden.drag_n_drop.DraggableObjectBehavior

Adds the on_drag_init event, which is dispatched when initiate_drag is called.

drag_copy

Whether when the drag started the function was copied or was removed from its parent and should be moved.

obj_dragged

The higher level object associated with the drag.

initiate_drag()

Called by the DraggableController, when a drag is initiated on the widget (i.e. thw widget is actually being dragged once it exceeds the minimum drag distance).