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 > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 04-23-2012, 05:18 PM
Chris Lumens
 
Default Add layout preview functionality to the KeyboardSpoke

> @@ -239,8 +240,18 @@ class KeyboardSpoke(NormalSpoke):
> store.swap(cur, nxt)
> selection.emit("changed")
>
> - def on_settings_clicked(self, button):
> - pass
> + def on_preview_clicked(self, button):
> + selection = self.builder.get_object("layoutSelection")
> + (store, cur) = selection.get_selected()
> + layout_description = store[cur]
> + layout_name = self._xkl_wrapper.description_to_name.get(layout_d escription, None)
> + if not layout_name:
> + return
> +
> + dialog = Gkbd.KeyboardDrawing.dialog_new()
> + Gkbd.KeyboardDrawing.dialog_set_layout(dialog, self._xkl_wrapper.configreg,
> + layout_name)
> + dialog.show_all()
>
> def on_selection_changed(self, *args):
> self.layout_selection_changed(self.builder.get_obj ect("layoutSelection"))

I believe you want to write this in a lightbox.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-24-2012, 07:28 AM
Vratislav Podzimek
 
Default Add layout preview functionality to the KeyboardSpoke

On Mon, 2012-04-23 at 13:18 -0400, Chris Lumens wrote:
> > @@ -239,8 +240,18 @@ class KeyboardSpoke(NormalSpoke):
> > store.swap(cur, nxt)
> > selection.emit("changed")
> >
> > - def on_settings_clicked(self, button):
> > - pass
> > + def on_preview_clicked(self, button):
> > + selection = self.builder.get_object("layoutSelection")
> > + (store, cur) = selection.get_selected()
> > + layout_description = store[cur]
> > + layout_name = self._xkl_wrapper.description_to_name.get(layout_d escription, None)
> > + if not layout_name:
> > + return
> > +
> > + dialog = Gkbd.KeyboardDrawing.dialog_new()
> > + Gkbd.KeyboardDrawing.dialog_set_layout(dialog, self._xkl_wrapper.configreg,
> > + layout_name)
> > + dialog.show_all()
> >
> > def on_selection_changed(self, *args):
> > self.layout_selection_changed(self.builder.get_obj ect("layoutSelection"))
>
> I believe you want to write this in a lightbox.
Good point, thanks. I will send a new lightbox-including patch.

--
Vratislav Podzimek <vpodzime@redhat.com>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-25-2012, 01:29 PM
Vratislav Podzimek
 
Default Add layout preview functionality to the KeyboardSpoke

---
anaconda.spec.in | 2 ++
pyanaconda/ui/gui/spokes/keyboard.py | 25 +++++++++++++++++++------
pyanaconda/ui/gui/spokes/keyboard.ui | 8 ++++----
3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/anaconda.spec.in b/anaconda.spec.in
index 1c2e1d5..e889ccd 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -63,6 +63,7 @@ BuildRequires: libXt-devel
BuildRequires: libXxf86misc-devel
BuildRequires: libblkid-devel >= %{libblkidver}
BuildRequires: libcurl-devel
+BuildRequires: libgnomekbd-devel
BuildRequires: libnl-devel >= %{libnlver}
BuildRequires: libselinux-devel >= %{libselinuxver}
BuildRequires: libsepol-devel
@@ -137,6 +138,7 @@ Requires: pytz
Requires: libxklavier
#libxklavier requires iso-codes, but does not have it as Requires: (see #813833)
Requires: iso-codes
+Requires: libgnomekbd
%ifarch %livearches
Requires: usermode
Requires: zenity
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 7269dda..c6a8361 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -24,7 +24,7 @@ import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
N_ = lambda x: x

-from gi.repository import GLib, AnacondaWidgets
+from gi.repository import GLib, AnacondaWidgets, Gkbd

from pyanaconda.ui.gui import UIObject
from pyanaconda.ui.gui.spokes import NormalSpoke
@@ -39,9 +39,9 @@ class AddLayoutDialog(UIObject):
mainWidgetName = "addLayoutDialog"
uiFile = "spokes/keyboard.ui"

- def __init__(self, *args):
+ def __init__(self, xkl_wrapper, *args):
+ self._xkl_wrapper = xkl_wrapper
UIObject.__init__(self, *args)
- self._xkl_wrapper = xklavier.XklWrapper()

def matches_entry(self, model, itr, user_data=None):
value = model.get_value(itr, 0)
@@ -116,6 +116,7 @@ class KeyboardSpoke(NormalSpoke):
def __init__(self, *args):
NormalSpoke.__init__(self, *args)
self._remove_last_attempt = False
+ self._xkl_wrapper = xklavier.XklWrapper()

def apply(self):
self.data.keyboard.keyboard = None
@@ -159,7 +160,7 @@ class KeyboardSpoke(NormalSpoke):

# Signal handlers.
def on_add_clicked(self, button):
- dialog = AddLayoutDialog(self.data)
+ dialog = AddLayoutDialog(self._xkl_wrapper, self.data)
dialog.refresh()
dialog.initialize()

@@ -241,8 +242,20 @@ class KeyboardSpoke(NormalSpoke):
store.swap(cur, nxt)
selection.emit("changed")

- def on_settings_clicked(self, button):
- pass
+ def on_preview_clicked(self, button):
+ selection = self.builder.get_object("layoutSelection")
+ (store, cur) = selection.get_selected()
+ layout_description = store[cur]
+ layout_name = self._xkl_wrapper.description_to_name.get(layout_d escription, None)
+ if not layout_name:
+ return
+
+ dialog = Gkbd.KeyboardDrawing.dialog_new()
+ Gkbd.KeyboardDrawing.dialog_set_layout(dialog, self._xkl_wrapper.configreg,
+ layout_name)
+ with enlightbox(self.window, dialog):
+ dialog.show_all()
+ dialog.run()

def on_selection_changed(self, *args):
self.layout_selection_changed(self.builder.get_obj ect("layoutSelection"))
diff --git a/pyanaconda/ui/gui/spokes/keyboard.ui b/pyanaconda/ui/gui/spokes/keyboard.ui
index 4375cfc..7b8382b 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.ui
+++ b/pyanaconda/ui/gui/spokes/keyboard.ui
@@ -351,8 +351,8 @@ any layout to the top of the list to select it as the default.</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
- <property name="image">settingsImage</property>
- <signal name="clicked" handler="on_settings_clicked" swapped="no"/>
+ <property name="image">previewImage</property>
+ <signal name="clicked" handler="on_preview_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -479,10 +479,10 @@ any layout to the top of the list to select it as the default.</property>
<property name="can_focus">False</property>
<property name="icon_name">list-remove-symbolic</property>
</object>
- <object class="GtkImage" id="settingsImage">
+ <object class="GtkImage" id="previewImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">system-run-symbolic</property>
+ <property name="icon_name">input-keyboard-symbolic</property>
</object>
<object class="GtkImage" id="upImage">
<property name="visible">True</property>
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-25-2012, 01:59 PM
Chris Lumens
 
Default Add layout preview functionality to the KeyboardSpoke

> anaconda.spec.in | 2 ++
> pyanaconda/ui/gui/spokes/keyboard.py | 25 +++++++++++++++++++------
> pyanaconda/ui/gui/spokes/keyboard.ui | 8 ++++----
> 3 files changed, 25 insertions(+), 10 deletions(-)

This looks better. Thanks.

- 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 08:49 AM.

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