[orca/orca-gnome3: 32/87] Added initial and testing plugins



commit e337ea442a38b3c01642285df712576af843f938
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date:   Wed Mar 23 13:38:41 2011 +0100

    Added initial and testing plugins

 src/orca/baseplugins/dateandtime.py |   16 +++++++++++++---
 src/orca/baseplugins/speech.py      |   17 ++++++++++++-----
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/baseplugins/dateandtime.py b/src/orca/baseplugins/dateandtime.py
index 8a37dc3..6dc1a90 100644
--- a/src/orca/baseplugins/dateandtime.py
+++ b/src/orca/baseplugins/dateandtime.py
@@ -26,7 +26,8 @@ __date__      = "$Date$"
 __copyright__ = "Copyright (c) 2011 Consorcio Fernando de los Rios."
 __license__   = "LGPL"
 
-from orca.pluglib.interfaces import *
+from orca.pluglib.interfaces import IPluginManager, IPlugin, ICommand, \
+    IPresenter, IConfigurable, IDependenciesChecker, PluginManagerError
 
 from orca.orca_i18n import _         # for gettext support
 from orca.orca_i18n import ngettext  # for ngettext support
@@ -34,8 +35,6 @@ from orca.orca_i18n import C_        # to provide qualified translatable strings
 
 import orca.input_event
 import orca.keybindings
-import orca.orca as orca_module
-_settingsManager = getattr(orca_module, '_settingsManager')
  
 import time
 
@@ -48,6 +47,14 @@ class dtPlugin(IPlugin, IPresenter, ICommand):
     icon = 'gtk-missing-image'
 
     def __init__(self):
+        global _settingsManager
+
+        import orca.orca as orca_module
+        _settingsManager = getattr(orca_module, '_settingsManager')
+
+    def enable(self):
+        global _settingsManager
+
         print 'Date and time plugin started'
 
         self.myKeyBindings = orca.keybindings.KeyBindings()
@@ -83,6 +90,9 @@ class dtPlugin(IPlugin, IPresenter, ICommand):
 
         orca.settings.keyBindingsMap["default"] = self.myKeyBindings
 
+    def disable(self):
+        self.removePluginKeybinding()
+
     def presentTime(self, script, inputEvent=None):
         timeFormat = _settingsManager.getSetting('presentTimeFormat')
         message = time.strftime(timeFormat, time.localtime())
diff --git a/src/orca/baseplugins/speech.py b/src/orca/baseplugins/speech.py
index 179b966..dee0a28 100644
--- a/src/orca/baseplugins/speech.py
+++ b/src/orca/baseplugins/speech.py
@@ -26,19 +26,17 @@ __date__      = "$Date$"
 __copyright__ = "Copyright (c) 2011 Consorcio Fernando de los Rios."
 __license__   = "LGPL"
 
-from orca.pluglib.interfaces import *
+from orca.pluglib.interfaces import IPluginManager, IPlugin, ICommand, \
+    IPresenter, IConfigurable, IDependenciesChecker, PluginManagerError
 
 from orca.orca_i18n import _         # for gettext support
 from orca.orca_i18n import ngettext  # for ngettext support
 from orca.orca_i18n import C_        # to provide qualified translatable strings
 
 import orca.settings as settings
+# este peta, quizas hay que meterlo en el enable
 import orca.orca_state as orca_state
 
-import orca.orca as orca_module
-_settingsManager = getattr(orca_module, '_settingsManager')
- 
-
 class speechPlugin(IPlugin, IPresenter):
     name = 'Speech Plugin'
     description = 'Activate or not the speech for the user' 
@@ -50,6 +48,12 @@ class speechPlugin(IPlugin, IPresenter):
     def __init__(self):
         print 'Date and time plugin started'
 
+    def enable(self):
+        print 'Date and time plugin started'
+
+        import orca.orca as orca_module
+        _settingsManager = getattr(orca_module, '_settingsManager')
+
         """Toggle the silencing of speech.
     
         Returns True to indicate the input event has been consumed.
@@ -69,4 +73,7 @@ class speechPlugin(IPlugin, IPresenter):
             orca_state.activeScript.presentMessage(_("Speech disabled."))
             settings.silenceSpeech = True
 
+    def disable(self):
+        print 'disable dummy method!'
+
 IPlugin.register(speechPlugin)



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