[node-patches] Change in ovirt-node[master]: ui: Add hotkey (F12) to reset UI and log page name

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon Aug 12 10:17:14 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Add hotkey (F12) to reset UI and log page name
......................................................................

ui: Add hotkey (F12) to reset UI and log page name

In the old UI pressing F12 lead to resetting the UI. This is now also
possible with the new UI.
Additionally the name of the currently shown page is logged to the
logfiles.

Change-Id: I35c61a7fdcb5de692ed6d1e8dc0a99e4cbfe5d74
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=991267
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/app.py
M src/ovirt/node/ui/__init__.py
M src/ovirt/node/ui/urwid_builder.py
M src/ovirt/node/ui/widgets.py
4 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/59/17959/1

diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index 9e061c7..cfedfb5 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -262,6 +262,7 @@
             content = plugin.ui_content()
             self.show(content)
         self.logger.debug("Build and displayed plugin_page in %s seconds" % t)
+        self.logger.debug("Current page is '%s'" % plugin.ui_name())
 
     def show(self, ui_container):
         """Shows the ui.Page as a page.
@@ -291,6 +292,7 @@
         if not self.__plugins:
             raise Exception("No plugins found in '%s'" % self.plugin_base)
         self.ui.register_hotkey("f2", self.__drop_to_shell)
+        self.ui.register_hotkey("f12", self.__reload_page)
         self.ui.register_hotkey("window resize", self.__check_terminal_size)
 
         self.ui.header = "\n %s\n" % str(self.product)
@@ -398,6 +400,9 @@
             # Error when the UI is not running
             open_console()
 
+    def __reload_page(self):
+        self.ui.reset()
+
     def __check_terminal_size(self):
         cols, rows = self.ui.size()
         if cols < 80 or rows < 24:
diff --git a/src/ovirt/node/ui/__init__.py b/src/ovirt/node/ui/__init__.py
index b607b56..3e7bdd3 100644
--- a/src/ovirt/node/ui/__init__.py
+++ b/src/ovirt/node/ui/__init__.py
@@ -676,6 +676,11 @@
         """
         raise NotImplementedError
 
+    def reset(self):
+        """Reset the UI
+        """
+        raise NotImplementedError
+
     def run(self):
         """Starts the UI
         """
diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index 05900f3..d0fd5ab 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -459,6 +459,10 @@
         self.logger.info("Quitting, exitting mainloop")
         raise urwid.ExitMainLoop()
 
+    def reset(self):
+        self.__main_frame = self.__create_screen()
+        self.__loop.widget = self.__main_frame
+
     def run(self):
         """Run the UI
         """
diff --git a/src/ovirt/node/ui/widgets.py b/src/ovirt/node/ui/widgets.py
index 9883d1e..37cc8d4 100644
--- a/src/ovirt/node/ui/widgets.py
+++ b/src/ovirt/node/ui/widgets.py
@@ -316,6 +316,7 @@
         plugins = self.__pages.items()
         plugins = sorted(plugins, key=lambda two: two[1].rank())
 
+
         for title, plugin in plugins:
             if plugin.has_ui():
                 item = PluginMenuEntry(title, plugin)


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

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