[node-patches] Change in ovirt-node[master]: Let applications specify their own quit function
rbarry at redhat.com
rbarry at redhat.com
Fri Dec 13 16:52:44 UTC 2013
Ryan Barry has uploaded a new change for review.
Change subject: Let applications specify their own quit function
......................................................................
Let applications specify their own quit function
Keep the old behavior, and default to it if nothing is passed, but
allow Application() objects (setup, installer, et al) to decide
what happens when a user quits.
Change-Id: I2bffc0e5ea625457bae1eb1106976de7a7053dbb
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/app.py
M src/ovirt/node/ui/urwid_builder.py
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/78/22378/1
diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index d522f3f..81d8192 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -70,7 +70,7 @@
ui_builder = None
ui = None
- def __init__(self, plugin_base, args,
+ def __init__(self, plugin_base, args, quit=None,
ui_builder=urwid_builder.UrwidUIBuilder):
"""Constructs a new application
@@ -94,6 +94,7 @@
self.ui_builder = ui_builder(self)
self.ui = self.ui_builder.build(ui.Window("screen", self))
self.plugin_base = plugin_base
+ self.quit = quit if quit else self.app_quit
def __parse_cmdline(self):
if self.args.defaults:
@@ -296,7 +297,7 @@
if console.wait_for_keypress() == 's':
self.__drop_to_shell()
- def quit(self):
+ def app_quit(self):
self.logger.info("Quitting")
self.ui.quit()
diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index 4814998..152dedf 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -581,7 +581,8 @@
def _quit_if_no_dialogs(self):
if self.topmost_dialog() is None:
- self.quit()
+ self.application.quit() if self.application.quit is not \
+ self.application.app_quit else self.quit()
else:
self.logger.debug("There are still open dialogs")
--
To view, visit http://gerrit.ovirt.org/22378
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bffc0e5ea625457bae1eb1106976de7a7053dbb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list