[orca/new-settings] We should only attempt to access the Profiles-related widgets if the backend is Profiles capable.



commit a9ce615331da8f4e4b92c84e440cc255e5d39816
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Oct 14 15:29:39 2010 +0200

    We should only attempt to access the Profiles-related widgets
    if the backend is Profiles capable.

 src/orca/orca_gui_prefs.py |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 39a2661..e6e08da 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -145,6 +145,8 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         self.prefsDict = prefsDict
         self.enableLiveUpdating = settings.enableMagLiveUpdating
 
+        self._profilesCapable = _settingsManager.DEFAULT_BACKEND != 'classic'
+
         # Initialize variables to None to keep pylint happy.
         #
         self.bbindings = None
@@ -2202,6 +2204,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         
         # Orca User Profiles
         #
+        if not self._profilesCapable:
+            self.get_widget("profilesVbox").hide()
+            return
+
         self.profilesCombo = self.get_widget('availableProfilesComboBox')
         self.startingProfileCombo = self.get_widget('availableProfilesComboBox2')
         self.profilesComboModel = self.get_widget('model9')
@@ -2210,6 +2216,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
     def __initProfileCombo(self):
         """Adding available profiles and setting active as the active one"""
 
+        if not self._profilesCapable:
+            return
+
         availableProfiles = self.__getAvailableProfiles()
         self.profilesComboModel.clear()
 
@@ -2231,11 +2240,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         self.startingProfileCombo.set_active(startingProfileIter)
 
     def __getAvailableProfiles(self):
-        """Get available user profiles or remove profiles page
-        if classic backend"""
+        """Get available user profiles."""
 
-        if _settingsManager.DEFAULT_BACKEND == 'classic':
-            self.get_widget("profilesVbox").hide()
+        if not self._profilesCapable:
             return ['Default', 'default']
         else:
             return _settingsManager.availableProfiles()
@@ -4348,11 +4355,12 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
                 settings.SYSTEM_VOICE    : acss.ACSS(self.systemVoice),
             }
 
-        activeProfile = self.getComboBoxList(self.profilesCombo)
-        startingProfile = self.getComboBoxList(self.startingProfileCombo) 
+        if self._profilesCapable:
+            activeProfile = self.getComboBoxList(self.profilesCombo)
+            startingProfile = self.getComboBoxList(self.startingProfileCombo) 
 
-        self.prefsDict['activeProfile'] = activeProfile
-        self.prefsDict['startingProfile'] = startingProfile
+            self.prefsDict['activeProfile'] = activeProfile
+            self.prefsDict['startingProfile'] = startingProfile
 
         settings.setGKSUGrabDisabled(self.disableKeyGrabPref)
 



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