[node-patches] Change in ovirt-node[master]: Show a confirmation dialog when exiting the TUI

rbarry at redhat.com rbarry at redhat.com
Fri Dec 13 16:59:20 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Show a confirmation dialog when exiting the TUI
......................................................................

Show a confirmation dialog when exiting the TUI

No confirmation was shown when pressing escape. We should show a
dialog to make sure this is really what the user wants to do.

Change-Id: I2d56b0e816cc9c7abfb25dc346436963eae6a5aa
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1039266
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/__main__.py
1 file changed, 20 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/80/22380/1

diff --git a/src/ovirt/node/setup/__main__.py b/src/ovirt/node/setup/__main__.py
index 189fa18..e1f6462 100644
--- a/src/ovirt/node/setup/__main__.py
+++ b/src/ovirt/node/setup/__main__.py
@@ -23,10 +23,28 @@
 Create an setup application instance an start it.
 """
 
-from ovirt.node import app, setup, log
+from ovirt.node import app, setup, log, ui
+
+
+def quit():
+    txt = "Are you sure you want to quit?"
+    dialog = ui.ConfirmationDialog("dialog.exit", "Exit", txt,
+                                   [ui.Button("dialog.exit.yes", "Yes"),
+                                    ui.CloseButton("dialog.exit.close", "No")]
+                                   )
+
+    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()
+
 
 if __name__ == '__main__':
     args, _ = app.parse_cmdline()
     log.configure_logging(args.debug)
-    instance = app.Application(setup, args)
+    instance = app.Application(setup, args, quit=quit)
     instance.run()


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

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