[orca/orca-gnome3: 25/87] Plugin dateandtime working with its own keybindings. Circular import fixed.



commit dfa192b2b5a3a1fd5119d067e8578a55fb79586c
Author: José Ignacio �lvarez Ruiz <jialvarez emergya es>
Date:   Mon Mar 14 17:12:41 2011 +0100

    Plugin dateandtime working with its own keybindings. Circular import fixed.

 src/orca/baseplugins/Makefile.am                 |    2 +-
 src/orca/baseplugins/{test.py => dateandtime.py} |    6 +-
 src/orca/orca.py                                 |    8 ++-
 src/orca/orca_gui_prefs.py                       |    3 -
 src/orca/pluglib/interfaces.py                   |    8 +--
 src/orca/pluglib/plugin_manager.py               |    2 -
 src/orca/test.py                                 |   85 ----------------------
 7 files changed, 14 insertions(+), 100 deletions(-)
---
diff --git a/src/orca/baseplugins/Makefile.am b/src/orca/baseplugins/Makefile.am
index 6a633f4..8cc5187 100644
--- a/src/orca/baseplugins/Makefile.am
+++ b/src/orca/baseplugins/Makefile.am
@@ -1,7 +1,7 @@
 orca_pathdir=$(pyexecdir)
 
 orca_python_PYTHON = \
-        test.py
+        dateandtime.py
 
 orca_pythondir=$(pyexecdir)/orca/baseplugins
 
diff --git a/src/orca/baseplugins/test.py b/src/orca/baseplugins/dateandtime.py
similarity index 95%
rename from src/orca/baseplugins/test.py
rename to src/orca/baseplugins/dateandtime.py
index c7cfefd..9455733 100644
--- a/src/orca/baseplugins/test.py
+++ b/src/orca/baseplugins/dateandtime.py
@@ -31,7 +31,7 @@ _settingsManager = getattr(orca_module, '_settingsManager')
  
 import time
 
-class testPlugin(IPlugin, IPresenter, ICommand):
+class dtPlugin(IPlugin, IPresenter, ICommand):
     name = 'Date and Time'
     description = 'Present the date and time to the user' 
     version = '0.9'
@@ -88,6 +88,6 @@ class testPlugin(IPlugin, IPresenter, ICommand):
         return True
 
     def removePluginKeybinding(self):
-        self.removeKeybinding(self.presentTimeHandler)
+        self.removeKeybinding("default")
 
-IPlugin.register(testPlugin)
+IPlugin.register(dtPlugin)
diff --git a/src/orca/orca.py b/src/orca/orca.py
index bd0278e..fa26427 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -519,7 +519,6 @@ _eventManager = EventManager()
 from script_manager import ScriptManager
 _scriptManager = ScriptManager()
 
-
 try:
     # If we don't have an active desktop, we will get a RuntimeError.
     import mouse_review
@@ -2318,6 +2317,12 @@ def main():
         loadUserSettings(skipReloadMessage=True)
         _settingsManager.setFirstStart()
 
+    # needed to load plugins (first time)
+    import pluglib
+    from pluglib.plugin_manager import plugmanager
+    
+    plugmanager.scan_plugins()
+
     try:
         start(pyatspi.Registry) # waits until we stop the registry
     except:
@@ -2325,4 +2330,5 @@ def main():
     return 0
 
 if __name__ == "__main__":
+
     sys.exit(main())
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index eb7de05..38f9b68 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -61,9 +61,6 @@ _scriptManager = getattr(orca, '_scriptManager')
 import pluglib
 from pluglib.plugin_manager import plugmanager
 
-# temporary here?? START ACTIVE PLUGINS!
-plugmanager.scan_plugins()
-
 try:
     import louis
 except ImportError:
diff --git a/src/orca/pluglib/interfaces.py b/src/orca/pluglib/interfaces.py
index cbc2a4f..2494d07 100644
--- a/src/orca/pluglib/interfaces.py
+++ b/src/orca/pluglib/interfaces.py
@@ -167,12 +167,10 @@ class ICommand(object):
 
     ############## METHODS #################
 
-    def removeKeybinding(self, kbHandler):
-        import orca.keybindings
-
-        kbInstance = orca.keybindings.KeyBindings()
-        kbInstance.removeByHandler(kbHandler)
+    def removeKeybinding(self, name):
+        import orca.settings as settings
 
+        settings.keyBindingsMap[name] = None
 
 class IPresenter(object):
     """Allows to operate with presentation plugins"""
diff --git a/src/orca/pluglib/plugin_manager.py b/src/orca/pluglib/plugin_manager.py
index 60b7de4..61cb327 100644
--- a/src/orca/pluglib/plugin_manager.py
+++ b/src/orca/pluglib/plugin_manager.py
@@ -41,8 +41,6 @@ class ModulePluginManager(IPluginManager):
         if not type(self.plugin_paths) is list:
             self.plugin_paths = [self.plugin_paths]
         
-        print self.plugin_paths
-
         #{'plugin_name': {'class': plugin_class, 'object': plugin_object,
         # 'type': plugin_type, 'registered':, if_registered}
         self.plugins = {}



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