[node-patches] Change in ovirt-node[master]: status: Align status page like in the old layout

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


Fabian Deutsch has uploaded a new change for review.

Change subject: status: Align status page like in the old layout
......................................................................

status: Align status page like in the old layout

Change-Id: I26cbe70ade37480bfb73201eb57a37105d336cf7
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/plugins/example.py
M scripts/tui/src/ovirt/node/plugins/ping.py
M scripts/tui/src/ovirt/node/plugins/status.py
M scripts/tui/src/ovirt/node/ui/widgets.py
4 files changed, 44 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/89/9889/1

diff --git a/scripts/tui/src/ovirt/node/plugins/example.py b/scripts/tui/src/ovirt/node/plugins/example.py
index aacbe86..02d6c5b 100644
--- a/scripts/tui/src/ovirt/node/plugins/example.py
+++ b/scripts/tui/src/ovirt/node/plugins/example.py
@@ -116,6 +116,14 @@
         # Look for conflicts etc
         self._model.update(effective_changes)
 
-        page = ovirt.node.ui.Dialog("Saved!",
-                [("foo.text", ovirt.node.ui.Label("Saved"))])
+        dialog = self._create_dialog("Everything was saved.")
+
+        return dialog
+
+    def _create_dialog(self, txt):
+        page = ovirt.node.ui.Dialog("Information", [
+                ("dialog.text", ovirt.node.ui.Label(txt)),
+                ("dialog.button", ovirt.node.ui.Button("Close"))
+                ])
+        page.has_save_button = False
         return page
diff --git a/scripts/tui/src/ovirt/node/plugins/ping.py b/scripts/tui/src/ovirt/node/plugins/ping.py
index e3a3bb7..0cc10f1 100644
--- a/scripts/tui/src/ovirt/node/plugins/ping.py
+++ b/scripts/tui/src/ovirt/node/plugins/ping.py
@@ -91,6 +91,7 @@
             self._model.update(changes)
         if "ping.count" in changes:
             self._model.update(changes)
+
         if "ping.do_ping" in changes:
             self.on_merge(changes)
 
diff --git a/scripts/tui/src/ovirt/node/plugins/status.py b/scripts/tui/src/ovirt/node/plugins/status.py
index d41fa7f..e1c425b 100644
--- a/scripts/tui/src/ovirt/node/plugins/status.py
+++ b/scripts/tui/src/ovirt/node/plugins/status.py
@@ -49,9 +49,11 @@
     def model(self):
         if not self._model:
             self._model = {
-                "status.networking": "On",
-                "status.logs": "Local",
-                "status.vms.running": "42",
+                "status": "Virtualization hardware was not detected",
+                "networking": "On",
+                "networking.bridge": "breth0: 192.168.122.1",
+                "logs": "Local Only",
+                "libvirt.num_guests": "42",
             }
         return self._model
 
@@ -59,14 +61,38 @@
         """Describes the UI this plugin requires
         This is an ordered list of (path, widget) tuples.
         """
+        # Function to expand all "keywords" to the same length
         aligned = lambda l: l.ljust(16)
+
+        # Network related widgets, appearing in one row
+        network_widgets = [
+                ("networking",
+                    ovirt.node.ui.KeywordLabel(aligned("Networking: "))),
+                ("networking.bridge",
+                    ovirt.node.ui.Label("N/A")),
+            ]
         widgets = [
-            ("status.networking",
-                ovirt.node.ui.KeywordLabel(aligned("Networking: "))),
-            ("status.logs",
+            ("status",
+                ovirt.node.ui.KeywordLabel(aligned("Status: "))),
+            ("status._space", ovirt.node.ui.Divider()),
+
+            ("network._column", ovirt.node.ui.Row(network_widgets)),
+            ("network._space", ovirt.node.ui.Divider()),
+
+            ("logs",
                 ovirt.node.ui.KeywordLabel(aligned("Logs: "))),
-            ("status.vms.running",
+            ("logs._space", ovirt.node.ui.Divider()),
+
+            ("libvirt.num_guests",
                 ovirt.node.ui.KeywordLabel(aligned("Running VMs: "))),
+            ("libvirt._space", ovirt.node.ui.Divider()),
+
+            ("support.hint", ovirt.node.ui.Label("Press F8 for support menu")),
+            ("support._space", ovirt.node.ui.Divider()),
+
+            ("action.hostkey", ovirt.node.ui.Button("View Host Key")),
+#            ("action", ovirt.node.ui.Buttons(["Lock", "Log Off", "Restart",
+#                                              "Power Off"])),
         ]
         # Save it "locally" as a dict, for better accessability
         self._widgets = dict(widgets)
diff --git a/scripts/tui/src/ovirt/node/ui/widgets.py b/scripts/tui/src/ovirt/node/ui/widgets.py
index f001c24..a59d4aa 100644
--- a/scripts/tui/src/ovirt/node/ui/widgets.py
+++ b/scripts/tui/src/ovirt/node/ui/widgets.py
@@ -320,39 +320,6 @@
         self.select(txt)
 
 
-#https://github.com/pazz/alot/blob/master/alot/widgets/globals.py
-class ChoiceWidget(urwid.Text):
-    def __init__(self, choices, callback, cancel=None, select=None,
-                 separator=' '):
-        self.choices = choices
-        self.callback = callback
-        self.cancel = cancel
-        self.select = select
-        self.separator = separator
-
-        items = []
-        for k, v in choices.items():
-            if v == select and select is not None:
-                items += ['[', k, ']:', v]
-            else:
-                items += ['(', k, '):', v]
-            items += [self.separator]
-        urwid.Text.__init__(self, items)
-
-    def selectable(self):
-        return True
-
-    def keypress(self, size, key):
-        if key == 'enter' and self.select is not None:
-            self.callback(self.select)
-        elif key == 'esc' and self.cancel is not None:
-            self.callback(self.cancel)
-        elif key in self.choices:
-            self.callback(self.choices[key])
-        else:
-            return key
-
-
 class PageWidget(urwid.WidgetWrap):
     save_button = None
 


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

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