[node-patches] Change in ovirt-node[node-3.0]: ui: Fix ui.Checkbox coloring
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue May 21 14:42:24 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: ui: Fix ui.Checkbox coloring
......................................................................
ui: Fix ui.Checkbox coloring
Change-Id: I5596af44431cb3d50a00d0f6b1015858aba73b22
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/ui/__init__.py
M src/ovirt/node/ui/urwid_builder.py
M src/ovirt/node/ui/widgets.py
3 files changed, 27 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/51/14951/1
diff --git a/src/ovirt/node/ui/__init__.py b/src/ovirt/node/ui/__init__.py
index 699bf11..680e623 100644
--- a/src/ovirt/node/ui/__init__.py
+++ b/src/ovirt/node/ui/__init__.py
@@ -152,6 +152,14 @@
"""
return NotImplementedError
+ def enabled(self, is_enabled=True):
+ """Enable/Disable all children
+ """
+ if is_enabled in [True, False]:
+ for child in self.children:
+ child.enabled(is_enabled)
+ return all(child.enabled() for child in self.children)
+
def __getitem__(self, path):
return dict((c.path, c) for c in self.children)[path]
diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index 4e84d8b..c1a4237 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -398,7 +398,7 @@
('plugin.widget.page.header', element_styles["header"]),
('plugin.widget.page.frame', None),
('plugin.widget.checkbox.label', element_styles["label"]),
- ('plugin.widget.checkbox', element_styles["label"]),
+ ('plugin.widget.checkbox', element_styles["text"]),
]
def __init__(self, path, application, with_menu=True):
diff --git a/src/ovirt/node/ui/widgets.py b/src/ovirt/node/ui/widgets.py
index c96a8e7..a5a13ba 100644
--- a/src/ovirt/node/ui/widgets.py
+++ b/src/ovirt/node/ui/widgets.py
@@ -615,11 +615,16 @@
amap = {None: self._option_attr}
else:
amap = {None: self._option_disabled_attr}
- self._option_attr.set_attr_map(amap)
+ for am in self._buttons:
+ am.set_attr_map(amap)
class Checkbox(urwid.WidgetWrap):
signals = ['change']
+ _selectable = True
+
+ _checkbox_attr = "plugin.widget.checkbox"
+ _checkbox_disabled_attr = "plugin.widget.checkbox.disabled"
def __init__(self, label, state):
self._label = urwid.Text(label)
@@ -627,7 +632,7 @@
"plugin.widget.checkbox.label")
self._checkbox = urwid.CheckBox("", state)
self._checkbox_attrmap = urwid.AttrMap(self._checkbox,
- "plugin.widget.checkbox")
+ self._checkbox_attr)
self._divider = urwid.Divider()
self._container = urwid.Columns([self._label_attrmap,
self._checkbox_attrmap])
@@ -645,6 +650,17 @@
else:
raise Exception("Invalid value: %s" % s)
+ def selectable(self):
+ return self._selectable
+
+ def enable(self, is_enabled):
+ self._selectable = is_enabled
+ if is_enabled:
+ amap = {None: self._checkbox_attr}
+ else:
+ amap = {None: self._checkbox_disabled_attr}
+ self._checkbox_attrmap.set_attr_map(amap)
+
class PageWidget(urwid.WidgetWrap):
save_button = None
--
To view, visit http://gerrit.ovirt.org/14951
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5596af44431cb3d50a00d0f6b1015858aba73b22
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list