[node-patches] Change in ovirt-node[master]: utils: Extend Keyboard class

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Dec 11 20:09:41 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: utils: Extend Keyboard class
......................................................................

utils: Extend Keyboard class

Can now save the layout

Change-Id: I7c47b8e3edc821ed2128fc540fcb8fd97b1ab73d
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/utils/__init__.py
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/51/9951/1

diff --git a/scripts/tui/src/ovirt/node/utils/__init__.py b/scripts/tui/src/ovirt/node/utils/__init__.py
index 9ce9c8d..2562030 100644
--- a/scripts/tui/src/ovirt/node/utils/__init__.py
+++ b/scripts/tui/src/ovirt/node/utils/__init__.py
@@ -160,14 +160,22 @@
 
 
 class Keyboard(base.Base):
+    def __init__(self):
+        super(Keyboard, self).__init__()
+        self.kbd = system_config_keyboard.keyboard.Keyboard()
+
     def available_layouts(self):
-        kbd = system_config_keyboard.keyboard.Keyboard()
-        kbd.read()
+        self.kbd.read()
         layoutgen = ((details[0], kid)
-                     for kid, details in kbd.modelDict.items())
+                     for kid, details in self.kbd.modelDict.items())
         layouts = [(kid, name) for name, kid in sorted(layoutgen)]
         return layouts
 
+    def set_layout(self, layout):
+        self.kbd.set(layout)
+        self.kbd.write()
+        self.kbd.activate()
+
 
 class Transaction(list, base.Base):
     """A very simple transaction mechanism.


--
To view, visit http://gerrit.ovirt.org/9951
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c47b8e3edc821ed2128fc540fcb8fd97b1ab73d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list