Fix and minor changes for the layouts adding/removing
Thinking about my yesterday's patches I realized that they contain some
issues:
1) adding instead of replacing layout when user tries to remove the last
layout from the list -- we need to add new layout and then remove the old
because X don't let us to have no layout
2) label showing the layout switching keys not defaulting to Alt+Shift
When fixing 1) it appeared to be useful to create the removeLayout method.
This patch is supposed to be squashed with the PATCH 1/2 before pushing.
---
pyanaconda/ui/gui/spokes/keyboard.py | 25 +++++++++++++++++--------
pyanaconda/ui/gui/spokes/keyboard.ui | 2 +-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 6a04d6d..85fb7cd 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -185,6 +185,16 @@ class KeyboardSpoke(NormalSpoke):
store.append([name])
self._xkl_wrapper.add_layout(name)
+ def _removeLayout(self, store, itr):
+ """
+ Remove the layout specified by store iterator from the store and
+ X runtime configuration.
+
+ """
+
+ self._xkl_wrapper.remove_layout(store[itr][0])
+ store.remove(itr)
+
# Signal handlers.
def on_add_clicked(self, button):
dialog = AddLayoutDialog(self.data)
@@ -203,14 +213,15 @@ class KeyboardSpoke(NormalSpoke):
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)
+ if self._remove_last_attempt:
+ itr = self._store.get_iter_first()
+ self._removeLayout(self._store, itr)
+ self._remove_last_attempt = False
+
def on_remove_clicked(self, button):
selection = self.builder.get_object("layoutSelection")
if not selection.count_selected_rows():
@@ -223,8 +234,7 @@ class KeyboardSpoke(NormalSpoke):
itr2 = store.iter_next(itr2)
if itr2: #next one existing
selection.select_iter(itr2)
- self._xkl_wrapper.remove_layout(store[itr][0])
- store.remove(itr)
+ self._removeLayout(store, itr)
return
#nothing left, run AddLayout dialog to replace the current layout
@@ -242,8 +252,7 @@ class KeyboardSpoke(NormalSpoke):
itr2 = store.iter_next(itr2)
itr3 = store.iter_next(itr3)
def on_up_clicked(self, button):
diff --git a/pyanaconda/ui/gui/spokes/keyboard.ui b/pyanaconda/ui/gui/spokes/keyboard.ui
index b130ae6..9b50a0d 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.ui
+++ b/pyanaconda/ui/gui/spokes/keyboard.ui
@@ -409,7 +409,7 @@ any layout to the top of the list to select it as the default.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="label" translatable="yes">Shift + Caps Lock to switch layouts.</property>
+ <property name="label" translatable="yes">Alt + Shift to switch layouts.</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
--
1.7.4.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-15-2012, 02:22 PM
Chris Lumens
Fix and minor changes for the layouts adding/removing
> Thinking about my yesterday's patches I realized that they contain some
> issues:
> 1) adding instead of replacing layout when user tries to remove the last
> layout from the list -- we need to add new layout and then remove the old
> because X don't let us to have no layout
>
> 2) label showing the layout switching keys not defaulting to Alt+Shift
>
> When fixing 1) it appeared to be useful to create the removeLayout method.
> This patch is supposed to be squashed with the PATCH 1/2 before pushing.
Looks fine.
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list