diff options
author | Vratislav Podzimek <vpodzime@redhat.com> | 2012-04-23 15:59:47 +0200 |
---|---|---|
committer | Vratislav Podzimek <vpodzime@redhat.com> | 2012-04-25 15:26:28 +0200 |
commit | 01811f6ad6a1e60e14c188de5cdcb2836f49fedd (patch) | |
tree | 7d874fd1b659ca032c58ab99bf8fe5bfad200d76 | |
parent | 58af9acb166531df95e392c4841d5a897bc52e93 (diff) | |
download | anaconda-01811f6ad6a1e60e14c188de5cdcb2836f49fedd.tar.gz anaconda-01811f6ad6a1e60e14c188de5cdcb2836f49fedd.tar.xz anaconda-01811f6ad6a1e60e14c188de5cdcb2836f49fedd.zip |
Add layout preview functionality to the KeyboardSpoke
-rw-r--r-- | anaconda.spec.in | 2 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/keyboard.py | 25 | ||||
-rw-r--r-- | 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 1c2e1d59d..e889ccdee 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 7269dda01..c6a83619a 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_description, 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_object("layoutSelection")) diff --git a/pyanaconda/ui/gui/spokes/keyboard.ui b/pyanaconda/ui/gui/spokes/keyboard.ui index 4375cfc1d..7b8382b10 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> |