[node-patches] Change in ovirt-node[master]: keyboard: Add logic to keyboard page
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: keyboard: Add logic to keyboard page
......................................................................
keyboard: Add logic to keyboard page
Change-Id: Ie6b0c8392bf1a7d37efd9fc7eb8e46eb1d36bfbd
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/setup/keyboard_page.py
1 file changed, 27 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/52/9952/1
diff --git a/scripts/tui/src/ovirt/node/setup/keyboard_page.py b/scripts/tui/src/ovirt/node/setup/keyboard_page.py
index 66099cd..c0841bf 100644
--- a/scripts/tui/src/ovirt/node/setup/keyboard_page.py
+++ b/scripts/tui/src/ovirt/node/setup/keyboard_page.py
@@ -18,12 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-
"""
Configure Keyboard Layout
"""
from ovirt.node import plugins, ui, utils
+from ovirt.node.config import defaults
+from ovirt.node.plugins import ChangesHelper
class Plugin(plugins.NodePlugin):
@@ -37,12 +38,10 @@
return 30
def model(self):
- if not self._model:
- self._model = {
- "layout": "en_US",
- }
+ keyboard = dict(defaults.Logrotate().retrieve())
- return self._model
+ model = {}
+ model["keyboard.layout"] = keyboard["layout"] or ""
def validators(self):
return {}
@@ -55,10 +54,10 @@
widgets = [
("layout._header",
ui.Header("Keyboard Layout Selection")),
- ("layout", ui.Table("Available Keyboard Layouts",
+ ("keyboard.layout", ui.Table("Available Keyboard Layouts",
"", kbd.available_layouts())),
-
]
+
# Save it "locally" as a dict, for better accessability
self._widgets = dict(widgets)
@@ -69,4 +68,23 @@
pass
def on_merge(self, effective_changes):
- pass
+ self.logger.debug("Saving keyboard page")
+ changes = ChangesHelper(self.pending_changes(False))
+ model = self.model()
+ model.update(effective_changes)
+ effective_model = ChangesHelper(model)
+
+ self.logger.debug("Saving keyboard page: %s" % changes.changes)
+ self.logger.debug("Keyboard page model: %s" % effective_model.changes)
+
+ layout_keys = ["keyboard.layout"]
+
+ txs = utils.Transaction("Updating keyboard related configuration")
+
+ if changes.any_key_in_change(layout_keys):
+ model = defaults.Keyboard()
+ model.update(*effective_model.get_key_values(layout_keys))
+ txs += model.transaction()
+
+ txs.prepare() # Just to display something in dry mode
+ self.dry_or(lambda: txs())
--
To view, visit http://gerrit.ovirt.org/9952
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6b0c8392bf1a7d37efd9fc7eb8e46eb1d36bfbd
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