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")
@@ -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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
01-31-2012, 03:56 PM
Chris Lumens
Replace the last layout instead of removing (KeyboardSpoke)
> @@ -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)
Please add some blank lines between blocks.
> @@ -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
>
Why is the idle_add call necessary?
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-01-2012, 12:50 PM
Vratislav Podzimek
Replace the last layout instead of removing (KeyboardSpoke)
On Tue, 2012-01-31 at 11:56 -0500, Chris Lumens wrote:
> > @@ -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)
>
> Please add some blank lines between blocks.
ok
>
> > @@ -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
> >
>
> Why is the idle_add call necessary?
It is probably not necessary. I just wanted to make sure the UI redraws
correctly before invoking AddLayout dialog and it's lightbox. Should I
remove it?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-01-2012, 06:43 PM
Chris Lumens
Replace the last layout instead of removing (KeyboardSpoke)
> > Why is the idle_add call necessary?
> It is probably not necessary. I just wanted to make sure the UI redraws
> correctly before invoking AddLayout dialog and it's lightbox. Should I
> remove it?
Hm, I don't know. I'd just try it and see. I'm not objecting to it
being there. I just want to know why it's necessary.
Also, make sure to add yourself to the authors list up top. You've
probably got at least as much code in there as I do now, and most of
what I did is just boilerplate.
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list