[node-patches] Change in ovirt-node[master]: tui: Fix colors (for terminal)

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Dec 11 20:09:43 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: tui: Fix colors (for terminal)
......................................................................

tui: Fix colors (for terminal)

Change-Id: I5c3bd069ff020d4edf87854db68d52ecbdc1bb32
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/ui/builder.py
M scripts/tui/src/ovirt/node/ui/tui.py
M scripts/tui/src/ovirt/node/ui/widgets.py
3 files changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/71/9971/1

diff --git a/scripts/tui/src/ovirt/node/ui/builder.py b/scripts/tui/src/ovirt/node/ui/builder.py
index 245dbad..fa37c73 100644
--- a/scripts/tui/src/ovirt/node/ui/builder.py
+++ b/scripts/tui/src/ovirt/node/ui/builder.py
@@ -102,8 +102,7 @@
     }
 
     # Check if builder is available for UI Element
-    assert type(item) in item_to_builder.keys(), \
-           "No widget for item type"
+    assert type(item) in item_to_builder, "No widget for item type"
 
     # Build widget from UI Element
     build_func = item_to_builder[type(item)]
diff --git a/scripts/tui/src/ovirt/node/ui/tui.py b/scripts/tui/src/ovirt/node/ui/tui.py
index 669ce69..21b3e69 100644
--- a/scripts/tui/src/ovirt/node/ui/tui.py
+++ b/scripts/tui/src/ovirt/node/ui/tui.py
@@ -23,7 +23,7 @@
 The urwid TUI base library
 """
 
-import timeit
+import time
 import urwid
 
 from ovirt.node import base
@@ -51,8 +51,8 @@
     footer = u"Press ctrl+c to quit"
 
     element_styles = {
-        "text": "black",
-        "label": "black, bold",
+        "text": "dark gray",
+        "label": "black",
         "disabled": "white",
         "background": "light gray",
         "invalid": "dark red",
@@ -70,10 +70,9 @@
                ('main.menu', 'black'),
                ('main.menu.frame', element_styles["text"]),
                ('notice', 'light red'),
-               ('plugin.widget.entry', element_styles["text"], "white"),
+               ('plugin.widget.entry', element_styles["text"]),
                ('plugin.widget.entry.disabled', element_styles["disabled"]),
-               ('plugin.widget.entry.invalid', element_styles["invalid"],
-                                               "white"),
+               ('plugin.widget.entry.invalid', element_styles["invalid"]),
                ('plugin.widget.entry.label', element_styles["label"]),
                ('plugin.widget.entry.label.invalid', element_styles["label"]),
                ('plugin.widget.entry.frame', element_styles["text"]),
@@ -81,7 +80,7 @@
                 element_styles["invalid"]),
                ('plugin.widget.entry.frame.disabled',
                 element_styles["disabled"]),
-               ('plugin.widget.notice', 'light red'),
+               ('plugin.widget.notice', element_styles["invalid"]),
                ('plugin.widget.header', 'black, bold'),
                ('plugin.widget.divider', element_styles["text"]),
                ('plugin.widget.button', 'dark blue'),
@@ -216,12 +215,14 @@
     def _display_plugin(self, plugin):
         if self._check_outstanding_changes():
             return
-        timer = timeit.Timer()
+        start = time.time()
         self._current_plugin = plugin
         plugin_page = ovirt.node.ui.builder.page_from_plugin(self, plugin)
         self.__display_as_page(plugin_page)
+        stop = time.time()
+        diff = stop - start
         self.logger.debug("Build and displayed plugin_page in %ss" %
-                          timer.timeit())
+                          diff)
 
     def __display_as_dialog(self, body, title):
         self.logger.debug("Displaying dialog: %s / %s" % (body, title))
diff --git a/scripts/tui/src/ovirt/node/ui/widgets.py b/scripts/tui/src/ovirt/node/ui/widgets.py
index 7564ce7..481c2d8 100644
--- a/scripts/tui/src/ovirt/node/ui/widgets.py
+++ b/scripts/tui/src/ovirt/node/ui/widgets.py
@@ -320,7 +320,7 @@
             self._linebox_attrmap.set_attr_map(attr_map_linebox)
 
     def set_text(self, txt):
-        self._edit.set_edit_text(txt)
+        self._edit.set_edit_text(txt or "")
 
     def selectable(self):
         return self._selectable


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

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