[orca/new-settings] Some changes in ui around profile new features.



commit 9ac3ae1d8487b2a6f3782ccc0e21366934e6f0ab
Author: Javier Hernández <javiube gmail com>
Date:   Fri Aug 13 15:55:22 2010 +0200

    Some changes in ui around profile new features.

 src/orca/orca-setup.ui     |  146 +++++++++++++++++++-------------------------
 src/orca/orca_gui_prefs.py |   37 +++++++++--
 2 files changed, 92 insertions(+), 91 deletions(-)
---
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index df5b4ce..4f1591c 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -2625,8 +2625,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCrossHairSizeUnitsLabel"/>
                                                             <relation type="labelled-by" target="magCrossHairSizeLabel"/>
+                                                            <relation type="labelled-by" target="magCrossHairSizeUnitsLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCrossHairSizeValueChanged"/>
                                                           </object>
@@ -2829,8 +2829,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCursorSizeUnitsLabel"/>
                                                             <relation type="labelled-by" target="magCursorSizeLabel"/>
+                                                            <relation type="labelled-by" target="magCursorSizeUnitsLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCursorSizeValueChanged"/>
                                                           </object>
@@ -3408,8 +3408,8 @@
                                                     <property name="climb_rate">1</property>
                                                     <property name="numeric">True</property>
                                                     <accessibility>
-                                                      <relation type="labelled-by" target="magEdgeMarginLabel"/>
                                                       <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
+                                                      <relation type="labelled-by" target="magEdgeMarginLabel"/>
                                                     </accessibility>
                                                     <signal name="value_changed" handler="magEdgeMarginValueChanged"/>
                                                   </object>
@@ -4070,100 +4070,78 @@ attributes&lt;/b&gt;</property>
                   <object class="GtkVBox" id="profilesVbox">
                     <property name="visible">True</property>
                     <child>
-                      <object class="GtkFrame" id="userProfilesFrame">
+                      <object class="GtkHBox" id="hbox2">
                         <property name="visible">True</property>
-                        <property name="label_xalign">0</property>
-                        <property name="label_yalign">1</property>
-                        <property name="shadow_type">none</property>
+                        <property name="spacing">5</property>
                         <child>
-                          <object class="GtkAlignment" id="alignment5">
+                          <object class="GtkLabel" id="profilesLabel">
                             <property name="visible">True</property>
-                            <property name="top_padding">5</property>
-                            <property name="left_padding">12</property>
+                            <property name="xalign">1</property>
+                            <property name="label" translatable="yes">Profile:</property>
+                            <property name="use_underline">True</property>
+                            <property name="justify">right</property>
+                            <property name="mnemonic_widget">availableProfilesComboBox</property>
+                            <accessibility>
+                              <relation type="label-for" target="speechServers"/>
+                            </accessibility>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="padding">5</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="availableProfilesComboBox">
+                            <property name="visible">True</property>
+                            <property name="model">model9</property>
                             <child>
-                              <object class="GtkHBox" id="hbox2">
-                                <property name="visible">True</property>
-                                <property name="spacing">5</property>
-                                <child>
-                                  <object class="GtkLabel" id="profilesLabel">
-                                    <property name="visible">True</property>
-                                    <property name="xalign">1</property>
-                                    <property name="label" translatable="yes">Profiles:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="justify">right</property>
-                                    <property name="mnemonic_widget">availableProfilesComboBox</property>
-                                    <accessibility>
-                                      <relation type="label-for" target="speechServers"/>
-                                    </accessibility>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkComboBox" id="availableProfilesComboBox">
-                                    <property name="visible">True</property>
-                                    <property name="model">model9</property>
-                                    <child>
-                                      <object class="GtkCellRendererText" id="cellrenderertext4"/>
-                                      <attributes>
-                                        <attribute name="text">0</attribute>
-                                      </attributes>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="loadProfileButton">
-                                    <property name="label" translatable="yes">Load</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <signal name="clicked" handler="loadProfileButtonClicked"/>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="saveProfileButton">
-                                    <property name="label">gtk-save-as</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                    <signal name="clicked" handler="showProfileGUI"/>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
-                              </object>
+                              <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
                             </child>
                           </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
-                        <child type="label">
-                          <object class="GtkLabel" id="userProfilesLabel">
+                        <child>
+                          <object class="GtkButton" id="loadProfileButton">
+                            <property name="label" translatable="yes">Load</property>
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">&lt;b&gt;Orca User Profiles&lt;/b&gt;</property>
-                            <property name="use_markup">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <signal name="clicked" handler="loadProfileButtonClicked"/>
                           </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="saveProfileButton">
+                            <property name="label">gtk-save-as</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                            <signal name="clicked" handler="showProfileGUI"/>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="padding">5</property>
+                        <property name="padding">15</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 74d42f8..e84f499 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -2187,9 +2187,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         activeProfileItem = int(self.profilesComboModel.get_string_from_iter(iterChilds[activeProfile]))
 
         # If not classic backend, show active profile
-        if not 'classic' in self.get_widget('userProfilesLabel').get_text():
-            self.get_widget('userProfilesLabel').set_markup('<b>Orca User Profiles:</b> (Using <b>%s</b> profile)' % activeProfile)
-        
         self.profilesCombo.set_active(activeProfileItem)
 
         
@@ -2200,9 +2197,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         _settingsManager.loadBackend()
 
         if _settingsManager.DEFAULT_BACKEND == 'classic':
-            # If classic backend, disable profile features
-            self.get_widget('userProfilesFrame').set_sensitive(False)
-            self.get_widget('userProfilesLabel').set_markup('<b>Orca User Profiles</b> (Not available in classic backend!)')
+            self.get_widget('notebook').remove_page(8)
             return ['default']
         else:
             return _settingsManager.availableProfiles()
@@ -4374,7 +4369,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         profileToSave = orca_gui_profile.showProfileUI()
 
-        if isinstance(profileToSave, str) and profileToSave != '':
+        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])}
@@ -4383,6 +4380,31 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
             self.prefsDict['activeProfile'] = profileToSave.replace(' ','_')
             self.okButtonClicked()
+        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 response == gtk.RESPONSE_YES:
+                dialog.destroy()
+                self.prefsDict['activeProfile'] = profileToSave.replace(' ','_')
+                self.okButtonClicked()
+            else:
+                dialog.destroy()
+                
 
     def loadProfileButtonClicked(self, widget):
         """Load profile button clicked handler"""
@@ -4400,6 +4422,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         dialog.set_markup("<b>Load user profile info</b>")
         dialog.format_secondary_markup(message)
+        dialog.set_title('Load User Profile')
         response = dialog.run()
 
         if response == gtk.RESPONSE_YES:



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