[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[master 3/3] tui: add reinitializeWindow() to the text interface.



Also defines the method for cmdline.py (where it just fails the
installation because no questions are allowed there).

Resolves: rhbz#675955
---
 pyanaconda/cmdline.py              |    9 +++++++++
 pyanaconda/text.py                 |   21 +++++++++++++++++++++
 pyanaconda/textw/constants_text.py |   16 ++++++++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/cmdline.py b/pyanaconda/cmdline.py
index 1034479..4559513 100644
--- a/pyanaconda/cmdline.py
+++ b/pyanaconda/cmdline.py
@@ -73,6 +73,15 @@ class InstallInterface(InstallInterfaceBase):
     def __del__(self):
         pass
 
+    def reinitializeWindow(self, title, path, size, description):
+        print(_("Command line mode requires all choices to be specified in a "
+                "kickstart configuration file."))
+        print(title)
+
+        # don't exit
+        while 1:
+            time.sleep(5)
+
     def shutdown(self):
         pass
 
diff --git a/pyanaconda/text.py b/pyanaconda/text.py
index f566aaf..86ae5e4 100644
--- a/pyanaconda/text.py
+++ b/pyanaconda/text.py
@@ -263,6 +263,27 @@ class InstallInterface(InstallInterfaceBase):
     def progressWindow(self, title, text, total, updpct = 0.05, pulse = False):
         return ProgressWindow(self.screen, title, text, total, updpct, pulse)
 
+    def reinitializeWindow(self, title, path, size, description):
+        grid = GridForm(self.screen, title, 1, 3)
+        text = TEXT_REINITIALIZE % (description, size, path)
+        grid.add(TextboxReflowed(70, text), 0, 0)
+
+        all_devices_cb = Checkbox(TEXT_REINITIALIZE_ALL, isOn=False)
+        grid.add(all_devices_cb, 0, 1, padding=(0, 1, 0, 0))
+
+        buttons = [(_("Yes, discard any data"), "yes"),
+                   (_("No, keep any data"), "no")]
+        grid.buttons = ButtonBar(self.screen, buttons)
+        grid.add(grid.buttons, 0, 2, padding=(0, 1, 0, 0))
+
+        result = grid.run()
+        button_check = grid.buttons.buttonPressed(result)
+        self.screen.popWindow()
+        rc = 2 if button_check == "yes" else 0
+        if all_devices_cb.selected():
+            rc += 1
+        return rc
+
     def setInstallProgressClass(self, c):
         self.instProgress = c
 
diff --git a/pyanaconda/textw/constants_text.py b/pyanaconda/textw/constants_text.py
index b77cada..d11b684 100644
--- a/pyanaconda/textw/constants_text.py
+++ b/pyanaconda/textw/constants_text.py
@@ -70,3 +70,19 @@ TEXT_RETRY_CHECK = "retry"
 TEXT_RETRY_BUTTON = Translator(TEXT_RETRY_STR, TEXT_RETRY_CHECK)
 
 TEXT_F12_CHECK = "F12"
+
+TEXT_REINITIALIZE = _(
+"""This storage device may contain data:
+
+%s, %s MB, %s
+
+We could not detect partitions or filesystems on this device. This could be \
+because the device is blank, unpartitioned, or virtual. If not, there may be \
+data on the device that can not be recovered if you use it in this \
+installation. We can remove the device from this installation to protect the \
+data.
+
+Are you sure this device does not contain valuable data?""")
+
+TEXT_REINITIALIZE_ALL = _(\
+    "Apply my choice to all devices with undetected partitions.")
-- 
1.7.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]