[master/rhel7-branch] Fix q for quit issue in text mode (#997405)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Mon Sep 8 13:00:19 UTC 2014
Pressing 'q' to quit the installer in the ask VNC spoke of text mode was
not working. We can't rely on the global handling of this input,
unfortunately, since the installation environment is not set up at this
point. But, this should be a relatively simple way of adding the
functionality.
Resolves: rhbz#997405
---
pyanaconda/ui/tui/spokes/askvnc.py | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/askvnc.py b/pyanaconda/ui/tui/spokes/askvnc.py
index 200a5a6..52548f4 100644
--- a/pyanaconda/ui/tui/spokes/askvnc.py
+++ b/pyanaconda/ui/tui/spokes/askvnc.py
@@ -21,9 +21,10 @@
from pyanaconda.ui.tui.spokes import NormalTUISpoke
from pyanaconda.ui.tui.simpleline import TextWidget, ColumnWidget
+from pyanaconda.ui.tui.tuiobject import YesNoDialog
from pyanaconda.constants import USEVNC, USETEXT
from pyanaconda.i18n import N_, _
-import getpass
+import getpass, subprocess
class AskVNCSpoke(NormalTUISpoke):
title = N_("VNC")
@@ -68,22 +69,28 @@ class AskVNCSpoke(NormalTUISpoke):
"""Override input so that we can launch the VNC password spoke"""
try:
- number = int(key)
- choice = self._choices[number -1]
+ choice = self._choices[int(key) - 1]
+ if choice == USETEXT:
+ self._usevnc = False
+ else:
+ self._usevnc = True
+ newspoke = VNCPassSpoke(self.app, self.data, self.storage,
+ self.payload, self.instclass)
+ self.app.switch_screen_modal(newspoke)
+
+ self.apply()
+ self.close()
+ return None
except (ValueError, KeyError, IndexError):
- return key
+ pass
- if choice == USETEXT:
- self._usevnc = False
+ if key.lower() == _('q'):
+ d = YesNoDialog(self.app, _(self.app.quit_message))
+ self.app.switch_screen_modal(d)
+ if d.answer:
+ subprocess.Popen(["systemctl", "--no-wall", "reboot"])
else:
- self._usevnc = True
- newspoke = VNCPassSpoke(self.app, self.data, self.storage,
- self.payload, self.instclass)
- self.app.switch_screen_modal(newspoke)
-
- self.apply()
- self.close()
- return None
+ return key
def apply(self):
self.data.vnc.enabled = self._usevnc
--
1.9.3
More information about the anaconda-patches
mailing list