[orca] Eliminate unneeded and/or problematic imports
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Eliminate unneeded and/or problematic imports
- Date: Wed, 6 Jun 2012 17:59:39 +0000 (UTC)
commit c18f5ec044624d2a2ceeeaf34dfd187f0211dd04
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jun 6 12:19:24 2012 -0400
Eliminate unneeded and/or problematic imports
src/orca/app_gui_prefs.py | 8 ++--
src/orca/app_prefs.py | 4 +-
src/orca/bookmarks.py | 6 +--
src/orca/braille_generator.py | 5 +--
src/orca/chat.py | 6 +--
src/orca/event_manager.py | 29 ++++++------------
src/orca/mouse_review.py | 7 ++--
src/orca/orca.py | 16 ++++------
src/orca/orca_gui_prefs.py | 9 +++--
src/orca/script.py | 31 +++++++++++++++++--
src/orca/script_manager.py | 24 +++++++--------
src/orca/scripts/apps/Instantbird/script.py | 3 +-
src/orca/scripts/apps/Thunderbird/script.py | 4 +-
src/orca/scripts/apps/evolution/script.py | 6 ++--
.../scripts/apps/evolution/speech_generator.py | 7 ++--
.../scripts/apps/gnome-panel/speech_generator.py | 4 +-
src/orca/scripts/apps/gnome-terminal/script.py | 18 +----------
src/orca/scripts/apps/soffice/braille_generator.py | 4 +-
src/orca/scripts/apps/soffice/script.py | 6 ++--
src/orca/scripts/apps/soffice/speech_generator.py | 10 +++---
src/orca/scripts/default.py | 14 +++++----
src/orca/scripts/toolkits/Gecko/script.py | 3 +-
.../scripts/toolkits/Gecko/speech_generator.py | 7 ++--
.../J2SE-access-bridge/speech_generator.py | 5 +--
src/orca/scripts/toolkits/WebKitGtk/script.py | 3 +-
.../scripts/toolkits/WebKitGtk/speech_generator.py | 5 +--
src/orca/settings.py | 4 +-
src/orca/settings_manager.py | 13 ++++++--
src/orca/speech_generator.py | 5 +--
29 files changed, 132 insertions(+), 134 deletions(-)
---
diff --git a/src/orca/app_gui_prefs.py b/src/orca/app_gui_prefs.py
index 880a5e6..956598a 100644
--- a/src/orca/app_gui_prefs.py
+++ b/src/orca/app_gui_prefs.py
@@ -35,17 +35,17 @@ from . import braille
from . import debug
from . import input_event
from . import keybindings
-from . import orca
from . import orca_gui_prefs
from . import orca_state
from . import orca_platform
+from . import script_manager
+from . import settings_manager
from . import settings
from . import speech
-
from .orca_i18n import _
-_scriptManager = getattr(orca, '_scriptManager')
-_settingsManager = getattr(orca, '_settingsManager')
+_scriptManager = script_manager.getManager()
+_settingsManager = settings_manager.getManager()
applicationName = None
appScript = None
diff --git a/src/orca/app_prefs.py b/src/orca/app_prefs.py
index 32793cb..116bb28 100644
--- a/src/orca/app_prefs.py
+++ b/src/orca/app_prefs.py
@@ -30,11 +30,11 @@ __license__ = "LGPL"
import os
import pprint
-import orca # Deal with this during final Python 3 conversion
from . import debug
from . import settings
+from . import settings_manager
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
# The same fields than in orca_gui_prefs.py:
#
diff --git a/src/orca/bookmarks.py b/src/orca/bookmarks.py
index 1a64306..f9b776e 100644
--- a/src/orca/bookmarks.py
+++ b/src/orca/bookmarks.py
@@ -22,14 +22,12 @@
import pickle
import os
-import orca # Deal with this during final Python 3 conversion
-
from . import speech
from . import orca_state
-
+from . import settings_manager
from .orca_i18n import _
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class Bookmarks:
"""Represents a default bookmark handler."""
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index e8e3694..a94fae4 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -28,16 +28,15 @@ __license__ = "LGPL"
import pyatspi
from gi.repository import Atspi, Atk
-import orca # Deal with this during final Python 3 conversion
from . import braille
from . import generator
from . import orca_state
from . import settings
-
+from . import settings_manager
from .braille_rolenames import shortRoleNames
from .orca_i18n import ngettext
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class Space:
"""A dummy class to indicate we want to insert a space into an
diff --git a/src/orca/chat.py b/src/orca/chat.py
index baf9b10..868deb9 100644
--- a/src/orca/chat.py
+++ b/src/orca/chat.py
@@ -27,17 +27,15 @@ __license__ = "LGPL"
import pyatspi
-import orca # Deal with this during final Python 3 conversion
-
from . import input_event
from . import keybindings
from . import orca_state
from . import settings
+from . import settings_manager
from . import speech
-
from .orca_i18n import _
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
#############################################################################
# #
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index b9dd1cf..ba8dd54 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -32,21 +32,19 @@ import time
import orca # Deal with this during final Python 3 conversion
-from . import braille
from . import debug
from . import input_event
from . import orca_state
+from . import script_manager
from . import settings
-from . import speech
from .orca_i18n import _
-_scriptManager = None
+_scriptManager = script_manager.getManager()
class EventManager:
def __init__(self):
-
debug.println(debug.LEVEL_FINEST, 'INFO: Initializing event manager')
self._scriptListenerCounts = {}
self.registry = pyatspi.Registry
@@ -62,14 +60,6 @@ class EventManager:
"""Called when this presentation manager is activated."""
debug.println(debug.LEVEL_FINEST, 'INFO: Activating event manager')
-
- global _scriptManager
- _scriptManager = getattr(orca, '_scriptManager')
-
- # Tell BrlTTY which commands we care about.
- #
- braille.setupKeyRanges(list(orca_state.activeScript.brailleBindings.keys()))
-
self._registerListener("window:activate")
self._registerListener("window:deactivate")
self._registerListener("object:children-changed")
@@ -249,13 +239,9 @@ class EventManager:
# speak and braille to tell the user that no component
# has keyboard focus.
#
- message = _("No focus")
- if settings.brailleVerbosityLevel == \
- settings.VERBOSITY_LEVEL_VERBOSE:
- braille.displayMessage(message)
- if settings.speechVerbosityLevel == \
- settings.VERBOSITY_LEVEL_VERBOSE:
- speech.speak(message)
+ fullMessage = _("No focus")
+ defaultScript = _scriptManager.getDefaultScript()
+ defaultScript.presentMessage(fullMessage, '')
self.noFocusTimestamp = orca_state.noFocusTimestamp
self._gidleId = 0
rerun = False # destroy and don't call again
@@ -603,3 +589,8 @@ class EventManager:
return True
else:
return False
+
+_manager = EventManager()
+
+def getManager():
+ return _manager
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 480901c..0c7ec0e 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -39,13 +39,14 @@ import pyatspi
from gi.repository import Gdk
from gi.repository import GObject
-import orca # Deal with this during final Python 3 conversion
+from . import event_manager
+from . import script_manager
from . import speech
from . import braille
from . import settings
-_scriptManager = getattr(orca, '_scriptManager')
-_eventManager = getattr(orca, '_eventManager')
+_eventManager = event_manager.getManager()
+_scriptManager = script_manager.getManager()
class BoundingBox:
"""A bounding box, currently it is used to test if a given point is
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 230be09..9b72caf 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -57,26 +57,24 @@ try:
except:
pass
-from .settings_manager import SettingsManager
-_settingsManager = SettingsManager()
-
-from .event_manager import EventManager
-_eventManager = EventManager()
-
-from .script_manager import ScriptManager
-_scriptManager = ScriptManager()
-
from . import braille
from . import debug
+from . import event_manager
from . import notification_messages
from . import orca_state
+from . import script_manager
from . import settings
+from . import settings_manager
from . import speech
from .input_event import BrailleEvent
from .input_event import KeyboardEvent
from .orca_i18n import _
from .orca_i18n import ngettext
+_eventManager = event_manager.getManager()
+_scriptManager = script_manager.getManager()
+_settingsManager = settings_manager.getManager()
+
try:
# If we don't have an active desktop, we will get a RuntimeError.
from . import mouse_review
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 14ce74c..4efed86 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -39,9 +39,12 @@ from . import acss
from . import debug
from . import orca
from . import orca_gtkbuilder
+from . import orca_gui_profile
from . import orca_state
from . import orca_platform
+from . import script_manager
from . import settings
+from . import settings_manager
from . import input_event
from . import keybindings
from . import pronunciation_dict
@@ -50,10 +53,8 @@ from . import speech
from . import speechserver
from . import text_attribute_names
-from . import orca_gui_profile
-
-_settingsManager = getattr(orca, '_settingsManager')
-_scriptManager = getattr(orca, '_scriptManager')
+_scriptManager = script_manager.getManager()
+_settingsManager = settings_manager.getManager()
try:
import louis
diff --git a/src/orca/script.py b/src/orca/script.py
index 4b8be29..dbdaa30 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -43,19 +43,26 @@ import pyatspi
from . import braille_generator
from . import debug
+from . import event_manager
from . import flat_review
from . import formatting
from . import label_inference
from . import keybindings
from . import orca_state
+from . import script_manager
from . import script_utilities
from . import settings
+from . import settings_manager
from . import speech_generator
from . import structural_navigation
from . import where_am_I
from . import bookmarks
from . import tutorialgenerator
+_eventManager = event_manager.getManager()
+_scriptManager = script_manager.getManager()
+_settingsManager = settings_manager.getManager()
+
class Script:
"""The specific focus tracking scripts for applications.
"""
@@ -312,15 +319,31 @@ class Script:
"""
return
+ def registerEventListeners(self):
+ """Tells the event manager to start listening for all the event types
+ of interest to the script.
+
+ Arguments:
+ - script: the script.
+ """
+
+ _eventManager.registerScriptListeners(self)
+
+ def deregisterEventListeners(self):
+ """Tells the event manager to stop listening for all the event types
+ of interest to the script.
+
+ Arguments:
+ - script: the script.
+ """
+
+ _eventManager.deregisterScriptListeners(self)
+
def getSettings(self):
"""Returns the settings associated with this script, regardless of
whether or not the script is active.
"""
- import orca # Deal with this during final Python 3 conversion
- _scriptManager = getattr(orca, '_scriptManager')
- _settingsManager = getattr(orca, '_settingsManager')
-
scriptSettings = settings
if orca_state.activeScript != self:
name = _scriptManager.getModuleName(self.app)
diff --git a/src/orca/script_manager.py b/src/orca/script_manager.py
index cfafcc5..be900f4 100644
--- a/src/orca/script_manager.py
+++ b/src/orca/script_manager.py
@@ -24,16 +24,10 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2011. Orca Team."
__license__ = "LGPL"
-import orca # Deal with this during final Python 3 conversion
-
from . import debug
from . import orca_state
-
from .scripts import apps, toolkits
-_settingsManager = getattr(orca, '_settingsManager')
-_eventManager = getattr(orca, '_eventManager')
-
class ScriptManager:
def __init__(self):
@@ -214,7 +208,7 @@ class ScriptManager:
from .scripts import default
script = default.Script(app)
- _eventManager.registerScriptListeners(script)
+ script.registerEventListeners()
if not app:
self._defaultScript = script
@@ -241,7 +235,7 @@ class ScriptManager:
if not toolkitScript:
toolkitScript = self._createScript(app, obj)
toolkitScripts[objToolkit] = toolkitScript
- _eventManager.registerScriptListeners(toolkitScript)
+ toolkitScript.registerEventListeners()
self.toolkitScripts[app] = toolkitScripts
if not app:
@@ -251,7 +245,7 @@ class ScriptManager:
else:
appScript = self._createScript(app, None)
self.appScripts[app] = appScript
- _eventManager.registerScriptListeners(appScript)
+ appScript.registerEventListeners()
# Only defer to the toolkit script for this object if the app script
# is based on a different toolkit.
@@ -278,7 +272,6 @@ class ScriptManager:
if not newScript:
return
- _settingsManager.loadAppSettings(newScript)
newScript.activate()
debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: %s (reason=%s)" \
% (newScript.name, reason))
@@ -297,10 +290,10 @@ class ScriptManager:
return
appList = list(self.appScripts.keys())
- appList = [a for a in appList if a!= None and a not in desktop]
+ appList = [a for a in appList if a != None and a not in desktop]
for app in appList:
appScript = self.appScripts.pop(app)
- _eventManager.deregisterScriptListeners(appScript)
+ appScript.deregisterEventListeners()
del appScript
try:
@@ -309,7 +302,12 @@ class ScriptManager:
pass
else:
for toolkitScript in list(toolkitScripts.values()):
- _eventManager.deregisterScriptListeners(toolkitScript)
+ toolkitScript.deregisterEventListeners()
del toolkitScript
del app
+
+_manager = ScriptManager()
+
+def getManager():
+ return _manager
diff --git a/src/orca/scripts/apps/Instantbird/script.py b/src/orca/scripts/apps/Instantbird/script.py
index 3e0f29a..de0994b 100644
--- a/src/orca/scripts/apps/Instantbird/script.py
+++ b/src/orca/scripts/apps/Instantbird/script.py
@@ -30,6 +30,7 @@ import pyatspi
import orca.bookmarks as bookmarks
import orca.scripts.default as default
import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.orca_state as orca_state
import orca.scripts.toolkits.Gecko as Gecko
import orca.speech as speech
@@ -37,7 +38,7 @@ import orca.speech as speech
from .chat import Chat
from .script_utilities import Utilities
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index 876a171..0a6cbef 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -30,10 +30,10 @@ import pyatspi
import orca.orca as orca
import orca.debug as debug
import orca.scripts.default as default
+import orca.settings_manager as settings_manager
import orca.orca_state as orca_state
import orca.speech as speech
import orca.scripts.toolkits.Gecko as Gecko
-
from orca.orca_i18n import _
from .formatting import Formatting
@@ -41,7 +41,7 @@ from .speech_generator import SpeechGenerator
from .script_utilities import Utilities
from . import script_settings
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 39251b1..3c5a411 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -37,14 +37,14 @@ import orca.orca_state as orca_state
import orca.speech as speech
import orca.speechserver as speechserver
import orca.settings as settings
-
-from orca.orca_i18n import _ # for gettext support
+import orca.settings_manager as settings_manager
+from orca.orca_i18n import _
from .formatting import Formatting
from .speech_generator import SpeechGenerator
from .script_utilities import Utilities
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/apps/evolution/speech_generator.py b/src/orca/scripts/apps/evolution/speech_generator.py
index 38eb330..ccd6135 100644
--- a/src/orca/scripts/apps/evolution/speech_generator.py
+++ b/src/orca/scripts/apps/evolution/speech_generator.py
@@ -27,12 +27,11 @@ __license__ = "LGPL"
import pyatspi
-import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
+from orca.orca_i18n import _
-from orca.orca_i18n import _ # for gettext support
-
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class SpeechGenerator(speech_generator.SpeechGenerator):
"""Overrides _generateSpeechForTableCell so that, if this is an
diff --git a/src/orca/scripts/apps/gnome-panel/speech_generator.py b/src/orca/scripts/apps/gnome-panel/speech_generator.py
index efa2b72..1e9e5e1 100644
--- a/src/orca/scripts/apps/gnome-panel/speech_generator.py
+++ b/src/orca/scripts/apps/gnome-panel/speech_generator.py
@@ -27,10 +27,10 @@ __license__ = "LGPL"
import pyatspi
-import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class SpeechGenerator(speech_generator.SpeechGenerator):
diff --git a/src/orca/scripts/apps/gnome-terminal/script.py b/src/orca/scripts/apps/gnome-terminal/script.py
index d48cc96..e03ac80 100644
--- a/src/orca/scripts/apps/gnome-terminal/script.py
+++ b/src/orca/scripts/apps/gnome-terminal/script.py
@@ -30,12 +30,12 @@ __license__ = "LGPL"
import pyatspi
import orca.scripts.default as default
-import orca.orca as orca
import orca.orca_state as orca_state
import orca.settings as settings
+import orca.settings_manager as settings_manager
import orca.speech as speech
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
@@ -88,20 +88,6 @@ class Script(default.Script):
default.Script.locusOfFocusChanged(self, event,
oldLocusOfFocus, newLocusOfFocus)
- #def onWindowActivated(self, event):
- # # Sets the context to the top level window first, so we can
- # # get information about it the window we just moved to.
- # #
- # orca.setLocusOfFocus(event, event.source)
- #
- # # Now we find the focused object and set the locus of focus to it.
- # #
- # obj = self.findFocusedObject(self.app)
- # if obj:
- # orca.setLocusOfFocus(event, obj)
- # else:
- # default.Script.onWindowActivated(self, event)
-
def onTextDeleted(self, event):
"""Called whenever text is deleted from an object.
diff --git a/src/orca/scripts/apps/soffice/braille_generator.py b/src/orca/scripts/apps/soffice/braille_generator.py
index c1caa31..30ad96f 100644
--- a/src/orca/scripts/apps/soffice/braille_generator.py
+++ b/src/orca/scripts/apps/soffice/braille_generator.py
@@ -29,9 +29,9 @@ import pyatspi
import orca.braille as braille
import orca.braille_generator as braille_generator
-import orca.orca as orca
+import orca.settings_manager as settings_manager
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class BrailleGenerator(braille_generator.BrailleGenerator):
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 82de64d..ed8ba35 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -48,8 +48,8 @@ import orca.orca as orca
import orca.orca_state as orca_state
import orca.speech as speech
import orca.settings as settings
-
-from orca.orca_i18n import _ # for gettext support
+import orca.settings_manager as settings_manager
+from orca.orca_i18n import _
from orca.orca_i18n import ngettext
from .speech_generator import SpeechGenerator
@@ -59,7 +59,7 @@ from .structural_navigation import StructuralNavigation
from .script_utilities import Utilities
from . import script_settings
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class Script(default.Script):
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py b/src/orca/scripts/apps/soffice/speech_generator.py
index 5a9045c..6c67e73 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -27,14 +27,14 @@ __license__ = "LGPL"
import pyatspi
-import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
-
-from orca.orca_i18n import ngettext # for ngettext support
-from orca.orca_i18n import _ # for gettext support
+from orca.orca_i18n import ngettext
+from orca.orca_i18n import _
from . import script_settings
-_settingsManager = getattr(orca, '_settingsManager')
+
+_settingsManager = settings_manager.getManager()
class SpeechGenerator(speech_generator.SpeechGenerator):
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 50b6b61..f031d21 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -33,9 +33,6 @@ __license__ = "LGPL"
import locale
import time
-import orca.orca as orca
-_settingsManager = getattr(orca, '_settingsManager')
-
import pyatspi
import orca.braille as braille
import orca.debug as debug
@@ -45,19 +42,23 @@ import orca.flat_review as flat_review
import orca.input_event as input_event
import orca.keybindings as keybindings
import orca.outline as outline
+import orca.orca as orca
import orca.orca_state as orca_state
import orca.phonnames as phonnames
import orca.script as script
import orca.settings as settings
+import orca.settings_manager as settings_manager
import orca.speech as speech
import orca.speechserver as speechserver
import orca.mouse_review as mouse_review
import orca.text_attribute_names as text_attribute_names
import orca.notification_messages as notification_messages
-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
+from orca.orca_i18n import _
+from orca.orca_i18n import ngettext
+from orca.orca_i18n import C_
+
+_settingsManager = settings_manager.getManager()
########################################################################
# #
@@ -1470,6 +1471,7 @@ class Script(script.Script):
def activate(self):
"""Called when this script is activated."""
+ _settingsManager.loadAppSettings(self)
braille.setupKeyRanges(list(self.brailleBindings.keys()))
speech.updatePunctuationLevel()
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 1c44e91..f931c0a 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -57,6 +57,7 @@ import orca.liveregions as liveregions
import orca.orca as orca
import orca.orca_state as orca_state
import orca.settings as settings
+import orca.settings_manager as settings_manager
import orca.speech as speech
import orca.speechserver as speechserver
@@ -73,7 +74,7 @@ from orca.orca_i18n import _
from orca.speech_generator import Pause
from orca.acss import ACSS
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index db29014..a4b19ac 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -32,13 +32,12 @@ __license__ = "LGPL"
import pyatspi
-import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
-
from orca.orca_i18n import _
-from orca.orca_i18n import ngettext # for ngettext support
+from orca.orca_i18n import ngettext
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py b/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
index 2d70557..fafaa5d 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
@@ -27,12 +27,11 @@ __license__ = "LGPL"
import pyatspi
-import orca.orca as orca
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
-
from orca.orca_i18n import ngettext
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 67da9fc..05765c5 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -34,6 +34,7 @@ import orca.scripts.default as default
import orca.input_event as input_event
import orca.orca as orca
import orca.settings as settings
+import orca.settings_manager as settings_manager
import orca.speechserver as speechserver
import orca.orca_state as orca_state
import orca.speech as speech
@@ -45,7 +46,7 @@ from .braille_generator import BrailleGenerator
from .speech_generator import SpeechGenerator
from .script_utilities import Utilities
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index ca099fc..9fa9a3a 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -30,13 +30,12 @@ __license__ = "LGPL"
import pyatspi
import orca.keynames as keynames
-import orca.orca as orca
import orca.settings as settings
+import orca.settings_manager as settings_manager
import orca.speech_generator as speech_generator
-
from orca.orca_i18n import _
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
########################################################################
# #
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 9199e66..0f378c0 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -681,8 +681,8 @@ chatRoomHistories = False
# Allow for the customization of key bindings.
#
def overrideKeyBindings(script, keyBindings):
- import orca # Deal with this during final Python 3 conversion
- _settingsManager = getattr(orca, '_settingsManager')
+ import orca.settings_manager as settings_manager
+ _settingsManager = settings_manager.getManager()
return _settingsManager.overrideKeyBindings(script, keyBindings)
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 331acfa..011912d 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -33,9 +33,10 @@ import imp
from gi.repository import Gio, GLib
from . import debug
-from .keybindings import KeyBinding
+from . import script_manager
from . import settings
from . import pronunciation_dict
+from .keybindings import KeyBinding
try:
_proxy = Gio.DBusProxy.new_for_bus_sync(
@@ -49,6 +50,8 @@ try:
except:
_proxy = None
+_scriptManager = script_manager.getManager()
+
class SettingsManager(object):
"""Settings backend manager. This class manages orca user's settings
using different backends"""
@@ -508,9 +511,6 @@ class SettingsManager(object):
self._loadProfileSettings()
script.voices = self.getSetting('voices')
- import orca # Deal with this during final Python 3 conversion
- _scriptManager = getattr(orca, '_scriptManager')
-
app = script.app
moduleName = _scriptManager.getModuleName(app)
if not moduleName:
@@ -597,3 +597,8 @@ def getRealValues(prefs):
#for key in prefs.keys():
# prefs[key] = getValueForKey(prefs, key)
return prefs
+
+_manager = SettingsManager()
+
+def getManager():
+ return _manager
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 371fadd..5b2a47c 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -29,11 +29,10 @@ import pyatspi
import urlparse, urllib2
from gi.repository import Atspi, Atk
-import orca # Deal with this during final Python 3 conversion
-
from . import debug
from . import generator
from . import settings
+from . import settings_manager
from . import sound
from . import text_attribute_names
@@ -82,7 +81,7 @@ voiceType = {
VALUE: settings.SYSTEM_VOICE, # Users may prefer DEFAULT_VOICE here
}
-_settingsManager = getattr(orca, '_settingsManager')
+_settingsManager = settings_manager.getManager()
class SpeechGenerator(generator.Generator):
"""Takes accessible objects and produces a string to speak for
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]