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

[PATCH 2/4] Add chosen layout



---
 pyanaconda/ui/gui/spokes/keyboard.py |   19 ++++++++++++++-
 pyanaconda/ui/gui/spokes/keyboard.ui |   39 ++++++++++++++--------------------
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 3e502b4..4dc64ef 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -49,8 +49,15 @@ class AddLayoutDialog(UIObject):
         self.window.destroy()
         return rc
 
+    @property
+    def chosen_layout(self):
+        return self._chosen_layout
+
     def on_confirm_add_clicked(self, *args):
-        print "ADDING LAYOUT"
+        treeview = self.builder.get_object("newLayoutView")
+        selection = treeview.get_selection()
+        (model, itr) = selection.get_selected()
+        self._chosen_layout = model[itr][0]
 
     def on_cancel_clicked(self, *args):
         print "CANCELING"
@@ -110,7 +117,15 @@ class KeyboardSpoke(NormalSpoke):
         dialog = AddLayoutDialog(self.data)
         dialog.setup()
         dialog.populate()
-        print "RESPONSE = %s" % dialog.run()
+        response = dialog.run()
+        if response == 1:
+            found = False
+            itr = self._store.get_iter_first()
+            while itr and not found:
+                found = self._store[itr][0] == dialog.chosen_layout
+                itr = self._store.iter_next(itr)
+            if not found:
+                self._addLayout(self._store, dialog.chosen_layout)
 
     def on_remove_clicked(self, button):
         selection = self.builder.get_object("layoutSelection")
diff --git a/pyanaconda/ui/gui/spokes/keyboard.ui b/pyanaconda/ui/gui/spokes/keyboard.ui
index f8bc067..0a8179b 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.ui
+++ b/pyanaconda/ui/gui/spokes/keyboard.ui
@@ -23,7 +23,6 @@
             <child>
               <object class="GtkButton" id="cancelButton">
                 <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -40,7 +39,6 @@
             <child>
               <object class="GtkButton" id="confirmAddButton">
                 <property name="label">gtk-add</property>
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -111,19 +109,18 @@
                       <object class="GtkTreeSelection" id="newLayoutSelection"/>
                     </child>
                     <child>
-                          <object class="GtkTreeViewColumn" id="name">
-                            <property name="title" translatable="yes">Name</property>
-                            <property name="expand">True</property>
-                            <property name="clickable">True</property>
-                            <property name="sort_column_id">0</property>
-                            <child>
-                              <object class="GtkCellRendererText" id="newLayoutRenderer">
-                              </object>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
-                            </child>
-                          </object>
+                      <object class="GtkTreeViewColumn" id="name">
+                        <property name="title" translatable="yes">Name</property>
+                        <property name="expand">True</property>
+                        <property name="clickable">True</property>
+                        <property name="sort_column_id">0</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="newLayoutRenderer"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
                     </child>
                   </object>
                 </child>
@@ -158,7 +155,7 @@
     </child>
     <action-widgets>
       <action-widget response="0">cancelButton</action-widget>
-      <action-widget response="0">confirmAddButton</action-widget>
+      <action-widget response="1">confirmAddButton</action-widget>
     </action-widgets>
   </object>
   <object class="GtkListStore" id="addedLayoutStore">
@@ -187,6 +184,8 @@
         <child internal-child="nav_area">
           <object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
             <property name="can_focus">False</property>
+            <property name="n_rows">2</property>
+            <property name="n_columns">2</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -248,7 +247,7 @@ any layout to the top of the list to select it as the default.</property>
                                   <object class="GtkTreeSelection" id="treeview-selection"/>
                                 </child>
                                 <child>
-                                  <object class="GtkTreeViewColumn" id="name">
+                                  <object class="GtkTreeViewColumn" id="name1">
                                     <property name="title" translatable="yes">name</property>
                                     <property name="expand">True</property>
                                     <property name="clickable">True</property>
@@ -278,7 +277,6 @@ any layout to the top of the list to select it as the default.</property>
                             <property name="layout_style">start</property>
                             <child>
                               <object class="GtkButton" id="addLayoutButton">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
@@ -294,7 +292,6 @@ any layout to the top of the list to select it as the default.</property>
                             </child>
                             <child>
                               <object class="GtkButton" id="removeLayoutButton">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
@@ -310,7 +307,6 @@ any layout to the top of the list to select it as the default.</property>
                             </child>
                             <child>
                               <object class="GtkButton" id="upButton">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
@@ -326,7 +322,6 @@ any layout to the top of the list to select it as the default.</property>
                             </child>
                             <child>
                               <object class="GtkButton" id="downButton">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
@@ -342,7 +337,6 @@ any layout to the top of the list to select it as the default.</property>
                             </child>
                             <child>
                               <object class="GtkButton" id="settingsButton">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
@@ -421,7 +415,6 @@ any layout to the top of the list to select it as the default.</property>
                         <child>
                           <object class="GtkButton" id="optionsButton">
                             <property name="label" translatable="yes">_Options...</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
-- 
1.7.4.4


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