[PATCH 1/2] Allow to add multiple layouts at once (KeyboardSpoke)

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

 



---
 pyanaconda/ui/gui/spokes/keyboard.py |   24 +++++++++++++++---------
 pyanaconda/ui/gui/spokes/keyboard.ui |    4 +++-
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 8e9e56d..30b7925 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -75,14 +75,17 @@ class AddLayoutDialog(UIObject):
         return rc
 
     @property
-    def chosen_layout(self):
-        return self._chosen_layout
+    def chosen_layouts(self):
+        return self._chosen_layouts
 
     def on_confirm_add_clicked(self, *args):
         treeview = self.builder.get_object("newLayoutView")
         selection = treeview.get_selection()
-        (model, itr) = selection.get_selected()
-        self._chosen_layout = model[itr][0]
+        (store, pathlist) = selection.get_selected_rows()
+        self._chosen_layouts = []
+        for path in pathlist:
+            itr = store.get_iter(path)
+            self._chosen_layouts.append(store[itr][0])
 
     def on_cancel_clicked(self, *args):
         print "CANCELING"
@@ -155,13 +158,16 @@ class KeyboardSpoke(NormalSpoke):
         response = dialog.run()
         lightbox.destroy()
         if response == 1:
-            found = False
+            duplicates = set()
             itr = self._store.get_iter_first()
-            while itr and not found:
-                found = self._store[itr][0] == dialog.chosen_layout
+            while itr:
+                item = self._store[itr][0]
+                if item in dialog.chosen_layouts:
+                    duplicates.add(item)
                 itr = self._store.iter_next(itr)
-            if not found:
-                self._addLayout(self._store, dialog.chosen_layout)
+            for layout in dialog.chosen_layouts:
+                if layout not in duplicates:
+                    self._addLayout(self._store, 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 c471287..6fd9bfd 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.ui
+++ b/pyanaconda/ui/gui/spokes/keyboard.ui
@@ -110,7 +110,9 @@
                     <property name="headers_visible">False</property>
                     <property name="headers_clickable">False</property>
                     <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="newLayoutSelection"/>
+                      <object class="GtkTreeSelection" id="newLayoutSelection">
+                        <property name="mode">multiple</property>
+                      </object>
                     </child>
                     <child>
                       <object class="GtkTreeViewColumn" id="name">
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux