source | issues

pygtkhelpers.proxy

Controllers for managing data display widgets.

copyright:2005-2008 by pygtkhelpers Authors
license:LGPL 2 or later (see README/COPYING/LICENSE)

An example session of using a proxy:

>>> import gtk
>>> from pygtkhelpers.proxy import proxy_for
>>> widget = gtk.Entry()
>>> proxy = proxy_for(widget)
>>> proxy
<GtkEntryProxy object at 0x9aea25c (PyGTKHelperGObjectProxy at 0x9e6ec50)>
>>> proxy.update('hello')
>>> proxy.read()
'hello'
>>> def changed(proxy, value):
...     print proxy, 'changed to', value
...
...
>>> proxy.connect('changed', changed)
32L
>>> proxy.update('bye bye')
<GtkEntryProxy object at 0x9aea25c (PyGTKHelperGObjectProxy at 0x9e6ec50)> changed to bye bye
>>> widget.get_text()
'bye bye'
>>> widget.set_text('banana')
<GtkEntryProxy object at 0x9aea25c (PyGTKHelperGObjectProxy at 0x9e6ec50)> changed to banana
>>> proxy.read()
'banana'
class pygtkhelpers.proxy.GObjectProxy(widget)

A proxy for a gtk.Widget

This proxy provides a common api to gtk widgets, so that they can be used without knowing which specific widget they are. All proxy types should extend this class.

read()

Get the widget’s value

update(value)

Update the widget’s value

class pygtkhelpers.proxy.GtkColorButtonProxy(widget)

Proxy for a gtk.ColorButton

class pygtkhelpers.proxy.GtkComboBoxProxy(widget)

Proxy for a gtk.ComboBox.

class pygtkhelpers.proxy.GtkEntryProxy(widget)

Proxy for a gtk.Entry.

class pygtkhelpers.proxy.GtkFileChooserProxy(widget)

Proxy for a gtk.FileChooser.

class pygtkhelpers.proxy.GtkFontButtonProxy(widget)

Proxy for a gtk.FontButton.

class pygtkhelpers.proxy.GtkImageProxy(widget)

Proxy for a gtk.Image.

class pygtkhelpers.proxy.GtkLabelProxy(widget)

Proxy for a gtk.Label.

class pygtkhelpers.proxy.GtkLinkButtonProxy(widget)

Proxy for a gtk.LinkButton.

class pygtkhelpers.proxy.GtkProgressBarProxy(widget)

Proxy for a gtk.ProgressBar.

class pygtkhelpers.proxy.GtkRangeProxy(widget)

Base class for widgets employing a gtk.Range.

class pygtkhelpers.proxy.GtkTextViewProxy(widget)

Proxy for a gtk.TextView.

class pygtkhelpers.proxy.GtkToggleButtonProxy(widget)

Proxy for a gtk.ToggleButton.

class pygtkhelpers.proxy.ProxyGroup

A controller to handle multiple proxies, and sub-groups

A ProxyGroup is a bridge to reduce multiple proxies and sub-groups to a single signal based on the key of the individual proxies.

add_group(group)

Add an existing group to this group and proxy its signals

Parameters:group – The ProxyGroup instance to add
add_proxy(name, proxy)

Add a proxy to this group

Parameters:
  • name – The name or key of the proxy, which will be emitted with the changed signal
  • proxy – The proxy instance to add
add_proxy_for(name, widget)

Create a proxy for a widget and add it to this group

Parameters:
  • name – The name or key of the proxy, which will be emitted with the changed signal
  • widget – The widget to create a proxy for
class pygtkhelpers.proxy.SingleDelegatedPropertyGObjectProxy(widget)

Proxy which uses a delegated property on its widget.

class pygtkhelpers.proxy.SinglePropertyGObjectProxy(widget)

Proxy which uses a single property to set and get the value.

class pygtkhelpers.proxy.StringListProxy(widget)

Proxy for a pygtkhelpers.ui.widgets.StringList.

pygtkhelpers.proxy.proxy_for(widget)

Create a proxy for a Widget

Parameters:widget – A gtk.Widget to proxy

This will raise a KeyError if there is no proxy type registered for the widget type.