source | issues

pygtkhelpers.delegates

Delegates, which combine some UI, some signals, some signal handlers, and some properties,

copyright:2009-2010 by pygtkhelpers Authors
license:LGPL2 or later
class pygtkhelpers.delegates.BaseDelegate

Base delegate functionality.

This is abstract.

It uses hand-created, and gtk.Builder created ui’s, and combinations of the two, and is responsible for automatically loading ui files from resources, and connecting signals.

Additionally, it is a gobject.GObject subclass, and so can be used with the gsignal, and gproperty functions from pygtkhelpers.utils in order to add property and signal functionality.

The abstract elements of this class are:

  1. The way it gets a toplevel widget from a ui file
  2. How it creates a default toplevel widget if one was not found in the ui file, or no ui file is specified.
add_slave(slave, container_name)

Add a slave delegate

create_ui()

Create any UI by hand.

Override to create additional UI here.

This can contain any instance initialization, so for example mutation of the gtk.Builder generated UI, or creating the UI in its entirety.

get_builder_toplevel(builder)

Get the toplevel widget from a gtk.Builder file.

hide()

Call hide on the toplevel widget

hide_and_quit()

Hide the widget and quit the main loop

model_set()

This method is called when the model is changed

show()

Call show_all on the toplevel widget

show_and_run()

Show the main widget and run the gtk loop

class pygtkhelpers.delegates.SlaveView

A View that is a slave

get_builder_toplevel(builder)

Get the toplevel widget from a gtk.Builder file.

The slave view implementation first searches for the widget named as self.toplevel_name (which defaults to “main”. If this is missing, the first toplevel widget is discovered in the Builder file, and it’s immediate child is used as the toplevel widget for the delegate.

show_and_run()

Show the main widget in a window and run the gtk loop

class pygtkhelpers.delegates.ToplevelView

A View that is a toplevel widget

get_builder_toplevel(builder)

Get the toplevel widget from a gtk.Builder file.

The main view implementation first searches for the widget named as self.toplevel_name (which defaults to “main”. If this is missing, or not a gtk.Window, the first toplevel window found in the gtk.Builder is used.

class pygtkhelpers.delegates.WindowView

A View that is a Window

pygtkhelpers.delegates.get_first_builder_window(builder)

Get the first toplevel widget in a gtk.Builder hierarchy.

This is mostly used for guessing purposes, and an explicit naming is always going to be a better situation.