[orca/new-settings] Changed the Profiles tab controls and the related dialogs



commit 828668c683db4315106cadcadf284648ff188ad1
Author: Javier Hernández <javiube gmail com>
Date:   Tue Aug 10 16:43:21 2010 +0200

    Changed the Profiles tab controls and the related dialogs

 src/orca/orca-profile.ui     |   51 +------------------
 src/orca/orca-setup.ui       |  112 +++++++++++++-----------------------------
 src/orca/orca_gui_prefs.py   |   28 ++++++++++-
 src/orca/orca_gui_profile.py |   18 +------
 4 files changed, 65 insertions(+), 144 deletions(-)
---
diff --git a/src/orca/orca-profile.ui b/src/orca/orca-profile.ui
index 8a28f5f..779bf23 100644
--- a/src/orca/orca-profile.ui
+++ b/src/orca/orca-profile.ui
@@ -23,52 +23,6 @@
             <property name="border_width">6</property>
             <property name="spacing">12</property>
             <child>
-              <object class="GtkHBox" id="hbox2">
-                <property name="visible">True</property>
-                <property name="border_width">6</property>
-                <child>
-                  <object class="GtkLabel" id="ProfilesLabel">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">_Profiles:</property>
-                    <property name="use_markup">True</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">availableProfilesCombo</property>
-                    <property name="width_chars">12</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="ProfilesLabel-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">New Profile:</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="availableProfilesCombo">
-                    <property name="visible">True</property>
-                    <property name="model">liststore1</property>
-                    <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
-                      <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>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkHBox" id="hbox1">
                 <property name="visible">True</property>
                 <property name="border_width">6</property>
@@ -103,7 +57,6 @@
                         <property name="AtkObject::accessible-name" translatable="yes">New Profile:</property>
                       </object>
                     </child>
-                    <signal name="changed" handler="onProfileEntryChanged"/>
                   </object>
                   <packing>
                     <property name="position">1</property>
@@ -111,7 +64,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
@@ -122,7 +75,7 @@ automatically and preferences
 dialog will be closed.</property>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 92d9e09..df5b4ce 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="magCrossHairSizeLabel"/>
                                                             <relation type="labelled-by" target="magCrossHairSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCrossHairSizeLabel"/>
                                                             </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="magCursorSizeLabel"/>
                                                             <relation type="labelled-by" target="magCursorSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCursorSizeLabel"/>
                                                             </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="magEdgeMarginUnitsLabel"/>
                                                       <relation type="labelled-by" target="magEdgeMarginLabel"/>
+                                                      <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
                                                     </accessibility>
                                                     <signal name="value_changed" handler="magEdgeMarginValueChanged"/>
                                                   </object>
@@ -4081,33 +4081,14 @@ attributes&lt;/b&gt;</property>
                             <property name="top_padding">5</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkTable" id="userProfilesTable1">
+                              <object class="GtkHBox" id="hbox2">
                                 <property name="visible">True</property>
-                                <property name="n_rows">3</property>
-                                <property name="n_columns">2</property>
-                                <property name="column_spacing">10</property>
+                                <property name="spacing">5</property>
                                 <child>
-                                  <object class="GtkComboBox" id="availableProfilesComboBox">
-                                    <property name="visible">True</property>
-                                    <property name="model">model9</property>
-                                    <child>
-                                      <object class="GtkCellRendererText" id="cellrenderertext3"/>
-                                      <attributes>
-                                        <attribute name="text">0</attribute>
-                                      </attributes>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel" id="availableProfilesLabel">
+                                  <object class="GtkLabel" id="profilesLabel">
                                     <property name="visible">True</property>
                                     <property name="xalign">1</property>
-                                    <property name="label" translatable="yes">Available Profiles:</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>
@@ -4116,79 +4097,56 @@ attributes&lt;/b&gt;</property>
                                     </accessibility>
                                   </object>
                                   <packing>
-                                    <property name="x_options">GTK_FILL</property>
-                                    <property name="y_options"></property>
+                                    <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="GtkLabel" id="saveProfileLabel">
+                                  <object class="GtkComboBox" id="availableProfilesComboBox">
                                     <property name="visible">True</property>
