diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-03-19 20:20:40 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-03-19 20:20:40 (GMT) |
commit | de3cb8c0c9ab1bb2215338e1757bb231331e1c6c (patch) | |
tree | 98d99a66d829e5b94ba7392ee813e13b4e605ca9 /src/sugar/tutorius/gtkutils.py | |
parent | 3d41146af5f136d156b5a1f0c65c553612fbd4b2 (diff) | |
parent | e20cfb534e276fa7762980bbdd6d633a7ce99ccc (diff) |
Merge branch 'tutorial_toolkit' into mike
Conflicts:
source/activities/Writus.activity/TAbiWordActivity.py
source/external/source/sugar-toolkit/src/sugar/graphics/window.py
source/external/source/sugar-toolkit/src/sugar/tutorius/Makefile.am
source/external/source/sugar-toolkit/src/sugar/tutorius/actions.py
source/external/source/sugar-toolkit/src/sugar/tutorius/overlayer.py
source/external/source/sugar-toolkit/src/sugar/tutorius/services.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/coretests.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/run-tests.py
Diffstat (limited to 'src/sugar/tutorius/gtkutils.py')
-rw-r--r-- | src/sugar/tutorius/gtkutils.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/sugar/tutorius/gtkutils.py b/src/sugar/tutorius/gtkutils.py index 450872d..c5c1e12 100644 --- a/src/sugar/tutorius/gtkutils.py +++ b/src/sugar/tutorius/gtkutils.py @@ -17,6 +17,7 @@ """ Utility classes and functions that are gtk related """ +import gtk def activity(activity=None, singleton=[]): if activity: @@ -113,7 +114,7 @@ def register_signals_numbered(target, handler, prefix="0", max_depth=None): ret+=register_signals_numbered(child, handler, pre, dep) #register events on the target if a widget XXX necessary to check this? if isinstance(target, gtk.Widget): - for sig in Tutorial.EVENTS: + for sig in EVENTS: try: ret.append( \ (target, target.connect(sig, handler, (sig, prefix) ))\ @@ -123,7 +124,7 @@ def register_signals_numbered(target, handler, prefix="0", max_depth=None): return ret -def register_signals(self, target, handler, prefix=None, max_depth=None): +def register_signals(target, handler, prefix=None, max_depth=None): """ Recursive function to register event handlers on an target and it's children. The event handler is called with an extra @@ -131,19 +132,20 @@ def register_signals(self, target, handler, prefix=None, max_depth=None): the FQDN-style name of the target that triggered the event. This function registers all of the events listed in - Tutorial.EVENTS and omits widgets with a name matching - Tutorial.IGNORED_WIDGETS from the name hierarchy. + EVENTS and omits widgets with a name matching + IGNORED_WIDGETS from the name hierarchy. Example arg tuple added: ("focus", "Activity.Toolbox.Bold") Side effects: -Handlers connected on the various targets - -Handler ID's stored in self.handlers @param target the target to recurse on @param handler the handler function to connect @param prefix name prepended to the target name to form a chain @param max_depth maximum recursion depth, None for infinity + + @returns list of (object, handler_id) """ ret = [] #Gtk Containers have a get_children() function @@ -154,16 +156,16 @@ def register_signals(self, target, handler, prefix=None, max_depth=None): #Recurse with a prefix on all children pre = ".".join( \ [p for p in (prefix, target.get_name()) \ - if not (p is None or p in Tutorial.IGNORED_WIDGETS)] \ + if not (p is None or p in IGNORED_WIDGETS)] \ ) ret += register_signals(child, handler, pre, max_depth-1) name = ".".join( \ [p for p in (prefix, target.get_name()) \ - if not (p is None or p in Tutorial.IGNORED_WIDGETS)] \ + if not (p is None or p in IGNORED_WIDGETS)] \ ) #register events on the target if a widget XXX necessary to check this? if isinstance(target, gtk.Widget): - for sig in Tutorial.EVENTS: + for sig in EVENTS: try: ret.append( \ (target, target.connect(sig, handler, (sig, name) )) \ |