[node-patches] Change in ovirt-node[node-3.0]: ui: Fix ui.Options coloring

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue May 21 14:42:23 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Fix ui.Options coloring
......................................................................

ui: Fix ui.Options coloring

Previously the colors for ui.Options were incorrect. Now the values are
in black, if editable, or in gray if the whole option field is disabled.
The label is always in gray, as it's not editable.

Change-Id: Ie71c532cbb56ab5e0b44268c733ba9c7e002f7ae
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/ui/urwid_builder.py
M src/ovirt/node/ui/widgets.py
2 files changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/48/14948/1

diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index a9599a5..4e84d8b 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -390,7 +390,8 @@
                 element_styles["label"]),
                ('plugin.widget.progressbar.complete', "white",
                 element_styles["disabled"]),
-               ('plugin.widget.options', element_styles["label"]),
+               ('plugin.widget.options', element_styles["text"]),
+               ('plugin.widget.options.disabled', element_styles["disabled"]),
                ('plugin.widget.options.label', element_styles["label"]),
                ('plugin.widget.dialog', None),
                ('plugin.widget.page', None),
diff --git a/src/ovirt/node/ui/widgets.py b/src/ovirt/node/ui/widgets.py
index 759df59..c96a8e7 100644
--- a/src/ovirt/node/ui/widgets.py
+++ b/src/ovirt/node/ui/widgets.py
@@ -563,8 +563,10 @@
 class Options(urwid.WidgetWrap):
     signals = ["change"]
 
+    _selectable = True
     _label_attr = "plugin.widget.options.label"
     _option_attr = "plugin.widget.options"
+    _option_disabled_attr = "plugin.widget.options.disabled"
 
     def __init__(self, label, options, selected_option_key):
         self._options = options
@@ -604,6 +606,17 @@
     def set_text(self, txt):
         self.select(txt)
 
+    def selectable(self):
+        return self._selectable
+
+    def enable(self, is_enabled):
+        self._selectable = is_enabled
+        if is_enabled:
+            amap = {None: self._option_attr}
+        else:
+            amap = {None: self._option_disabled_attr}
+        self._option_attr.set_attr_map(amap)
+
 
 class Checkbox(urwid.WidgetWrap):
     signals = ['change']


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie71c532cbb56ab5e0b44268c733ba9c7e002f7ae
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