[node-patches] Change in ovirt-node[master]: Show a confirmation in the installer if "Quit" is selected

rbarry at redhat.com rbarry at redhat.com
Fri Dec 13 17:08:35 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Show a confirmation in the installer if "Quit" is selected
......................................................................

Show a confirmation in the installer if "Quit" is selected

We should confirm that the user wants to quit, and reboot the
system rather than simply exiting if so.

Change-Id: I678a3eaf3d443b88ceb4d5a6a3632842f614dff6
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=980864
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/installer/__main__.py
1 file changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/81/22381/1

diff --git a/src/ovirt/node/installer/__main__.py b/src/ovirt/node/installer/__main__.py
index 6890050..717db14 100644
--- a/src/ovirt/node/installer/__main__.py
+++ b/src/ovirt/node/installer/__main__.py
@@ -23,7 +23,27 @@
 Create an setup application instance an start it.
 """
 
-from ovirt.node import app, installer, log
+from ovirt.node import app, installer, log, ui, utils
+
+
+def quit():
+    txt = "Are you sure you want to quit? The system will be rebooted."
+    dialog = ui.ConfirmationDialog("dialog.exit", "Exit", txt,
+                                   [ui.Button("dialog.exit.yes", "Reboot"),
+                                    ui.CloseButton("dialog.exit.close",
+                                                   "Cancel")]
+                                   )
+
+    dialog.buttons[0].on_activate.clear()
+    dialog.buttons[0].on_activate.connect(ui.CloseAction())
+    dialog.buttons[0].on_activate.connect(ui_quit)
+    instance.show(dialog)
+
+
+def ui_quit(dialog, changes):
+    instance.ui.quit()
+    utils.system.reboot()
+
 
 if __name__ == '__main__':
     args, _ = app.parse_cmdline()


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

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