sugar4.graphics.window

Window management for Sugar activities.

Provides window classes for managing Sugar activity windows with fullscreen support, toolbar management, and tray integration.

Classes:

UnfullscreenButton: Button to exit fullscreen mode Window: Main activity window container

Classes

UnfullscreenButton

A ready-made "Unfullscreen" button.

Window

A Sugar activity window.

Module Contents

class sugar4.graphics.window.UnfullscreenButton[source]

Bases: gi.repository.Gtk.Window

A ready-made “Unfullscreen” button.

Used by Window to exit fullscreen mode using modern window management.

__gtype_name__ = 'SugarUnfullscreenButton'[source]
connect_button_clicked(callback)[source]

Connect a callback to button click.

class sugar4.graphics.window.Window(**kwargs)[source]

Bases: gi.repository.Gtk.ApplicationWindow

A Sugar activity window.

Used as a container to display things that happen in an activity. A window contains a canvas widget, and may contain toolbar and tray widgets.

The window layout is:
  • toolbar (optional)

  • alerts (as overlays)

  • canvas (main content)

  • tray (optional)

Window supports fullscreen mode where toolbar and tray are hidden.

Key bindings:
  • Escape: exit fullscreen mode

  • Alt+Space: toggle tray visibility

__gtype_name__ = 'SugarWindow'[source]
tray = None[source]
reveal()[source]

Make window active.

Brings the window to the top and makes it active, even after invoking on response to non-GTK events.

is_fullscreen()[source]

Check if the window is fullscreen.

Returns:

window is fullscreen

Return type:

bool

fullscreen()[source]

Make the window fullscreen.

The toolbar and tray will be hidden, and the UnfullscreenButton will be shown for a short time.

unfullscreen()[source]

Restore the window to non-fullscreen mode.

The UnfullscreenButton will be hidden, and the toolbar and tray will be shown.

set_canvas(canvas)[source]

Set canvas widget.

Parameters:

canvas (Gtk.Widget) – the canvas to set

get_canvas()[source]

Get canvas widget.

Returns:

the canvas

Return type:

Gtk.Widget

set_toolbar_box(toolbar_box)[source]

Set toolbar box widget.

Parameters:

toolbar_box (Gtk.Widget) – the toolbar box to set

get_toolbar_box()[source]

Get toolbar box widget.

Returns:

the current toolbar box

Return type:

Gtk.Widget

set_tray(tray, position=Gtk.PositionType.BOTTOM)[source]

Set the tray.

Parameters:
add_alert(alert)[source]

Add an alert to the window as an overlay.

Parameters:

alert (Gtk.Widget) – the alert to add

remove_alert(alert)[source]

Remove an alert from the window.

Parameters:

alert (Gtk.Widget) – the alert to remove

set_enable_fullscreen_mode(enable)[source]

Set enable fullscreen mode.

Parameters:

enable (bool) – enable fullscreen mode

get_enable_fullscreen_mode()[source]

Get enable fullscreen mode.

Returns:

enable fullscreen mode

Return type:

bool

canvas[source]
toolbar_box[source]
enable_fullscreen_mode[source]