def process_input_result(self, input_result, should_redraw):
        active_screen = self._get_last_screen()

        if not input_result.was_successful():
            if should_redraw:
                self.redraw()
            else:
                log.debug("Input was not successful, ask for new input.")
                active_screen.ui_screen.get_input_with_error_check(
                    active_screen.args)
        else:
            if input_result == UserInputAction.NOOP:
                return

            if input_result == UserInputAction.REDRAW:
                self.redraw()
            elif input_result == UserInputAction.CLOSE:
                self.close_screen()
            elif input_result == UserInputAction.QUIT:
                if self.quit_screen:
                    self.push_screen_modal(self.quit_screen)
                    try:
                        if self.quit_screen.answer is True:
                            raise ExitMainLoop()

                        self.redraw()
                    except AttributeError as e:
                        raise ExitMainLoop() from e
                else:
                    raise ExitMainLoop()
    def show_all(self):
        super().show_all()
        from pyanaconda.installation import doInstall, doConfiguration
        from pyanaconda.threading import threadMgr, AnacondaThread

        thread_args = (self.storage, self.payload, self.data, self.instclass)

        threadMgr.add(
            AnacondaThread(name=THREAD_INSTALL,
                           target=doInstall,
                           args=thread_args))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(
            AnacondaThread(name=THREAD_CONFIGURATION,
                           target=doConfiguration,
                           args=thread_args))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        util.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [
                KS_REBOOT, KS_SHUTDOWN
        ]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            raise ExitMainLoop()
    def close_screen(self, closed_from=None):
        """Close the currently displayed screen and exit it's main loop if necessary.

        Next screen from the stack is then displayed.
        """
        screen = self._screen_stack.pop()
        log.debug("Closing screen %s from %s", screen, closed_from)

        # User can react when screen is closing
        screen.ui_screen.closed()

        if closed_from is not None and closed_from is not screen.ui_screen:
            raise RenderUnexpectedError(
                "You are trying to close screen %s from screen %s! "
                "This is most probably not intentional." %
                (closed_from, screen.ui_screen))

        if screen.execute_new_loop:
            self._event_loop.close_loop()

        # redraw screen if there is what to redraw
        # and if it is not modal screen (modal screen parent is blocked)
        if not self._screen_stack.empty() and not screen.execute_new_loop:
            self.redraw()

        # we can't draw anything more. Kill the application.
        if self._screen_stack.empty():
            raise ExitMainLoop()
Exemplo n.º 4
0
    def show_all(self):
        super().show_all()
        from pyanaconda.installation import run_installation
        from pyanaconda.threading import threadMgr, AnacondaThread

        threadMgr.add(AnacondaThread(
            name=THREAD_INSTALL,
            target=run_installation,
            args=(self.payload, self.data))
        )

        # This will run until we're all done with the install thread.
        self._update_progress()

        util.ipmi_report(IPMI_FINISHED)

        if conf.license.eula:
            # Notify user about the EULA (if any).
            print(_("Installation complete"))
            print('')
            print(_("Use of this product is subject to the license agreement found at:"))
            print(conf.license.eula)
            print('')

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            raise ExitMainLoop()
    def close_loop(self):
        """Close active event loop.

        Close an event loop created by the `execute_new_loop()` method.
        """
        super().close_loop()
        self.process_signals()

        # TODO: Remove when python3-astroid 1.5.3 will be in Fedora
        # pylint: disable=not-context-manager
        with self._lock:
            self._event_queues.pop()
            try:
                self._active_queue = self._event_queues[-1]
            except IndexError:
                log.error("No more event queues to work with!")
                raise ExitMainLoop()

        self._run_loop = False
    def show_all(self):
        super().show_all()
        from pyanaconda.installation import RunInstallationTask

        # Start the installation task.
        self._task = RunInstallationTask(payload=self.payload,
                                         ksdata=self.data)
        self._task.progress_changed_signal.connect(self._on_progress_changed)
        self._task.stopped_signal.connect(self._on_installation_done)
        self._task.start()

        log.debug("The installation has started.")

        # This will run until the task is finished.
        loop = App.get_event_loop()
        loop.process_signals(return_after=ScreenReadySignal)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [
                KS_REBOOT, KS_SHUTDOWN
        ]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            raise ExitMainLoop()
    def _get_last_screen(self):
        if self._screen_stack.empty():
            raise ExitMainLoop()

        return self._screen_stack.pop(False)
 def _handler_raise_ExitMainLoop_exception(self, signal, data):
     raise ExitMainLoop()
 def input(self, args, key):
     # There is nothing to do here, just raise to exit the spoke
     raise ExitMainLoop()