FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 01-30-2012, 12:48 PM
Vratislav Podzimek
 
Default Replace the last layout instead of removing (KeyboardSpoke)

---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-31-2012, 03:56 PM
Chris Lumens
 
Default 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
 
Old 02-01-2012, 12:50 PM
Vratislav Podzimek
 
Default 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
 
Old 02-01-2012, 06:43 PM
Chris Lumens
 
Default 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
 

Thread Tools




All times are GMT. The time now is 01:48 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org