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 Hardened

 
 
LinkBack Thread Tools
 
Old 05-17-2012, 01:11 PM
Vratislav Podzimek
 
Default Add property generating xorg.conf.d file to the keyboard command

---
pykickstart/commands/keyboard.py | 57 ++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/pykickstart/commands/keyboard.py b/pykickstart/commands/keyboard.py
index c5f67bc..0277b87 100644
--- a/pykickstart/commands/keyboard.py
+++ b/pykickstart/commands/keyboard.py
@@ -91,3 +91,60 @@ class F18_Keyboard(FC3_Keyboard):
@keyboard.setter
def keyboard(self, value):
self.layouts_list = [value]
+
+ #code from the pyanaconda.xklavier
+ def _parse_layout_variant(self, layout):
+ """
+ Parse layout and variant from the string that may look like 'layout' or
+ 'layout (variant)'.
+
+ @return: the (layout, variant) pair, where variant can be ""
+ @rtype: tuple
+
+ """
+
+ variant = ""
+
+ lbracket_idx = layout.find("(")
+ rbracket_idx = layout.rfind(")")
+ if lbracket_idx != -1:
+ variant = layout[(lbracket_idx + 1) : rbracket_idx]
+ layout = layout[:lbracket_idx].strip()
+
+ return (layout, variant)
+
+ # pylint: disable-msg=E0202
+ @property
+ def xorg_conf(self):
+ layouts = list()
+ variants = list()
+
+ for layout_variant in self.layouts_list:
+ (layout, variant) = self._parse_layout_variant(layout_variant)
+ layouts.append(layout)
+ variants.append(variant)
+
+ #section header
+ ret = 'Section "InputClass"
'
+ ' Identifier "kickstart"
'
+ ' MatchIsKeyboard "on"
'
+
+ #layouts
+ ret += ' Option "XkbLayout" '
+ ret += '"' + ','.join(layouts) + '"
'
+
+ #variants
+ ret += ' Option "XkbVariant" '
+ ret += '"' + ','.join(variants) + '"
'
+
+ #switching
+ #TODO: add option for switching combination
+ #for now, let's default to Alt+Shift
+ ret += ' Option "XkbOptions" '
+ ret += '"grp:alt_shift_toggle"
'
+
+ #section footer
+ ret += 'EndSection'
+
+ return ret
+
--
1.7.4.4

_______________________________________________
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 10:52 PM.

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