From de3cb8c0c9ab1bb2215338e1757bb231331e1c6c Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 19 Mar 2009 20:20:40 +0000 Subject: 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 --- (limited to 'src/sugar/tutorius/gtkutils.py') 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) )) \ -- cgit v0.9.1