[node-patches] Change in ovirt-node[master]: keyboard_page:Add a KeywordLabel to show Current Active Keyb...

hadong0720 at gmail.com hadong0720 at gmail.com
Fri Jul 5 12:12:16 UTC 2013


hadong has uploaded a new change for review.

Change subject: keyboard_page:Add a KeywordLabel to show Current Active Keyboard Layout
......................................................................

keyboard_page:Add a KeywordLabel to show Current Active
Keyboard Layout

Change-Id: I69ca6ae18e85d7d5ea87e2bb1c224fd2f115d2d4
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=981606
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/setup/core/keyboard_page.py
M src/ovirt/node/utils/system.py
2 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/09/16509/1

diff --git a/src/ovirt/node/setup/core/keyboard_page.py b/src/ovirt/node/setup/core/keyboard_page.py
index b24ded1..22e8ba9 100644
--- a/src/ovirt/node/setup/core/keyboard_page.py
+++ b/src/ovirt/node/setup/core/keyboard_page.py
@@ -38,8 +38,10 @@
 
     def model(self):
         cfg = defaults.Keyboard().retrieve()
+        kbd = utils.system.Keyboard()
         model = {}
         model["keyboard.layout"] = cfg["layout"] or ""
+        model["keyboard.layout_name"] = kbd.get_current_name() or "None"
         return model
 
     def validators(self):
@@ -51,6 +53,11 @@
         """
         kbd = utils.system.Keyboard()
         ws = [ui.Header("header", "Keyboard Layout Selection"),
+              ui.Label("label", "Choose the Keyboard Layout you would " +
+                       "like to apply to this system."),
+              ui.Divider("divider[0]"),
+              ui.KeywordLabel("keyboard.layout_name", "Current Active " +
+                              "Keyboard Layout:  "),
               ui.Table("keyboard.layout", "", "Available Keyboard Layouts",
                        kbd.available_layouts(), kbd.get_current()),
               ]
@@ -83,3 +90,5 @@
 
         progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
         progress_dialog.run()
+
+        return self.ui_content()
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 024274f..a841dde 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -310,6 +310,14 @@
     def get_current(self):
         return self.kbd.get()
 
+    def get_current_name(self):
+        layout_name = None
+        for kid, name in self.available_layouts():
+            if kid == self.get_current():
+                layout_name = name
+                break
+        return layout_name
+
 
 class Reboot(base.Base):
     def simpleDaemon(self, main, args=(), kwargs={}):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69ca6ae18e85d7d5ea87e2bb1c224fd2f115d2d4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list