orca r4243 - branches/phase2/src/orca/plugins



Author: wwalker
Date: Thu Sep 18 14:40:21 2008
New Revision: 4243
URL: http://svn.gnome.org/viewvc/orca?rev=4243&view=rev

Log:
Begin work on Listener and Handler introspection.


Added:
   branches/phase2/src/orca/plugins/automatic.py   (contents, props changed)

Added: branches/phase2/src/orca/plugins/automatic.py
==============================================================================
--- (empty file)
+++ branches/phase2/src/orca/plugins/automatic.py	Thu Sep 18 14:40:21 2008
@@ -0,0 +1,88 @@
+# Copyright 2008 Sun Microsystems Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""A possible better way to do plugins.
+"""
+
+__id__        = "$Id$"
+__copyright__ = "Copyright (c) 2008 Sun Microsystems Inc."
+__license__   = "LGPL"
+
+import re
+
+import logging
+log = logging.getLogger('orca.plugins.automatic')
+
+import orca.plugin as plugin
+
+try:
+    import brlapi
+except:
+    log.exception("Not using braille bindings because of this exception:")
+
+from orca.orca_i18n import _ # for gettext support
+
+class Plugin(plugin.Plugin):
+    """A plugin for getting debug information.
+    """
+    def __init__(self, owner, scriptSettings):
+        """Creates a Plugin for the given script.
+        This method should not be called by anyone except the
+        owner.
+
+        Arguments:
+        - owner: the Script owning this Plugin
+        - scriptSettings: the Settings for the script
+        """
+        plugin.Plugin.__init__(self, owner, scriptSettings)
+        self._introspectHandlers()
+
+    def floopyDooHandler(self, inputEvent=None, modifiers=None):
+        """The floopy doo handler.
+
+        keyboard: "a", input_event.defaultModifierMask, input_event.ORCA_CTRL_ALT_MODIFIER_MASK, 1
+        description: _("Floopy doo.")
+        """
+        log.debug("floopyDooHandler: %s" % inputEvent)
+
+    def floopyDeeHandler(self, inputEvent=None, modifiers=None):
+        """The floopy dee handler.
+
+        keyboard: "b", input_event.defaultModifierMask, input_event.ORCA_CTRL_ALT_MODIFIER_MASK, 1
+        description: _("Floopy dee.")
+        """
+        log.debug("floopyDeeHandler: %s" % inputEvent)
+
+if __name__ == "__main__":
+    logging.basicConfig(format="%(name)s %(message)s")
+    log.setLevel(logging.DEBUG)
+
+    import orca.script
+    scrypt = orca.script.Script(None)
+    plugin = Plugin(scrypt, None)
+    print scrypt
+    print plugin
+
+    plugin.processObjectEvent(None)
+
+    plugin.activate()
+    try:
+        plugin.processObjectEvent(None)
+    except:
+        # Expected since no event was passed in
+        #
+        pass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]