[node-patches] Change in ovirt-node[master]: app: Check min UI size

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


Fabian Deutsch has uploaded a new change for review.

Change subject: app: Check min UI size
......................................................................

app: Check min UI size

Change-Id: I47551cdd765c65f697b364be261f16a059e2c7b5
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/app.py
M scripts/tui/src/ovirt/node/ui/tui.py
2 files changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/25/9925/1

diff --git a/scripts/tui/src/ovirt/node/app.py b/scripts/tui/src/ovirt/node/app.py
index a036d55..9da0916 100644
--- a/scripts/tui/src/ovirt/node/app.py
+++ b/scripts/tui/src/ovirt/node/app.py
@@ -58,6 +58,11 @@
         with self.ui.suspended():
             ovirt.node.utils.process.system("reset ; bash")
 
+    def __check_terminal_size(self):
+        cols, rows = self.ui.size()
+        if cols < 80 or rows < 24:
+            LOGGER.warning("Window size is too small: %dx%d" % (cols, rows))
+
     def model(self, plugin_name):
         model = None
         for plugin in self.plugins:
@@ -68,6 +73,7 @@
     def run(self):
         self.__load_plugins()
         self.ui.register_hotkey("f12", self.__drop_to_shell)
+        self.ui.register_hotkey("window resize", self.__check_terminal_size)
         self.ui.footer = "Press esc to quit."
         self.ui.run()
 
diff --git a/scripts/tui/src/ovirt/node/ui/tui.py b/scripts/tui/src/ovirt/node/ui/tui.py
index b5b821b..9c0c3ea 100644
--- a/scripts/tui/src/ovirt/node/ui/tui.py
+++ b/scripts/tui/src/ovirt/node/ui/tui.py
@@ -211,6 +211,9 @@
     def draw_screen(self):
         self.__loop.draw_screen()
 
+    def size(self):
+        return self.__loop.screen.get_cols_rows()
+
     def watch_pipe(self, cb):
         """Return a fd to be used as stdout, cb called for each line
         """


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

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