From b43d29f15701e305007b34febefbcb3686d42be9 Mon Sep 17 00:00:00 2001 From: Vladimir Slavik Date: Jun 28 2021 14:21:37 +0000 Subject: Remove autostep functionality Autostep did not work for some time already, this merely removes the no longer used code. Automatic screenshots are gone with this, too. Manual screenshots remain available. Resolves: rhbz#1976913 (cherry picked from commit 8a2645135cbb21151372369c8fb95e1d45f0b538) --- diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py index 9c56068..f6b4330 100644 --- a/pyanaconda/core/constants.py +++ b/pyanaconda/core/constants.py @@ -264,7 +264,6 @@ TAR_SUFFIX = (".tar", ".tbz", ".tgz", ".txz", ".tar.bz2", "tar.gz", "tar.xz") # screenshots SCREENSHOTS_DIRECTORY = "/tmp/anaconda-screenshots" -SCREENSHOTS_TARGET_DIRECTORY = "/root/anaconda-screenshots" CMDLINE_FILES = [ "/proc/cmdline", diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index 6fab33e..825bb72 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -25,7 +25,6 @@ import subprocess import unicodedata # Used for ascii_lowercase, ascii_uppercase constants import string # pylint: disable=deprecated-module -import shutil import tempfile import re import gettext @@ -46,7 +45,6 @@ from pyanaconda.core.process_watchers import WatchProcesses from pyanaconda.core.constants import DRACUT_SHUTDOWN_EJECT, TRANSLATIONS_UPDATE_DIR, \ IPMI_ABORTED, X_TIMEOUT, TAINT_HARDWARE_UNSUPPORTED, TAINT_SUPPORT_REMOVED, \ WARNING_HARDWARE_UNSUPPORTED, WARNING_SUPPORT_REMOVED -from pyanaconda.core.constants import SCREENSHOTS_DIRECTORY, SCREENSHOTS_TARGET_DIRECTORY from pyanaconda.errors import RemovedModuleError from pyanaconda.anaconda_logging import program_log_lock @@ -1219,24 +1217,6 @@ def join_paths(path, *paths): return os.path.join(path, *new_paths) -def save_screenshots(): - """Save screenshots to the installed system""" - if not os.path.exists(SCREENSHOTS_DIRECTORY): - # there are no screenshots to copy - return - target_path = sysroot_path(SCREENSHOTS_TARGET_DIRECTORY) - log.info("saving screenshots taken during the installation to: %s", target_path) - try: - # create the screenshots directory - mkdirChain(target_path) - # copy all screenshots - for filename in os.listdir(SCREENSHOTS_DIRECTORY): - shutil.copy(os.path.join(SCREENSHOTS_DIRECTORY, filename), target_path) - - except OSError: - log.exception("saving screenshots to installed system failed") - - def touch(file_path): """Create an empty file.""" # this misrrors how touch works - it does not diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 2db5c6e..10b37ab 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -41,7 +41,7 @@ from pyanaconda import threading as anaconda_threading from pyanaconda.core.glib import Bytes, GError from pyanaconda.ui import UserInterface, common -from pyanaconda.ui.gui.utils import gtk_call_once, unbusyCursor +from pyanaconda.ui.gui.utils import unbusyCursor from pyanaconda.core.async_utils import async_action_wait from pyanaconda.ui.gui.utils import watch_children, unwatch_children from pyanaconda.ui.gui.helpers import autoinstall_stopped @@ -122,8 +122,6 @@ class GUIObject(common.UIObject): hide_help_button = False translationDomain = "anaconda" - handles_autostep = False - def __init__(self, data): """Create a new UIObject instance, including loading its uiFile and all UI-related objects. @@ -165,14 +163,6 @@ class GUIObject(common.UIObject): self.builder.connect_signals(self) - self._automaticEntry = False - self._autostepRunning = False - self._autostepDone = False - self._autostepDoneCallback = None - - # this indicates if the screen is the last spoke to be processed for a hub - self.lastAutostepSpoke = False - def initialize(self): """Initialize the GUI of this instance. Runs once. @@ -204,85 +194,6 @@ class GUIObject(common.UIObject): raise IOError("Could not load UI file '%s' for object '%s'" % (self.uiFile, self)) @property - def automaticEntry(self): - """Report if the given GUIObject has been displayed under automatic control - - This is needed for example for installations with an incomplete kickstart, - as we need to differentiate the automatic screenshot pass from the user - entering a spoke to manually configure things. We also need to skip applying - changes if the spoke is entered automatically. - """ - return self._automaticEntry - - @automaticEntry.setter - def automaticEntry(self, value): - self._automaticEntry = value - - @property - def autostepRunning(self): - """Report if the GUIObject is currently running autostep""" - return self._autostepRunning - - @autostepRunning.setter - def autostepRunning(self, value): - self._autostepRunning = value - - @property - def autostepDone(self): - """Report if autostep for this GUIObject has been finished""" - return self._autostepDone - - @autostepDone.setter - def autostepDone(self, value): - self._autostepDone = value - - @property - def autostepDoneCallback(self): - """A callback to be run once autostep has been finished""" - return self._autostepDoneCallback - - @autostepDoneCallback.setter - def autostepDoneCallback(self, callback): - self._autostepDoneCallback = callback - - def autostep(self): - """Autostep through this graphical object and through - any graphical objects managed by it (such as through spokes for a hub) - """ - # report that autostep is running to prevent another from starting - self.autostepRunning = True - # take a screenshot of the current graphical object - if self.data.autostep.autoscreenshot: - # as autostep is triggered just before leaving a screen, - # we can safely take a screenshot of the "parent" object at once - # without using idle_add - self.main_window.take_screenshot(self.__class__.__name__) - self._doAutostep() - # done - self.autostepRunning = False - self.autostepDone = True - self._doPostAutostep() - - # run the autostep-done callback (if any) - # pylint: disable=not-callable - if self.autostepDoneCallback: - self.autostepDoneCallback(self) - - def _doPostAutostep(self): - """To be overridden by the given GUIObject sub-class with custom code - that brings the GUI from the autostepping mode back to the normal mode. - This usually means to "click" the continue button or its equivalent. - """ - pass - - def _doAutostep(self): - """To be overridden by the given GUIObject sub-class with customized - autostepping code - if needed - (this is for example used to step through spokes in a hub) - """ - pass - - @property def window(self): """Return the object out of the GtkBuilder representation previously loaded by the load method. @@ -561,27 +472,6 @@ class MainWindow(Gtk.Window): self._setVisibleChild(spoke) - # autostep through the spoke if required - if spoke.automaticEntry: - # we need to use idle_add here to give GTK time to render the spoke - gtk_call_once(self._autostep_spoke, spoke) - - def _autostep_spoke(self, spoke): - """Step through a spoke and make a screenshot if required. - If this is the last spoke to be autostepped on a hub return to - the hub so that we can proceed to the next one. - """ - # it might be possible that autostep is specified, but autoscreenshot isn't - if spoke.data.autostep.autoscreenshot: - spoke.take_screenshot(spoke.__class__.__name__) - - if spoke.autostepDoneCallback: - spoke.autostepDoneCallback(spoke) - - # if this is the last spoke then return to hub - if spoke.lastAutostepSpoke: - self.returnToHub() - def returnToHub(self): """Exit a spoke and return to a hub.""" # Slide back down over the spoke @@ -972,21 +862,6 @@ class GraphicalUserInterface(UserInterface): ### SIGNAL HANDLING METHODS ### def _on_continue_clicked(self, window, user_data=None): - # Autostep needs to be triggered just before switching to the next screen - # (or before quiting the installation if there are no more screens) to be consistent - # in both fully automatic kickstart installation and for installation with an incomplete - # kickstart. Therefore we basically "hook" the continue-clicked signal, start autostepping - # and ignore any other continue-clicked signals until autostep is done. - # Once autostep finishes, it emits the appropriate continue-clicked signal itself, - # switching to the next screen (if any). - if self.data.autostep.seen and self._currentAction.handles_autostep: - if self._currentAction.autostepRunning: - log.debug("ignoring the continue-clicked signal - autostep is running") - return - elif not self._currentAction.autostepDone: - self._currentAction.autostep() - return - if not window.get_may_continue() or window != self._currentAction.window: return @@ -996,9 +871,6 @@ class GraphicalUserInterface(UserInterface): # If we're on the last screen, clicking Continue quits. if len(self._actions) == 1: - # save the screenshots to the installed system before killing Anaconda - # (the kickstart post scripts run to early, so we need to copy the screenshots now) - util.save_screenshots() Gtk.main_quit() return diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py index e58c127..2b1f851 100644 --- a/pyanaconda/ui/gui/hubs/__init__.py +++ b/pyanaconda/ui/gui/hubs/__init__.py @@ -57,7 +57,6 @@ class Hub(GUIObject, common.Hub): :parts: 3 """ - handles_autostep = True _hubs_collection = [] # Should we automatically go to next hub if processing is done and there are no @@ -108,9 +107,6 @@ class Hub(GUIObject, common.Hub): # cleaered. self._checker_ignore = False - self._spokesToStepIn = [] - self._spokeAutostepIndex = 0 - self._gridColumns = 3 def _createBox(self): @@ -414,11 +410,10 @@ class Hub(GUIObject, common.Hub): if not self._inSpoke: return - # don't apply any actions if the spoke was visited automatically - if spoke.automaticEntry: - spoke.automaticEntry = False - return + spoke.visitedSinceApplied = True + # Don't take visitedSinceApplied into account here. It will always be + # True from the line above. if spoke.changed and (not spoke.skipTo or (spoke.skipTo and spoke.applyOnSkip)): spoke.apply() spoke.execute() @@ -446,49 +441,3 @@ class Hub(GUIObject, common.Hub): # Otherwise, switch back to the hub (that's us!) else: self.main_window.returnToHub() - - def _doAutostep(self): - """Autostep through all spokes managed by this hub""" - log.info("autostepping through all spokes on hub %s", self.__class__.__name__) - - # create a list of all spokes in reverse alphabetic order, we will pop() from it when - # processing all the spokes so the screenshots will actually be in alphabetic order - self._spokesToStepIn = list(reversed(sorted(self._spokes.values(), key=lambda x: x.__class__.__name__))) - - # we can't just loop over all the spokes due to the asynchronous nature of GtkStack, so we start by - # autostepping to the first spoke, this will trigger a callback that steps to the next spoke, - # until we run out of unvisited spokes - self._autostepSpoke() - - def _autostepSpoke(self): - """Process a single spoke, if no more spokes are available report autostep as finished for the hub.""" - # do we have some spokes to work on ? - if self._spokesToStepIn: - # take one of them - spoke = self._spokesToStepIn.pop() - - # increment the number of processed spokes - self._spokeAutostepIndex += 1 - - log.debug("stepping to spoke %s (%d/%d)", spoke.__class__.__name__, self._spokeAutostepIndex, len(self._spokes)) - - # notify the spoke about the upcoming automatic entry and set a callback that will be called - # once the spoke has been successfully processed - spoke.automaticEntry = True - spoke.autostepDoneCallback = lambda x: self._autostepSpoke() - - # if this is the last spoke, tell it to return to hub once processed - if self._spokesToStepIn == []: - spoke.lastAutostepSpoke = True - gtk_call_once(self._on_spoke_clicked, None, None, spoke) - else: - log.info("autostep for hub %s finished", self.__class__.__name__) - gtk_call_once(self._doPostAutostep) - - def _doPostAutostep(self): - if self._spokesToStepIn: - # there are still spokes that need to be stepped in - return - # we are done, re-emit the continue clicked signal we "consumed" previously - # so that the Anaconda GUI can switch to the next screen (or quit) - self.window.emit("continue-clicked") diff --git a/pyanaconda/ui/gui/spokes/__init__.py b/pyanaconda/ui/gui/spokes/__init__.py index 83e7330..33f3301 100644 --- a/pyanaconda/ui/gui/spokes/__init__.py +++ b/pyanaconda/ui/gui/spokes/__init__.py @@ -18,7 +18,6 @@ from pyanaconda.ui import common from pyanaconda.ui.gui import GUIObject -from pyanaconda.ui.gui.utils import gtk_call_once from pyanaconda.ui.lib.help import start_yelp from pyanaconda.anaconda_loggers import get_module_logger @@ -35,8 +34,6 @@ class StandaloneSpoke(GUIObject, common.StandaloneSpoke): :parts: 3 """ - handles_autostep = True - def __init__(self, data, storage, payload): GUIObject.__init__(self, data) common.StandaloneSpoke.__init__(self, storage, payload) @@ -47,11 +44,6 @@ class StandaloneSpoke(GUIObject, common.StandaloneSpoke): def _on_continue_clicked(self, window, user_data=None): self.apply() - def _doPostAutostep(self): - # we are done, re-emit the continue clicked signal we "consumed" previously - # so that the Anaconda GUI can switch to the next screen - gtk_call_once(self.window.emit, "continue-clicked") - # Inherit abstract methods from common.NormalSpoke # pylint: disable=abstract-method diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py index a7cb75c..ef59305 100644 --- a/pyanaconda/ui/gui/spokes/welcome.py +++ b/pyanaconda/ui/gui/spokes/welcome.py @@ -324,9 +324,8 @@ class WelcomeLanguageSpoke(StandaloneSpoke, LangLocaleHandler): # Override the default in StandaloneSpoke so we can display the beta # warning dialog first. def _on_continue_clicked(self, window, user_data=None): - # Don't display the betanag dialog if this is the final release or - # when autostep has been requested as betanag breaks the autostep logic. - if not isFinal and not self.data.autostep.seen: + # Don't display the betanag dialog if this is the final release. + if not isFinal: dlg = self.builder.get_object("betaWarnDialog") with self.main_window.enlightbox(dlg): rc = dlg.run()