[orca/new-settings] Do not close preferences dialog and update profile combo with the new active oneafter a save-as-prof



commit 139d0bb2fd5697cf06f21a54592f9aa05806092e
Author: Javier Hernández <javiube gmail com>
Date:   Tue Aug 17 13:26:32 2010 +0200

    Do not close preferences dialog and update profile combo with the new active oneafter a save-as-profile event

 src/orca/orca_gui_prefs.py |   64 +++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 33 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 23ed287..935416e 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -2167,7 +2167,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         #
         self.profilesCombo = self.get_widget('availableProfilesComboBox')
         self.profilesComboModel = self.get_widget('model9')
-        self.__initProfileCombo()        
+        self.__initProfileCombo()
 
     def __initProfileCombo(self):
         """Adding available profiles and setting active as the active one"""
@@ -2182,12 +2182,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             for profile in availableProfiles:
                 iterChilds.update({profile: self.profilesComboModel.append([profile])})
 
-        # JD -> JH: It seems that 'activeProfile' is in prefs at this point
-        # but initially prefs['activeProfile'] == None, so it wasn't getting
-        # set to 'default'. That causes the symptoms Jose asked about on the
-        # list.
-        #
-        activeProfile = prefs.get('activeProfile') or 'default'
+        activeProfile = self.prefsDict.get('activeProfile') or 'default'
         activeProfileItem = int(self.profilesComboModel.get_string_from_iter(iterChilds[activeProfile]))
 
         # If not classic backend, show active profile
@@ -2195,7 +2190,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         
     def __getAvailableProfiles(self):
-        """Get available user profiles"""
+        """Get available user profiles or remove profiles page
+        if classic backend"""
+
 
         _settingsManager = SettingsManager()
         _settingsManager.loadBackend()
@@ -4294,7 +4291,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         self._populateKeyBindings()
 
-        self.__initProfileCombo() 
+        self.__initProfileCombo()
 
     def cancelButtonClicked(self, widget):
         """Signal handler for the "clicked" signal for the cancelButton
@@ -4377,7 +4374,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         if isinstance(profileToSave, str) and profileToSave != '' \
                 and not profileToSave in self.__getAvailableProfiles():
-            print 'no es un perfil ya existente'
             # If applyButtonClicked is needed, then this code will be uncommented,
             # then new profile will be stored in profileCombo
             #profile = {profileToSave: self.profilesComboModel.append([profileToSave])}
@@ -4385,31 +4381,31 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             #self.profilesCombo.set_active(activeProfile)
 
             self.prefsDict['activeProfile'] = profileToSave.replace(' ','_')
-            self.okButtonClicked()
+            self.applyButtonClicked(None)
         else:
-            # We're here because given profile name exists, so we have
-            # to give that info to the user and give him the chance
-            # to continue, or not saving the profile
-            print 'es un perfil existente'
-            message = "Profile <b>%s</b> yet exists.\n" % profileToSave + \
-                  "Continue updating existent profile with these new changes?"
-
-            dialog = gtk.MessageDialog(None,
-                    gtk.DIALOG_MODAL,
-                    type=gtk.MESSAGE_INFO,
-                    buttons=gtk.BUTTONS_YES_NO)
-    
-            dialog.set_markup("<b>User Profile Conflict!</b>")
-            dialog.format_secondary_markup(message)
-            dialog.set_title('Save Profile as conflict')
-            response = dialog.run()
+            if profileToSave != None:
+                # We're here because given profile name exists, so we have
+                # to give that info to the user and give him the chance
+                # to continue, or not saving the profile
+                message = "Profile <b>%s</b> yet exists.\n" % profileToSave + \
+                      "Continue updating existent profile with these new changes?"
     
-            if response == gtk.RESPONSE_YES:
-                dialog.destroy()
-                self.prefsDict['activeProfile'] = profileToSave.replace(' ','_')
-                self.okButtonClicked()
-            else:
-                dialog.destroy()
+                dialog = gtk.MessageDialog(None,
+                        gtk.DIALOG_MODAL,
+                        type=gtk.MESSAGE_INFO,
+                        buttons=gtk.BUTTONS_YES_NO)
+
+                dialog.set_markup("<b>User Profile Conflict!</b>")
+                dialog.format_secondary_markup(message)
+                dialog.set_title('Save Profile as conflict')
+                response = dialog.run()
+
+                if response == gtk.RESPONSE_YES:
+                    dialog.destroy()
+                    self.prefsDict['activeProfile'] = profileToSave.replace(' ','_')
+                    self.applyButtonClicked(None)
+                else:
+                    dialog.destroy()
                 
 
     def loadProfileButtonClicked(self, widget):
@@ -4495,6 +4491,8 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         self._populateKeyBindings()
 
+        self.__initProfileCombo()
+
 
 class OrcaAdvancedMagGUI(OrcaSetupGUI):
 



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