sugar4.graphics.toolbox

A toolbox holds a group of toolbars in a list. One toolbar is displayed at a time. Toolbars are assigned an index and can be accessed using this index. Indices are generated in the order the toolbars are added.

Classes

Toolbox

Class to represent the toolbox of an activity. Groups a

Module Contents

class sugar4.graphics.toolbox.Toolbox[source]

Bases: gi.repository.Gtk.Box

Class to represent the toolbox of an activity. Groups a number of toolbars vertically, which can be accessed using their indices. The current toolbar is the only one displayed.

Emits current-toolbar-changed signal when the current toolbar is changed. This signal takes the current page index as an argument.

__gtype_name__ = 'SugarToolbox'[source]
__gsignals__[source]
add_toolbar(name: str, toolbar: gi.repository.Gtk.Widget)[source]

Adds a toolbar to this toolbox. Toolbar will be added to the end of this toolbox, and its index will be 1 greater than the previously added index (index will be 0 if it is the first toolbar added).

Parameters:
  • name (str) – name of toolbar to be added

  • toolbar (Gtk.Widget) – Widget to be appended to this toolbox

remove_toolbar(index: int)[source]

Removes toolbar at the index specified.

Parameters:

index (int) – index of the toolbar to be removed

set_current_toolbar(index: int)[source]

Sets the current toolbar to that of the index specified and displays it.

Parameters:

index (int) – index of toolbar to be set as current toolbar

get_current_toolbar() int[source]

Returns current toolbar index.

Returns:

Index of current toolbar

Return type:

int

get_toolbar_count() int[source]

Returns the number of toolbars in this toolbox.

Returns:

Number of toolbars

Return type:

int

get_toolbar_at(index: int) gi.repository.Gtk.Widget | None[source]

Get the toolbar widget at the specified index.

Parameters:

index (int) – Index of toolbar to retrieve

Returns:

Toolbar widget or None if index is invalid

Return type:

Gtk.Widget

set_toolbar_label(index: int, label: str)[source]

Set the label text for a toolbar tab.

Parameters:
  • index (int) – Index of toolbar

  • label (str) – New label text

get_toolbar_label(index: int) str | None[source]

Get the label text for a toolbar tab.

Parameters:

index (int) – Index of toolbar

Returns:

Label text or None if index is invalid

Return type:

str

current_toolbar[source]