[orca/new-settings] Clean up some old code from the classic backend as example



commit ffef9ba725514b577bf44c23d2378fa7b8100cdd
Author: Juanje Ojeda <jojeda emergya es>
Date:   Mon Sep 13 12:14:41 2010 +0200

    Clean up some old code from the classic backend as example

 src/orca/backends/gconf_backend.py |  229 ------------------------------------
 1 files changed, 0 insertions(+), 229 deletions(-)
---
diff --git a/src/orca/backends/gconf_backend.py b/src/orca/backends/gconf_backend.py
index cde045b..1e95fb2 100644
--- a/src/orca/backends/gconf_backend.py
+++ b/src/orca/backends/gconf_backend.py
@@ -202,66 +202,6 @@ class OrcaPrefs():
                     casts[type(value)](self._client, self.__app_key + '/' + \
                                        name, value)
 
-
-    def _writePreferencesPreamble(self, prefs):
-        """Writes the preamble to the user-settings.py file."""
-
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_OFF\n")
-        prefs.writelines("orca.debug.debugLevel = orca.debug.LEVEL_SEVERE\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_WARNING\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_INFO\n")
-        prefs.writelines( \
-            "#orca.debug.debugLevel = orca.debug.LEVEL_CONFIGURATION\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_FINE\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_FINER\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_FINEST\n")
-        prefs.writelines("#orca.debug.debugLevel = orca.debug.LEVEL_ALL\n")
-        prefs.writelines("\n")
-        prefs.writelines("#orca.debug.eventDebugLevel = " \
-                         "orca.debug.LEVEL_OFF\n")
-        prefs.writelines("#orca.debug.eventDebugFilter = None\n")
-        prefs.writelines("#orca.debug.eventDebugFilter = " \
-                         "re.compile('[\S]*focus|[\S]*activ')\n")
-        prefs.writelines( \
-            "#orca.debug.eventDebugFilter = re.compile('nomatch')\n")
-        prefs.writelines("#orca.debug.eventDebugFilter = " \
-                         "re.compile('[\S]*:accessible-name')\n")
-        prefs.writelines("#orca.debug.eventDebugFilter = " \
-                         "re.compile('[\S]*:(?!bounds-changed)')\n")
-
-        prefs.writelines("\n")
-
-        prefs.writelines("#orca.debug.debugFile = " \
-                         "open(time.strftime('debug-%Y-%m-%d-%H:%M:%S.out'), "\
-                         "'w', 0)\n")
-        prefs.writelines("#orca.debug.debugFile = open('debug.out', 'w', 0)\n")
-        prefs.writelines("\n")
-
-        prefs.writelines("#orca.settings.useBonoboMain=False\n")
-        prefs.writelines("#orca.settings.debugEventQueue=True\n")
-        prefs.writelines("#orca.settings.gilSleepTime=0\n")
-        prefs.writelines("\n")
-
-        prefs.writelines("if False:\n")
-        prefs.writelines("    import sys\n")
-        prefs.writelines("    import orca.debug\n")
-        prefs.writelines("    sys.settrace(orca.debug.traceit)\n")
-        prefs.writelines("    orca.debug.debugLevel = orca.debug.LEVEL_ALL\n")
-        prefs.writelines("\n")
-
-    def _writePreferencesPostamble(self, prefs):
-        """Writes the postamble to the user-settings.py file."""
-
-        prefs.writelines("\nimport orca.orca_state\n")
-        prefs.writelines("\ntry:\n")
-        prefs.writelines("    reload(orca.orca_state.orcaCustomizations)\n")
-        prefs.writelines("except AttributeError:\n")
-        prefs.writelines("    try:\n")
-        prefs.writelines("        orca.orca_state.orcaCustomizations = "
-                         "__import__(\"orca-customizations\")\n")
-        prefs.writelines("    except ImportError:\n")
-        prefs.writelines("        pass\n")
-
     def _enableAccessibility(self):
         """Enables the GNOME accessibility flag.  Users need to log out and
         then back in for this to take effect.
@@ -652,149 +592,6 @@ class OrcaPrefs():
         else:
             return "orca.settings.PROGRESS_BAR_APPLICATION"
 
-    def _writeKeyBinding(self, prefs, tupl):
-        """Writes a single keyBinding to the user-settings.py 
-        keyBindings section.
-
-        Arguments:
-        - prefs: text string - file to write the key binding to.
-        - tupl:    tuple     - a tuple with the values of the
-                                 keybinding (gtk.TreeStore model columns)
-        """
-
-        prefs.writelines("   keyB.removeByHandler(script.inputEventHandlers['" \
-                         + str(tupl[HANDLER])+"'])\n")
-        if not (tupl[TEXT1] or tupl[TEXT2]):
-            prefs.writelines("   keyB.add(orca.keybindings.KeyBinding(\n")
-            prefs.writelines("      '',\n")
-            prefs.writelines("      %d,\n" % settings.defaultModifierMask)
-            prefs.writelines("      0,\n")
-            prefs.writelines('      script.inputEventHandlers["' + \
-                             str(tupl[HANDLER]) +'"]))\n\n')
-
-        if (tupl[TEXT1]):
-            prefs.writelines("   keyB.add(orca.keybindings.KeyBinding(\n")
-            prefs.writelines("      '" + str(tupl[KEY1]) + "',\n")
-            if tupl[MOD_MASK1] or tupl[MOD_USED1]:
-                prefs.writelines("      " + str(tupl[MOD_MASK1]) + ",\n")
-                prefs.writelines("      " + str(tupl[MOD_USED1]) + ",\n")
-            else:
-                prefs.writelines("      0,\n")
-                prefs.writelines("      0,\n")
-            if (tupl[CLICK_COUNT1] == "1"):
-                prefs.writelines('      script.inputEventHandlers["' + \
-                                 str(tupl[HANDLER]) +'"]))\n\n')
-            else:
-                prefs.writelines('      script.inputEventHandlers["' + \
-                                 str(tupl[HANDLER]) +'"],\n')
-                prefs.writelines("      " + str(tupl[CLICK_COUNT1])  + \
-                                 "))\n\n")
-
-        if (tupl[TEXT2]):
-            prefs.writelines("   keyB.add(orca.keybindings.KeyBinding(\n")
-            prefs.writelines("      '" + str(tupl[KEY2]) + "',\n")
-            if tupl[MOD_MASK2] or tupl[MOD_USED2]:
-                prefs.writelines("      " + str(tupl[MOD_MASK2]) + ",\n")
-                prefs.writelines("      " + str(tupl[MOD_USED2]) + ",\n")
-            else:
-                prefs.writelines("      %d,\n" % settings.defaultModifierMask)
-                prefs.writelines("      0,\n")
-            if (tupl[CLICK_COUNT2] == "1"):
-                prefs.writelines('      script.inputEventHandlers["' + \
-                                 str(tupl[HANDLER]) +'"]))\n\n')
-            else:
-                prefs.writelines('      script.inputEventHandlers["' + \
-                                 str(tupl[HANDLER]) +'"],\n')
-                prefs.writelines("      " + str(tupl[CLICK_COUNT2])  + \
-                                 "))\n\n")
-
-    def _writeKeyBindingsPostamble(self, prefs):
-        """Writes the postamble to the user-settings.py keyBindings section."""
-
-        prefs.writelines('   return keyB')
-        prefs.writelines("\n\n")
-        prefs.writelines( \
-            'orca.settings.overrideKeyBindings = overrideKeyBindings')
-        prefs.writelines("\n")
-
-    def _iterateKeyBindings(self, prefs, treeModel):
-        """Iterate over all the key bindings in the tree model and write
-        out all that the user has modified.
-        """
-
-        thisIter = treeModel.get_iter_first()
-        while thisIter != None:
-            iterChild = treeModel.iter_children(thisIter)
-            while iterChild != None:
-                values = treeModel.get(iterChild,
-                                       0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
-                if values[MODIF]:
-                    self._writeKeyBinding(prefs, values)
-                iterChild = treeModel.iter_next(iterChild)
-            thisIter = treeModel.iter_next(thisIter)
-
-    def _writeKeyBindingsMap(self, prefs, treeModel):
-        """Write to configuration file 'prefs' the key bindings passed in the
-        model treeModel.
-        """
-
-        self._writeKeyBindingsPreamble(prefs)
-        self._iterateKeyBindings(prefs, treeModel)
-        self._writeKeyBindingsPostamble(prefs)
-
-    def _writePronunciationsPreamble(self, prefs):
-        """Writes the preamble to the  ~/.orca/user-settings.py
-        pronunciations section."""
-
-        prefs.writelines("\n")
-        prefs.writelines( \
-            "# User customized pronunciation dictionary settings\n")
-        prefs.writelines("#\n")
-        prefs.writelines("import orca.pronunciation_dict\n\n")
-        prefs.writelines("orca.pronunciation_dict.pronunciation_dict={}\n")
-
-    def _writePronunciation(self, prefs, word, value):
-        """Write out a single pronunciation entry to the 
-        ~/.orca/user-setting.py settings file.
-
-        Arguments:
-        - prefs: file handle for user preferences.
-        - word: the actual word to be pronunced.
-        - value: the replacement string to use.
-        """
-
-        prefs.writelines("orca.pronunciation_dict.setPronunciation(" + \
-                         repr(word) + ", " + repr(value) + ")\n")
-
-    def _iteratePronunciations(self, prefs, treeModel):
-        """Iterate over each of the entries in the tree model and write out
-        a pronunciation diction entry for them.  If any strings with an
-        actual string of "" are found, they are ignored.
-        """
-
-        thisIter = treeModel.get_iter_first()
-        while thisIter != None:
-            values = treeModel.get(thisIter, ACTUAL, REPLACEMENT)
-            word = values[ACTUAL]
-            value = values[REPLACEMENT]
-
-            if word != "":
-                self._writePronunciation(prefs, word, value)
-
-            thisIter = treeModel.iter_next(thisIter)
-
-    def _writePronunciationMap(self, prefs, treeModel):
-        """Write to configuration file 'prefs' the new pronunciation dictionary
-        entries passed in the model treeModel.
-
-        Arguments:
-        - prefs: file handle for application preferences.
-        - treeModel: pronunciation dictionary tree model.
-        """
-
-        self._writePronunciationsPreamble(prefs)
-        self._iteratePronunciations(prefs, treeModel)
-
     def _setupPreferencesDirs(self):
         """Creates the directories and standard files to hold user 
         preferences."""
@@ -915,27 +712,6 @@ class OrcaPrefs():
 
         self._setupPreferencesDirs()
         
-        #self._writePreferencesPreamble(prefs)
-
-        # Only userCustomizableSettings will be stored in gconf
-        #for key in settings.userCustomizableSettings:
-        #    value = self._getValueForKey(self.prefsDict, key)
-        #    if value != None:
-        #        prefs.writelines("orca.settings.%s = %s\n" % (key, value))
-
-        #if self.keyBindingsTreeModel:
-        #    self._writeKeyBindingsMap(prefs, self.keyBindingsTreeModel)
-
-        #if self.pronunciationTreeModel:
-        #    self._writePronunciationMap(prefs, self.pronunciationTreeModel)
-
-        #self._writePreferencesPostamble(prefs)
-        #prefs.close()
-
-        # Return True if this caused accessibility to be enabled
-        # as a result of this call.
-        #
-
         # JD -> JH: Another sanity check: self.prefsDict['activeProfile']
         # might exist with a value of None.
         #
@@ -1031,11 +807,6 @@ class OrcaPrefs():
         from orca import acss
         orca.debug.debugLevel = orca.debug.LEVEL_SEVERE
        
-        if False:
-            import sys
-            sys.settrace(orca.debug.traceit)
-            orca.debug.debugLevel = orca.debug.LEVEL_ALL
-
         # Load settings in userCustomizableSettings
         #
         for key in settings.userCustomizableSettings:



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