[node-patches] Change in ovirt-node[node-3.0]: ui: Add TextViewDialog

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


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Add TextViewDialog
......................................................................

ui: Add TextViewDialog

A dialog to view large portions of text.

Change-Id: Ib925331c928943406af5174a9ce915692e20d5cd
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/setup/diagnostics_page.py
M src/ovirt/node/ui/__init__.py
2 files changed, 15 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/40/14940/1

diff --git a/src/ovirt/node/setup/diagnostics_page.py b/src/ovirt/node/setup/diagnostics_page.py
index ab02ca2..3c7e4a3 100644
--- a/src/ovirt/node/setup/diagnostics_page.py
+++ b/src/ovirt/node/setup/diagnostics_page.py
@@ -19,12 +19,13 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
+from ovirt.node import plugins, ui
+from ovirt.node.utils import process
 
 """
 Diagnostics page
 """
 
-from ovirt.node import plugins, ui
 
 
 class Plugin(plugins.NodePlugin):
@@ -73,20 +74,11 @@
                              in self.__diagnostics())
             cmd = cmds.get(changes[changed_field], None)
             if cmd:
-                return OutputDialog("output.dialog", "Command Output", cmd)
+                contents = process.check_output(cmd)
+                return ui.TextViewDialog("output.dialog", "Command Output",
+                                         contents)
 
     def __diagnostics(self):
         return [("multipath", "multipath -ll"),
                 ("fdisk", "fdisk -l"),
                 ("parted", "parted -l")]
-
-
-class OutputDialog(ui.Dialog):
-
-    def __init__(self, path, title, cmd):
-        from ovirt.node.utils import process
-        super(OutputDialog, self).__init__(path, title, [])
-        output = process.check_output(cmd)
-        self.children = [ui.Table("output[0]", "", cmd,
-                                      output, height=10)]
-        self.buttons = [ui.CloseButton("dialog.close")]
diff --git a/src/ovirt/node/ui/__init__.py b/src/ovirt/node/ui/__init__.py
index 686b0d9..eed6aea 100644
--- a/src/ovirt/node/ui/__init__.py
+++ b/src/ovirt/node/ui/__init__.py
@@ -748,6 +748,16 @@
         self.buttons = buttons or [CloseButton("dialog.close")]
 
 
+class TextViewDialog(Dialog):
+    """A dialog to display much text, e.g. log files
+    """
+    def __init__(self, path, title, contents, height=10):
+        super(TextViewDialog, self).__init__(path, title, [])
+        self.children = [Table("contents", "", "Contents",
+                               contents, height=height)]
+        self.buttons = [CloseButton("dialog.close")]
+
+
 class TransactionProgressDialog(Dialog):
     """Display the progress of a transaction in a dialog
     """


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

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