-                                    <property name="xalign">1</property>
-                                    <property name="label" translatable="yes">Save profile as:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="justify">right</property>
-                                    <property name="mnemonic_widget">saveProfileButton</property>
-                                    <accessibility>
-                                      <relation type="label-for" target="speechSystems"/>
-                                    </accessibility>
+                                    <property name="model">model9</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                                      <attributes>
+                                        <attribute name="text">0</attribute>
+                                      </attributes>
+                                    </child>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">2</property>
-                                    <property name="bottom_attach">3</property>
-                                    <property name="x_options">GTK_FILL</property>
-                                    <property name="y_options"></property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkButton" id="saveProfileButton">
-                                    <property name="label">gtk-save</property>
+                                  <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>
-                                    <property name="use_stock">True</property>
-                                    <signal name="clicked" handler="showProfileGUI"/>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="top_attach">2</property>
-                                    <property name="bottom_attach">3</property>
-                                    <property name="x_options">GTK_FILL</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel" id="loadProfileLabel">
-                                    <property name="visible">True</property>
-                                    <property name="xalign">1</property>
-                                    <property name="label" translatable="yes">Load selected profile:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="justify">right</property>
-                                    <property name="mnemonic_widget">loadProfileButton</property>
-                                    <accessibility>
-                                      <relation type="label-for" target="speechSystems"/>
-                                    </accessibility>
+                                    <signal name="clicked" handler="loadProfileButtonClicked"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
-                                    <property name="y_options"></property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">2</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkButton" id="loadProfileButton">
-                                    <property name="label" translatable="yes">Load</property>
+                                  <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>
-                                    <signal name="clicked" handler="loadProfileButtonClicked"/>
+                                    <property name="use_stock">True</property>
+                                    <signal name="clicked" handler="showProfileGUI"/>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">3</property>
                                   </packing>
                                 </child>
                               </object>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 508c617..74d42f8 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -2188,7 +2188,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         # 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> <i>(Using <b>%s</b> profile)</i>' % activeProfile)
+            self.get_widget('userProfilesLabel').set_markup('<b>Orca User Profiles:</b> (Using <b>%s</b> profile)' % activeProfile)
         
         self.profilesCombo.set_active(activeProfileItem)
 
@@ -2202,7 +2202,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         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> <i>(Not available in classic backend!)</i>')
+            self.get_widget('userProfilesLabel').set_markup('<b>Orca User Profiles</b> (Not available in classic backend!)')
             return ['default']
         else:
             return _settingsManager.availableProfiles()
@@ -4385,6 +4385,30 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             self.okButtonClicked()
 
     def loadProfileButtonClicked(self, widget):
+        """Load profile button clicked handler"""
+
+        # First of all, we give a chance of cancel profile change
+        message = "You are about to change the active profile. If you\n" + \
+                  "have just make changes in your preferences, it will\n" + \
+                  "be dropped at profile load\n\n" + \
+                  "Continue loading profile discarding previous changes?"
+
+        dialog = gtk.MessageDialog(None,
+                gtk.DIALOG_MODAL,
+                type=gtk.MESSAGE_INFO,
+                buttons=gtk.BUTTONS_YES_NO)
+
+        dialog.set_markup("<b>Load user profile info</b>")
+        dialog.format_secondary_markup(message)
+        response = dialog.run()
+
+        if response == gtk.RESPONSE_YES:
+            dialog.destroy()
+            self.loadSelectedProfile()
+        else:
+            dialog.destroy()
+
+    def loadSelectedProfile(self):
         """Load selected profile"""
 
         print 'loading profile!'
diff --git a/src/orca/orca_gui_profile.py b/src/orca/orca_gui_profile.py
index 1c5ffab..4831cac 100644
--- a/src/orca/orca_gui_profile.py
+++ b/src/orca/orca_gui_profile.py
@@ -99,19 +99,6 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
         except:
             pass
 
-        # Fill available profiles in combobox
-        profilesCombo = self.get_widget('availableProfilesCombo')
-        profilesComboModel = self.get_widget('liststore1')
-        availableProfiles = self.__getAvailableProfiles()
-        iterChilds = {}
-
-        if not len(availableProfiles):
-            iterChilds.update({'default' : profilesComboModel.append(['default'])})
-        else:
-            for profile in availableProfiles:
-                iterChilds.update({profile: profilesComboModel.append([profile])})
-
-
         profileDialog.run()
 
     def closeButtonClicked(self, widget):
@@ -140,11 +127,10 @@ class OrcaProfileGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         if self.get_widget("profileEntry").get_text() != '':
             newProfile = self.get_widget("profileEntry").get_text()
-        else:
-            newProfile = self.get_widget("availableProfilesCombo").get_active_text()
+            self.get_widget("profileDialog").destroy()
 
-        self.get_widget("profileDialog").destroy()
 
+    # From now, this method can't have sense ...
     def onProfileEntryChanged(self, widget, data=None):
         """Signal handler for the "changed" signal for the ProfileEntry
            GtkEntry widget."""



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