Initial Setup should terminate itself automatically if there is nothing to do in it. Example of that is if there are no spokes to be shown.
Vratislav Podzimek (1): Do not schedule hubs with no spokes available (#1006357)
pyanaconda/ui/tui/__init__.py | 5 +++-- pyanaconda/ui/tui/hubs/__init__.py | 3 +++ pyanaconda/ui/tui/hubs/summary.py | 6 +++++- pyanaconda/ui/tui/simpleline/base.py | 13 +++++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-)
If a hub doesn't have any spokes to show, it shouldn't be scheduled to be run in the main loop.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/__init__.py | 5 +++-- pyanaconda/ui/tui/hubs/__init__.py | 3 +++ pyanaconda/ui/tui/hubs/summary.py | 6 +++++- pyanaconda/ui/tui/simpleline/base.py | 13 +++++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py index 299307e..31bcff5 100644 --- a/pyanaconda/ui/tui/__init__.py +++ b/pyanaconda/ui/tui/__init__.py @@ -166,9 +166,10 @@ class TextUserInterface(ui.UserInterface): if hasattr(obj, "set_path"): obj.set_path("spokes", self.paths["spokes"])
- obj.setup(self.ENVIRONMENT) + should_schedule = obj.setup(self.ENVIRONMENT)
- self._app.schedule_screen(obj) + if should_schedule: + self._app.schedule_screen(obj)
def run(self): """Run the interface. This should do little more than just pass diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py index 14e6957..e466b8c 100644 --- a/pyanaconda/ui/tui/hubs/__init__.py +++ b/pyanaconda/ui/tui/hubs/__init__.py @@ -75,6 +75,8 @@ class TUIHub(TUIObject, common.Hub): self._keys[self._spoke_count] = spoke self._spokes[spoke.__class__.__name__] = spoke
+ # only schedule the hub if it has some spokes + return self._spoke_count != 0
def refresh(self, args = None): """This methods fills the self._window list by all the objects @@ -97,6 +99,7 @@ class TUIHub(TUIObject, common.Hub): def input(self, args, key): """Handle user input. Numbers are used to show a spoke, the rest is passed to the higher level for processing.""" + try: number = int(key) self.app.switch_screen_with_return(self._keys[number]) diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py index 3f5f53e..0bc5911 100644 --- a/pyanaconda/ui/tui/hubs/summary.py +++ b/pyanaconda/ui/tui/hubs/summary.py @@ -32,7 +32,9 @@ class SummaryHub(TUIHub): categories = ["source", "localization", "destination", "password", "software", "network"]
def setup(self, environment="anaconda"): - TUIHub.setup(self, environment=environment) + should_schedule = TUIHub.setup(self, environment=environment) + if not should_schedule: + return False
if flags.automatedInstall: sys.stdout.write(_("Starting automated install")) @@ -48,6 +50,8 @@ class SummaryHub(TUIHub): if spoke.changed: spoke.execute()
+ return True + # override the prompt so that we can skip user input on kickstarts # where all the data is in hand. If not in hand, do the actual prompt. def prompt(self, args=None): diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py index b057e15..63d0ce9 100644 --- a/pyanaconda/ui/tui/simpleline/base.py +++ b/pyanaconda/ui/tui/simpleline/base.py @@ -505,8 +505,17 @@ class UIScreen(object): self._page = 0
def setup(self, environment): - """Do additional setup right before this screen is used.""" - pass + """ + Do additional setup right before this screen is used. + + :param environment: environment (see pyanaconda.constants) the UI is running in + :type environment: either FIRSTBOOT_ENVIRON or ANACONDA_ENVIRON + :return: whether this screen should be scheduled or not + :rtype: bool + + """ + + return True
def refresh(self, args = None): """Method which prepares the content desired on the screen to self._window.
On Wed, 2013-09-11 at 10:58 -0400, Chris Lumens wrote:
If a hub doesn't have any spokes to show, it shouldn't be scheduled to be run in the main loop.
How does the GUI behave in this situation?
The GUI hub clicks its Continue button automatically if it has no spokes. See 846af550ec9777396a27aaa8556fc1b9c8f3ee12
anaconda-patches@lists.fedorahosted.org