Graphics

class base_kivy_app.graphics.AutoSizedSpinner(**kwargs)

Bases: base_kivy_app.graphics.AutoSizedSpinnerBehavior, kivy.uix.spinner.Spinner

class base_kivy_app.graphics.BufferImage(**kwargs)

Bases: kivy.uix.scatter.Scatter

Class that displays an image and allows its manipulation using touch. It receives an ffpyplayer Image object.

available_size

The size that the widget has available for drawing.

color

The color in which to display the image.

image_size

The size of the last image.

img = None

Holds the last Image passed in.

img_texture

The texture into which the images are blitted. Defaults to None.

reload_buffer(*args)

Reloads the last displayed image. It is and should be called whenever the screen size changes or the last image need to be recalculated.

texture_size

A tuple with the size of the last Image that was passed in.

update_img(img, force=False)

Updates the screen with a new image.

Parameters
img: Image instance

The image to be displayed.

class base_kivy_app.graphics.EmptyDropDown(**kwargs)

Bases: kivy.uix.dropdown.DropDown

class base_kivy_app.graphics.EventFocusBehavior(**kwargs)

Bases: kivy.uix.behaviors.focus.FocusBehavior

FocusBehavior based class which converts keyboard events listed in keys into a on_key_press or on_key_release event.

Events
on_key_press:

Triggered when a key that is in keys is pressed.

on_key_release:

Triggered when a key that is in keys is released.

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()

keys

A list of strings that are potential keyboard keys, which trigger key press or key release events.

Defaults to [‘spacebar’, ‘escape’, ‘enter’].

class base_kivy_app.graphics.TimeLine(**kwargs)

Bases: kivy.uix.boxlayout.BoxLayout

A widget that displays an elapsing time line. It has named time slices indicating e.g. timed stages and the time line progresses through them.

Slices are added/removed with add_slice(), remove_slice(), and clear_slices(). smear_slices() is used to smear the width of the slices so that they are non-linearly proportional to the provided duration of each slice.

To move from one slice to another, set_active_slice() must be called. It sets all the previous slices preceding this slice as done. Slices do not automatically finish, without this method being called.

Properties of

add_slice(name, before=None, duration=0, size_hint_x=None, **kwargs)

Adds a new slice to the timeline.

Parameters
name: str

The unique name of the new slice to create.

before: str

If not None, the name of the slice before which to create the new slice. Otherwise, the default, it’s added at the end.

duration: float, int

The estimated duration of the slice. Defaults to 0. A slice of duration 0 is allowed.

size_hint_x: float

The width size_hint of the slice display. If None, the default, the duration is used as the size hint, otherwise the provided value is used. Since Kivy normalizes the size hints to 1.0, by default the duration is used to scale the displayed width of the slices to their durations.

clear_slices()

Removes all the slices and clears the time line.

color_even

A list of size 2 indicating the color to use when the slice is not yet done and when it’s done for even slices, respectively. Each item is a 4 tuple indicating the rgba value (0-1) to use.

color_odd

A list of size 2 indicating the color to use when the slice is not yet done and when it’s done for odd slices, respectively. Each item is a 4 tuple indicating the rgba value (0-1) to use.

current_slice

The index in slices that is the current slice.

remove_slice(name)

Removes the named slice.

Parameters
name: str

The name of the slice to remove.

set_active_slice(name, after=None)

Sets the slice that is the active slice. All the slices preceding this slice will be marked as done and the timer will restart.

Parameters
name: str

The name of the slice to set as the current slice. It can be the name of a non-existing slice.

after: str

If name is a non-existing slice, if after is None, then all the slices preceding, and including the current slice will be marked as done. Otherwise, all the slices preceding and including the named slice will be marked as done.

slice_names

The given name corresponding to the slices in slices. They should be unique.

slices

The list of TimeLineSlice visualizing all the slices.

smear_slices(exponent=3)

Smears the width of the slices in a non-linear manner so that the width of each slice become less exactly related to the duration of the slice. It is useful to prevent some slices being huge and other tiny.

Overall, the algorithm normalizes exponentiated durations to their mean exponentiated value.

Parameters
exponent: float, int

The exponent to use when smearing the slices. Defaults to 3.

text

The name of the current slice displayed in the status field.

timer

A string version of the amount of time elapsed within the current slice. It gets reset when set_active_slice() is called.

update_slice_attrs(current_name, **kwargs)

Called to update the attributes of the TimeLineSlice instance associated with the name such as TimeLineSlice.duration etc. Can be used to even rename the slice.

Parameters
name: str

The name of the slice to update.

**kwargs: keyword args

The names and values of the slice to change.

class base_kivy_app.graphics.TimeLineSlice(**kwargs)

Bases: kivy.uix.widget.Widget

A representation of a time slice of TimeLine.

color

If not None, it’s a list of size 2 indicating the color to use for when the slice is not yet done and when it’s done, respectively. When not None, it overwrites the values provided with TimeLine.color_odd and ::attr.color_even.

duration

The duration of the slice.

elapsed_t

The amount of time that has elapsed since the start of this slice. Can be larger than duration, but visually it gets clipped to duration.

name

The name of the slice.

text

If not empty, rather than displaying name when this slice is active, it’ll display this text.