1. Gabriele Lanaro
  2. pygtkhelpers-main

Commits

Ali Afshar  committed 5c762a5

Split out the api docs

  • Participants
  • Parent commits 8306815
  • Branches default

Comments (0)

Files changed (10)

File docs/api_debug.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.debug.dialogs
+    :members:
+

File docs/api_delegates.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.delegates
+    :members:
+

File docs/api_dialogs.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.ui.dialogs
+    :members:
+

File docs/api_gthreads.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.gthreads
+    :members:
+

File docs/api_objectlist.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.ui.objectlist
+
+    .. autoclass:: Column
+        :members:
+
+    .. autoclass:: ObjectList
+        :members:
+        :inherited-members:
+
+    .. autoclass:: ObjectTree
+        :members:
+        :inherited-members:

File docs/api_proxy.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.proxy
+    :members:
+    :exclude-members: GObjectProxy
+
+    .. autoclass:: GObjectProxy
+        :members: read, update
+

File docs/api_test.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.test
+    :members:
+

File docs/api_utils.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.utils
+    :members:
+

File docs/api_widgets.rst

View file
  • Ignore whitespace
+
+.. automodule:: pygtkhelpers.ui.widgets
+    :members:
+

File pygtkhelpers/proxy.py

View file
  • Ignore whitespace
 
     :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'
 """
 
 
     prop_name = None
     dprop_name = None
 
-    def __init__(self, widget, *args, **kw):
+    def __init__(self, widget):
         self.owidget = widget
         widget = widget.get_property(self.dprop_name)
-        GObjectProxy.__init__(self, widget, *args, **kw)
+        GObjectProxy.__init__(self, widget)
 
 
 class GtkEntryProxy(SinglePropertyGObjectProxy):
     SimpleComboBox: GtkComboBoxProxy,
 }
 
+def proxy_for(widget):
+    """Create a proxy for a Widget
+
+    :param widget: A gtk.Widget to proxy
+
+    This will raise a KeyError if there is no proxy type registered for the
+    widget type.
+    """
+    proxy_type = widget_proxies.get(widget.__class__)
+    if proxy_type is None:
+        raise KeyError('There is no proxy type registered for %r' % widget)
+    return proxy_type(widget)
+