[PATCH 2/2] Replace the last layout instead of removing (KeyboardSpoke)

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

 



---
 pyanaconda/ui/gui/spokes/keyboard.py |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 30b7925..a8fb5c9 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -23,7 +23,7 @@ import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 N_ = lambda x: x
 
-from gi.repository import Gtk, AnacondaWidgets
+from gi.repository import Gtk, GLib, AnacondaWidgets
 
 from pyanaconda.ui.gui import UIObject
 from pyanaconda.ui.gui.spokes import NormalSpoke
@@ -110,6 +110,10 @@ class KeyboardSpoke(NormalSpoke):
     icon = "accessories-character-map"
     title = N_("KEYBOARD")
 
+    def __init__(self, *args):
+        NormalSpoke.__init__(self, *args)
+        self._remove_last_attempt = False
+
     def apply(self):
         pass
 
@@ -165,6 +169,9 @@ class KeyboardSpoke(NormalSpoke):
                 if item in dialog.chosen_layouts:
                     duplicates.add(item)
                 itr = self._store.iter_next(itr)
+            if self._remove_last_attempt:
+                self._store.remove(self._store.get_iter_first())
+                self._remove_last_attempt = False
             for layout in dialog.chosen_layouts:
                 if layout not in duplicates:
                     self._addLayout(self._store, layout)
@@ -181,8 +188,12 @@ class KeyboardSpoke(NormalSpoke):
             itr2 = store.iter_next(itr2)
             if itr2: #next one existing
                 selection.select_iter(itr2)
-            #nothing left to be selected
-            store.remove(itr)
+                store.remove(itr)
+                return
+            #nothing left, run AddLayout dialog to replace the current layout
+            self._remove_last_attempt = True
+            add_button = self.builder.get_object("addLayoutButton")
+            GLib.idle_add(self.on_add_clicked, add_button)
             return
 
         #the selected item is not the first, select the previous one
-- 
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