Blame SOURCES/0004-Handle-next-button-naming-also-if-there-is-only-one-.patch

acc58b
From 6e6a398e253772c043590183d7c036d1449e0025 Mon Sep 17 00:00:00 2001
acc58b
From: Martin Kolman <mkolman@redhat.com>
acc58b
Date: Mon, 29 Sep 2014 17:01:18 +0200
acc58b
Subject: [PATCH] Handle next button naming also if there is only one module
acc58b
 (#1107887)
acc58b
acc58b
Due to how multi-page modules work (they return FAILURE on apply() to
acc58b
prevent Firstboot from switching to the next module) the code that
acc58b
changes the next button label will be never called if there is only
acc58b
a single multi-page module in Firstboot.
acc58b
acc58b
So check if the label change is needed even if the module returns
acc58b
FAILURE.
acc58b
acc58b
Related: rhbz#1107887
acc58b
Signed-off-by: Martin Kolman <mkolman@redhat.com>
acc58b
---
acc58b
 firstboot/interface.py | 8 +++++++-
acc58b
 1 file changed, 7 insertions(+), 1 deletion(-)
acc58b
acc58b
diff --git a/firstboot/interface.py b/firstboot/interface.py
acc58b
index 60d4800..800c8bd 100644
acc58b
--- a/firstboot/interface.py
acc58b
+++ b/firstboot/interface.py
acc58b
@@ -150,8 +150,14 @@ class Interface(object):
acc58b
         # interface which will know the proper way to handle it.
acc58b
         result = module.apply(self, self.testing)
acc58b
 
acc58b
-        # If something went wrong in the module, don't advance.
acc58b
+        # If something went wrong in the module, don't advance,
acc58b
+        # but check if the next button should be renamed as
acc58b
+        # returning failure seems to be an indication of switching
acc58b
+        # to next page in multi-page modules
acc58b
         if result == RESULT_FAILURE:
acc58b
+            if len(self._controlStack) == 1:
acc58b
+                if self._control.currentPage == len(self.moduleList) - 1:
acc58b
+                    self.nextButton.set_label(_("_Done"))
acc58b
             return
acc58b
 
acc58b
         # If the apply action from the current page jumped us to another page,
acc58b
-- 
acc58b
1.9.3
acc58b