[PATCH 2/2] Warn if no user has been created (#965797)

Vratislav Podzimek vpodzime at redhat.com
Wed Jun 12 14:00:03 UTC 2013


Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 initial_setup/gui/hubs/initial_setup.py | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/initial_setup/gui/hubs/initial_setup.py b/initial_setup/gui/hubs/initial_setup.py
index f966782..3be4df6 100644
--- a/initial_setup/gui/hubs/initial_setup.py
+++ b/initial_setup/gui/hubs/initial_setup.py
@@ -3,6 +3,9 @@ from pyanaconda.ui.gui.spokes import Spoke
 from pyanaconda.ui.common import collect
 import os
 
+# TODO: make translations work in the i-s
+_ = lambda x: x
+
 __all__ = ["InitialSetupMainHub"]
 
 def collect_spokes(mask_paths):
@@ -29,7 +32,12 @@ class InitialSetupMainHub(Hub):
     uiFile = "initial_setup.glade"
     builderObjects = ["summaryWindow"]
     mainWidgetName = "summaryWindow"
-    
+
+    def __init__(self, *args):
+        Hub.__init__(self, *args)
+
+        self._continue_clicked = False
+
     def _collectCategoriesAndSpokes(self):
         """collects categories and spokes to be displayed on this Hub
 
@@ -52,6 +60,25 @@ class InitialSetupMainHub(Hub):
         return ret
 
     @property
+    def continue_possible(self):
+        if len(self.data.user.userList) > 0:
+            # at least one user created in the installation or here
+            return True
+        else:
+            if self._continue_clicked:
+                # clicked second time
+                self.clear_info()
+                return True
+            else:
+                self._continue_clicked = True
+                button_label = self.builder.get_object("continueButton").get_label()
+                self.set_warning(_("No user created. If you really want to "
+                                   "continue without creating user, click the "
+                                   "%s button again.") % button_label)
+                self.window.show_all()
+                return False
+
+    @property
     def continueButton(self):
         return self.builder.get_object("continueButton")
 
-- 
1.7.11.7



More information about the anaconda-patches mailing list