[node-patches] Change in ovirt-node[master]: pages: Use Checkbox where possible
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue Dec 11 20:09:42 UTC 2012
Fabian Deutsch has uploaded a new change for review.
Change subject: pages: Use Checkbox where possible
......................................................................
pages: Use Checkbox where possible
Change-Id: I4b6f4636d0b4d920a3ef1f96daa53013f1bf54e4
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/setup/security_page.py
M scripts/tui/src/ovirt/node/setup/snmp_page.py
M scripts/tui/src/ovirt/node/ui/__init__.py
M scripts/tui/src/ovirt/node/ui/tui.py
4 files changed, 26 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/64/9964/1
diff --git a/scripts/tui/src/ovirt/node/setup/security_page.py b/scripts/tui/src/ovirt/node/setup/security_page.py
index b3269db..bd36277 100644
--- a/scripts/tui/src/ovirt/node/setup/security_page.py
+++ b/scripts/tui/src/ovirt/node/setup/security_page.py
@@ -60,13 +60,11 @@
def ui_content(self):
widgets = [
("header[0]", ui.Header("Remote Access")),
- ("ssh.enabled", ui.Options("Enable ssh password authentication",
- [("yes", "Yes"), ("no", "No")])),
+ ("ssh.enabled", ui.Checkbox("Enable ssh password authentication")),
("divider[0]", ui.Divider()),
("header[1]", ui.Header("Strong Random Number Generator")),
- ("strongrng.aesni", ui.Options("Enable AES-NI",
- [("yes", "Yes"), ("no", "No")])),
+ ("strongrng.aesni", ui.Checkbox("Enable AES-NI")),
("strongrng.num_bytes", ui.Entry("Bytes Used:")),
("divider[1]", ui.Divider()),
diff --git a/scripts/tui/src/ovirt/node/setup/snmp_page.py b/scripts/tui/src/ovirt/node/setup/snmp_page.py
index 961157e..f25818b 100644
--- a/scripts/tui/src/ovirt/node/setup/snmp_page.py
+++ b/scripts/tui/src/ovirt/node/setup/snmp_page.py
@@ -23,12 +23,10 @@
Configure SNMP
"""
-import ovirt.node.plugins
-import ovirt.node.valid
-import ovirt.node.ui
+from ovirt.node import plugins, valid, ui, exceptions
-class Plugin(ovirt.node.plugins.NodePlugin):
+class Plugin(plugins.NodePlugin):
_model = None
_widgets = None
@@ -49,27 +47,26 @@
def validators(self):
return {
- "passwd.admin.password": ovirt.node.valid.Text(),
- "passwd.admin.password_confirmation": ovirt.node.valid.Text(),
+ "passwd.admin.password": valid.Text(),
+ "passwd.admin.password_confirmation": valid.Text(),
}
def ui_content(self):
widgets = [
- ("snmp._header", ovirt.node.ui.Header("SNMP")),
- ("snmp.enabled", ovirt.node.ui.Options("Enable SNMP",
- [("yes", "Yes"), ("no", "No")])),
- ("ssh._divider", ovirt.node.ui.Divider()),
+ ("snmp._header", ui.Header("SNMP")),
+ ("snmp.enabled", ui.Checkbox("Enable SNMP")),
+ ("ssh._divider", ui.Divider()),
- ("snmp.password._header", ovirt.node.ui.Header("SNMP Password")),
- ("snmp.password", ovirt.node.ui.PasswordEntry("Password:")),
- ("snmp.password_confirmation", ovirt.node.ui.PasswordEntry(
- "Confirm Password:")),
+ ("snmp.password._header", ui.Header("SNMP Password")),
+ ("snmp.password", ui.PasswordEntry("Password:")),
+ ("snmp.password_confirmation", ui.PasswordEntry(
+ "Confirm Password:")),
]
# Save it "locally" as a dict, for better accessability
self._widgets = dict(widgets)
- page = ovirt.node.ui.Page(widgets)
+ page = ui.Page(widgets)
return page
def on_change(self, changes):
@@ -77,7 +74,7 @@
if self._model["snmp.password"] != \
self._model["snmp.password_confirmation"]:
- raise ovirt.node.exceptions.InvalidData("Passwords do not match.")
+ raise exceptions.InvalidData("Passwords do not match.")
def on_merge(self, effective_changes):
pass
diff --git a/scripts/tui/src/ovirt/node/ui/__init__.py b/scripts/tui/src/ovirt/node/ui/__init__.py
index e469f0e..d568e1c 100644
--- a/scripts/tui/src/ovirt/node/ui/__init__.py
+++ b/scripts/tui/src/ovirt/node/ui/__init__.py
@@ -206,7 +206,7 @@
options:
"""
def __init__(self, label, options):
- super(Options, self).__init__(None, True)
+ super(Options, self).__init__(label, True)
self.label = label
self.options = options
self.option(options[0])
diff --git a/scripts/tui/src/ovirt/node/ui/tui.py b/scripts/tui/src/ovirt/node/ui/tui.py
index 43fc3b8..03487f6 100644
--- a/scripts/tui/src/ovirt/node/ui/tui.py
+++ b/scripts/tui/src/ovirt/node/ui/tui.py
@@ -69,7 +69,7 @@
('main.menu', 'black'),
('main.menu.frame', element_styles["text"]),
('notice', 'light red'),
- ('plugin.widget.entry', element_styles["text"]),
+ ('plugin.widget.entry', element_styles["text"], "white"),
('plugin.widget.entry.disabled', element_styles["disabled"]),
('plugin.widget.entry.label', element_styles["label"]),
('plugin.widget.entry.frame', element_styles["text"]),
@@ -180,12 +180,16 @@
self.logger.debug("Available widgets: %s" % widgets)
for path, value in pending_changes.items():
if path in widgets:
- field = widgets[path].name
+ widget = widgets[path]
+ field = widget.name
+ self.logger.debug("Changed widget: %s %s" % (path,
+ widget))
msg += "- %s\n" % (field.strip(":"))
- self.__display_as_dialog(urwid.Filler(urwid.Text(
- "The following fields were changed:\n%s" % msg)),
- "Pending changes")
- has_outstanding_changes = True
+ if msg:
+ self.__display_as_dialog(urwid.Filler(urwid.Text(
+ "The following fields were changed:\n%s" % msg)),
+ "Pending changes")
+ has_outstanding_changes = True
return has_outstanding_changes
def __display_as_body(self, widget):
--
To view, visit http://gerrit.ovirt.org/9964
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b6f4636d0b4d920a3ef1f96daa53013f1bf54e4
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