# pyanaconda.ui package — Anaconda 25.14 documentation

# pyanaconda.ui package

## Subpackages

- pyanaconda.ui.categories package
  - Submodules
  - pyanaconda.ui.categories.customization module
  - pyanaconda.ui.categories.localization module
  - pyanaconda.ui.categories.software module
  - pyanaconda.ui.categories.system module
  - pyanaconda.ui.categories.user_settings module
  - Module contents
- pyanaconda.ui.gui package
  - Subpackages
    - pyanaconda.ui.gui.hubs package
      - Submodules
      - pyanaconda.ui.gui.hubs.progress module
      - pyanaconda.ui.gui.hubs.summary module
      - Module contents
    - pyanaconda.ui.gui.spokes package
      - Subpackages
        - pyanaconda.ui.gui.spokes.advstorage package
          - Submodules
          - pyanaconda.ui.gui.spokes.advstorage.dasd module
          - pyanaconda.ui.gui.spokes.advstorage.fcoe module
          - pyanaconda.ui.gui.spokes.advstorage.iscsi module
          - pyanaconda.ui.gui.spokes.advstorage.zfcp module
          - Module contents
        - pyanaconda.ui.gui.spokes.lib package
          - Submodules
          - pyanaconda.ui.gui.spokes.lib.accordion module
          - pyanaconda.ui.gui.spokes.lib.cart module
          - pyanaconda.ui.gui.spokes.lib.custom_storage_helpers module
          - pyanaconda.ui.gui.spokes.lib.dasdfmt module
          - pyanaconda.ui.gui.spokes.lib.detailederror module
          - pyanaconda.ui.gui.spokes.lib.entropy_dialog module
          - pyanaconda.ui.gui.spokes.lib.lang_locale_handler module
          - pyanaconda.ui.gui.spokes.lib.passphrase module
          - pyanaconda.ui.gui.spokes.lib.refresh module
          - pyanaconda.ui.gui.spokes.lib.resize module
          - pyanaconda.ui.gui.spokes.lib.summary module
          - Module contents
      - Submodules
      - pyanaconda.ui.gui.spokes.custom module
      - pyanaconda.ui.gui.spokes.datetime_spoke module
      - pyanaconda.ui.gui.spokes.filter module
      - pyanaconda.ui.gui.spokes.keyboard module
      - pyanaconda.ui.gui.spokes.langsupport module
      - pyanaconda.ui.gui.spokes.network module
      - pyanaconda.ui.gui.spokes.password module
      - pyanaconda.ui.gui.spokes.software module
      - pyanaconda.ui.gui.spokes.source module
      - pyanaconda.ui.gui.spokes.storage module
      - pyanaconda.ui.gui.spokes.user module
      - pyanaconda.ui.gui.spokes.welcome module
      - Module contents
  - Submodules
  - pyanaconda.ui.gui.helpers module
  - pyanaconda.ui.gui.utils module
  - pyanaconda.ui.gui.xkl_wrapper module
  - Module contents
- pyanaconda.ui.lib package
  - Submodules
  - pyanaconda.ui.lib.disks module
  - pyanaconda.ui.lib.entropy module
  - pyanaconda.ui.lib.space module
  - Module contents
- pyanaconda.ui.tui package
  - Subpackages
    - pyanaconda.ui.tui.hubs package
      - Submodules
      - pyanaconda.ui.tui.hubs.summary module
      - Module contents
    - pyanaconda.ui.tui.simpleline package
      - Submodules
      - pyanaconda.ui.tui.simpleline.base module
      - pyanaconda.ui.tui.simpleline.widgets module
      - Module contents
    - pyanaconda.ui.tui.spokes package
      - Submodules
      - pyanaconda.ui.tui.spokes.askvnc module
      - pyanaconda.ui.tui.spokes.langsupport module
      - pyanaconda.ui.tui.spokes.network module
      - pyanaconda.ui.tui.spokes.password module
      - pyanaconda.ui.tui.spokes.progress module
      - pyanaconda.ui.tui.spokes.shell_spoke module
      - pyanaconda.ui.tui.spokes.software module
      - pyanaconda.ui.tui.spokes.source module
      - pyanaconda.ui.tui.spokes.storage module
      - pyanaconda.ui.tui.spokes.time_spoke module
      - pyanaconda.ui.tui.spokes.user module
      - pyanaconda.ui.tui.spokes.warnings_spoke module
      - Module contents
  - Submodules
  - pyanaconda.ui.tui.tuiobject module
  - Module contents

## Submodules

## pyanaconda.ui.common module

class `pyanaconda.ui.common.``FirstbootOnlySpokeMixIn`

  Bases: `object`

  This MixIn class marks Spokes as usable for Firstboot.

  classmethod `should_run`(environment, data)

    This method is responsible for beginning Spoke initialization in the firstboot environment (even before __init__).

    It should return True if the spoke is to be shown and False if it should be skipped.

    It might be called multiple times, with or without (None) the data argument.

class `pyanaconda.ui.common.``FirstbootSpokeMixIn`

  Bases: `object`

  This MixIn class marks Spokes as usable for Firstboot and Anaconda.

  classmethod `should_run`(environment, data)

    This method is responsible for beginning Spoke initialization in the firstboot environment (even before __init__).

    It should return True if the spoke is to be shown and False if it should be skipped.

    It might be called multiple times, with or without (None) the data argument.

class `pyanaconda.ui.common.``Hub`(storage, payload, instclass)

  Bases: `object`

  A Hub is an overview UI screen. A Hub consists of one or more grids of configuration options that the user may choose from. Each grid is provided by a SpokeCategory, and each option is provided by a Spoke. When the user dives down into a Spoke and is finished interacting with it, they are returned to the Hub.

  Some Spokes are required. The user must interact with all required Spokes before they are allowed to proceed to the next stage of installation.

  From a layout perspective, a Hub is the entirety of the screen, though the screen itself can be roughly divided into thirds. The top third is some basic navigation information (where you are, what you’re installing). The middle third is the grid of Spokes. The bottom third is an action area providing additional buttons (quit, continue) or progress information (during package installation).

  Installation may consist of multiple chained Hubs, or Hubs with additional standalone screens either before or after them.

  Create a new Hub instance.

  The arguments this base class accepts defines the API that Hubs have to work with. A Hub does not get free reign over everything in the anaconda class, as that would be a big mess. Instead, a Hub may count on the following:

  data – An instance of a pykickstart Handler object. The
    Hub uses this to populate its UI with defaults and to pass results back after it has run. The data property must be implemented by classes inheriting from Hub.
  storage – An instance of storage.Storage. This is useful for
    determining what storage devices are present and how they are configured.
  payload – An instance of a packaging.Payload subclass. This
    is useful for displaying and selecting packages to install, and in carrying out the actual installation.
  instclass – An instance of a BaseInstallClass subclass. This
    is useful for determining distribution-specific installation information like default package selections and default partitioning.
  `data`
  `entry_logger`()

    Log immediately before this hub is about to be displayed on the screen. Subclasses may override this method if they want to log more specific information, but an overridden method should finish by calling this method so the entry will be logged.

    Note that due to how the GUI flows, hubs are only entered once - when they are initially displayed. Going to a spoke from a hub and then coming back to the hub does not count as exiting and entering.

  `exit_logger`()

    Log when a user leaves the hub. Subclasses may override this method if they want to log more specific information, but an overridden method should finish by calling this method so the exit will be logged.

    Note that due to how the GUI flows, hubs are not exited when the user selects a spoke from the hub. They are only exited when the continue or quit button is clicked on the hub.

  `set_path`(path_id, paths)

    Update the paths attribute with list of tuples in the form (module name format string, directory name)

  `storage`

class `pyanaconda.ui.common.``NormalSpoke`(storage, payload, instclass)

  Bases: `pyanaconda.ui.common.Spoke`

  A NormalSpoke is a Spoke subclass that is displayed when the user selects something on a Hub. This is what most Spokes in anaconda will be based on.

  From a layout perspective, a NormalSpoke takes up the entire screen therefore hiding the Hub and its action area. The NormalSpoke also provides some basic navigation information (where you are, what you’re installing, how to get back to the Hub) at the top of the screen.

  Create a NormalSpoke instance.

  `indirect`

    If this property returns True, then this spoke is considered indirect. An indirect spoke is one that can only be reached through another spoke instead of directly through the hub. One example of this is the custom partitioning spoke, which may only be accessed through the install destination spoke.

    Indirect spokes do not need to provide a completed or status property.

    For most spokes, overriding this property is unnecessary.

  `ready`

    Returns True if the Spoke has all the information required to be displayed. Almost all spokes should keep the default value here. Only override this method if the Spoke requires some potentially long-lived process (like storage probing) before it’s ready.

    A Spoke may be marked as ready or not by calling send_ready or send_not_ready from pyanaconda.ui.communication with the target Spoke’s class name.

    While a Spoke is not ready, a progress message may be shown to give the user some feedback. See the status property for details.

class `pyanaconda.ui.common.``Spoke`(storage, payload, instclass)

  Bases: `object`

  A Spoke is a single configuration screen. There are several different places where a Spoke can be displayed, each of which will have its own unique class. A Spoke is typically used when an element in the Hub is selected but can also be displayed before a Hub or between multiple Hubs.

  What amount of the UI layout a Spoke provides depends upon where it is to be shown. Regardless, the UI of a Spoke should be given by an interface description file like glade as often as possible, though this is not a strict requirement.

  Class attributes:

  category – Under which SpokeCategory shall this Spoke be displayed
    in the Hub? This is a reference to a Hub subclass (not an object, but the class itself). If no category is given, this Spoke will not be displayed. Note that category is not required for any Spokes appearing before or after a Hub.
  icon – The name of the icon to be displayed in the SpokeSelector
    widget corresponding to this Spoke instance. If no icon is given, the default from SpokeSelector will be used.
  title – The title to be displayed in the SpokeSelector widget
    corresponding to this Spoke instance. If no title is given, the default from SpokeSelector will be used.

  Create a new Spoke instance.

  The arguments this base class accepts defines the API that spokes have to work with. A Spoke does not get free reign over everything in the anaconda class, as that would be a big mess. Instead, a Spoke may count on the following:

  data – An instance of a pykickstart Handler object. The
    Spoke uses this to populate its UI with defaults and to pass results back after it has run. The data property must be implemented by classes inherting from Spoke.
  storage – An instance of storage.Storage. This is useful for
    determining what storage devices are present and how they are configured.
  payload – An instance of a packaging.Payload subclass. This
    is useful for displaying and selecting packages to install, and in carrying out the actual installation.
  instclass – An instance of a BaseInstallClass subclass. This
    is useful for determining distribution-specific installation information like default package selections and default partitioning.
  `apply`()

    Apply the selections made on this Spoke to the object’s preset data object. This method must be provided by every subclass.

  `category` = None
  `changed`

    Have the values on the spoke changed since the last time it was run? If not, the apply and execute methods will be skipped. This is to avoid the spoke doing potentially long-lived and destructive actions that are completely unnecessary.

  `completed`

    Has this spoke been visited and completed? If not and the spoke is mandatory, a special warning icon will be shown on the Hub beside the spoke, and a highlighted message will be shown at the bottom of the Hub. Installation will not be allowed to proceed until all mandatory spokes are complete.

    WARNING: This can be called before the spoke is finished initializing if the spoke starts a thread. It should make sure it doesn’t access things until they are completely setup.

  `configured`

    This method returns a list of textual ids that should be written into the after-install customization status file for the firstboot and GIE to know that the spoke was configured and what value groups were provided.

  `data`
  `entry_logger`()

    Log immediately before this spoke is about to be displayed on the screen. Subclasses may override this method if they want to log more specific information, but an overridden method should finish by calling this method so the entry will be logged.

  `execute`()

    Cause the data object to take effect on the target system. This will usually be as simple as calling one or more of the execute methods on the data object. This method does not need to be provided by all subclasses.

    This method will be called in two different places: (1) Immediately after initialize on kickstart installs. (2) Immediately after apply in all cases.

  `exit_logger`()

    Log when a user leaves the spoke. Subclasses may override this method if they want to log more specific information, but an overridden method should finish by calling this method so the exit will be logged.

  `finished`()

    Called when exiting the Summary Hub

    This can be used to cleanup the spoke before continuing the installation. This method is optional.

  `icon` = None
  `mandatory`

    Mark this spoke as mandatory. Installation will not be allowed to proceed until all mandatory spokes are complete.

    Spokes are mandatory unless marked as not being so.

  `sensitive`

    May the user click on this spoke’s selector and be taken to the spoke? This is different from the showable property. A spoke that is not sensitive will still be shown on the hub, but the user may not enter it. This is also different from the ready property. A spoke that is not ready may not be entered, but the spoke may become ready in the future. A spoke that is not sensitive will likely not become so.

    Most spokes will not want to override this method.

  classmethod `should_run`(environment, data)

    This method is responsible for beginning Spoke initialization.

    It should return True if the spoke is to be shown while in <environment> and False if it should be skipped.

    It might be called multiple times, with or without (None) the data argument.

  `status`

    Given the current status of whatever this Spoke configures, return a very brief string. The purpose of this is to display something on the Hub under the Spoke’s title so the user can tell at a glance how things are configured.

    A spoke’s status line on the Hub can also be overloaded to provide information about why a Spoke is not yet ready, or if an error has occurred when setting it up. This can be done by calling send_message from pyanaconda.ui.communication with the target Spoke’s class name and the message to be displayed.

    If the Spoke was not yet ready when send_message was called, the message will be overwritten with the value of this status property when the Spoke becomes ready.

  `storage`
  `title` = None

class `pyanaconda.ui.common.``StandaloneSpoke`(storage, payload, instclass)

  Bases: `pyanaconda.ui.common.Spoke`

  A StandaloneSpoke is a Spoke subclass that is displayed apart from any Hub. It is suitable to be used as a Welcome screen.

  From a layout perspective, a StandaloneSpoke provides a full screen interface. However, it also provides navigation information at the top and bottom of the screen that makes it look like the StandaloneSpoke fits into some other UI element.

  Class attributes:

  preForHub/postForHub – A reference to a Hub subclass this Spoke is
    either a pre or post action for. Only one of these may be set at a time. Note that all post actions will be run for one hub before any pre actions for the next.
  priority – This value is used to sort pre and post
    actions. The lower a value, the earlier it will be run. So a value of 0 for a post action ensures it will run immediately after a Hub, while a value of 0 for a pre actions means it will run as the first thing.

  Create a StandaloneSpoke instance.

  `postForHub` = None
  `preForHub` = None
  `status`

class `pyanaconda.ui.common.``UIObject`(data)

  Bases: `object`

  This is the base class from which all other UI classes are derived. It thus contains only attributes and methods that are common to everything else. It should not be directly instantiated.

  Create a new UIObject instance, including loading its uiFile and all UI-related objects.

  Instance attributes:

  data – An instance of a pykickstart Handler object. The Hub
    never directly uses this instance. Instead, it passes it down into Spokes when they are created and applied. The Hub simply stores this instance so it doesn’t need to be passed by the user.
  `data`
  `initialize`()

    Perform whatever actions are necessary to pre-fill the UI with values. This method is called only once, after the object is created. The difference between this method and __init__ is that this method may take a long time (especially for NormalSpokes) and thus may be run in its own thread.

  `refresh`()

    Perform whatever actions are necessary to reset the UI immediately before it is displayed. This method is called every time a screen is shown, which could potentially be several times in the case of a NormalSpoke. Thus, it’s important to not do things like populate stores (which could result in the store having duplicate entries) or anything that takes a long time (as that will result in a delay between the user’s action and showing the results).

    For anything potentially long-lived, use the initialize method.

  `showable`

    Should this object even be shown? This method is useful for checking some precondition before this screen is shown. If False is returned, the screen will be skipped and the object destroyed.

  `teardown`()

    Perform whatever actions are necessary to clean up after this object is done. It’s not necessary for every subclass to have an instance of this method.

    NOTE: It is important for this method to not destroy self.window if you are making a Spoke or Hub subclass. It is assumed that once these are instantiated, they live until the program terminates. This is required for various status notifications.

`pyanaconda.ui.common.``collect`(module_pattern, path, pred)

  Traverse the directory (given by path), import all files as a module module_pattern % filename and find all classes within that match the given predicate. This is then returned as a list of classes.

  It is suggested you use collect_categories or collect_spokes instead of this lower-level method.

  Parameters:

  - module_pattern (string) – the full name pattern (pyanaconda.ui.gui.spokes.%s) we want to assign to imported modules
  - path (string) – the directory we are picking up modules from
  - pred (function with one argument returning True or False) – function which marks classes as good to import

`pyanaconda.ui.common.``collectCategoriesAndSpokes`(paths, klass, displaymode)

  Collects categories and spokes to be displayed on this Hub

  Parameters: | paths – dictionary mapping categories, spokes, and hubs to their their respective search path(s)
  Returns: | dictionary mapping category class to list of spoke classes
  Return type: | dictionary[category class] -> [ list of spoke classes ]

`pyanaconda.ui.common.``collect_categories`(mask_paths, displaymode)

  Return a list of all category subclasses. Look for them in modules imported as module_mask % basename(f) where f is name of all files in path.

`pyanaconda.ui.common.``collect_spokes`(mask_paths, category)

  Return a list of all spoke subclasses that should appear for a given category. Look for them in files imported as module_path % basename(f)

  Parameters: | mask_paths (list of (mask, path)) – list of mask, path tuples to search for classes
  Returns: | list of Spoke classes belonging to category
  Return type: | list of Spoke classes

## pyanaconda.ui.communication module

## pyanaconda.ui.helpers module

class `pyanaconda.ui.helpers.``InputCheck`(parent, input_obj, run_check, data=None)

  Bases: `object`

  Handle an input validation check.

  This class is used by classes that implement InputCheckHandler to manage and manipulate input validation check instances.

  Create a new input validation check.

  Parameters:

  - parent (InputCheckHandler) – The InputCheckHandler object to which this check is being added.
  - input_obj (function) – An object representing the input to check.
  - run_check (function) – A function to call to perform the input check. This function is called with the InputCheck object as a parameter. The return value an object representing the error state, or CHECK_OK if the check succeeds.
  - data – Optional data associated with the input check

  `CHECK_OK` = None
  `CHECK_SILENT` = ''
  `check_status`

    The current status of the check

  `data`

    Optional data associated with the input check.

  `enabled`

    Whether the check is enabled or not.

    Disabling a check indicates that the status will not change if the input changes. The value of check_status will be the result of the last time the InputCheck was run when enabled. Disabled checks will not be included in InputCheckHandler.failed_checks.

  `input_obj`

    The input to check.

  `run_check`

    A function to call to perform the input check.

  `update_check_status`()

    Run an input validation check.

class `pyanaconda.ui.helpers.``InputCheckHandler`

  Bases: `object`

  Provide a framework for adding input validation checks to a screen.

  This helper class provides a mean of defining and associating input validation checks with an input screen. Running the checks and acting upon the results is left up to the subclasses. Classes implementing InputCheckHandler should ensure that the checks are run at the appropriate times (e.g., calling InputCheck.update_check_status when input is changed), and that input for the screen is not accepted if self.failed_checks is not empty.

  See GUIInputCheckHandler and GUISpokeInputCheckHandler for additional functionality.

  `add_check`(input_obj, run_check, data=None)

    Add an input validation check to this object.

    Parameters:

    - input_obj – An object representing the input to check.
    - run_check (function) – A function to call to perform the input check. This function is called with the InputCheck object as a parameter. The return value an object representing the error state, or CHECK_OK if the check succeeds.
    - data – Optional data associated with the input check

    Returns: | The InputCheck object created.
    Return type: | InputCheck

  `add_re_check`(input_obj, regex, message)

    Add a check using a regular expression.

    Parameters:

    - input_obj (function) – An object representing the input to check.
    - regex (re.RegexObject) – The regular expression to check input against.
    - message (str) – A message to return for failed checks

    Returns: | The InputCheck object created.
    Return type: | InputCheck

  `checks`

    An iterator over all input checks

  `failed_checks`

    A generator of all failed input checks

  `failed_checks_with_message`

    A generator of all failed input checks with an error message

  `get_input`(input_obj)

    Return the input string from an input object.

    Parameters: | input_obj – The input object
    Returns: | An input string
    Return type: | str

  `remove_check`(inputcheck)

    Remove an input check.

    If the check being removed is not in the OK status, the status will be set to CHECK_OK and set_status will be called.

    Parameters: | InputCheck (inputcheck) – the InputCheck object to remove
    Raises ValueError:
    | if the inputcheck does not exist for this InputCheckHandler

  `set_status`(inputcheck)

    Update the status of the window from the input validation results.

    This function could, for example, set or clear an error on the window, or display a message near an input area with invalid data.

    Parameters: | inputcheck (InputCheck) – The InputCheck object whose status last changed.

class `pyanaconda.ui.helpers.``SourceSwitchHandler`

  Bases: `object`

  A class that can be used as a mixin handling installation source switching. It will correctly switch to the new method and cleanup any previous method set.

  `data`
  `set_source_cdrom`()

    Switch to cdrom install source

  `set_source_closest_mirror`()

    Switch to the closest mirror install source

  `set_source_hdd_iso`(device, iso_path)

    Switch to the HDD ISO install source :param partition: name of the partition hosting the ISO :type partition: string :param iso_path: full path to the source ISO file :type iso_path: string

  `set_source_nfs`(opts=None)

    Switch to NFS install source

  `set_source_url`(url=None)

    Switch to install source specified by URL

  `storage`
  `unset_source`()

    Unset an already selected source method.

    Unset the source in kickstart and notify the payload so that it can correctly release all related resources (unmount iso files, drop caches, etc.).

class `pyanaconda.ui.helpers.``StorageChecker`(min_ram=320, mainSpokeClass='StorageSpoke')

  Bases: `object`

  `checkStorage`()
  `errors` = []
  `log` = <logging.Logger object>
  `run`()
  `storage`
  `warnings` = []

## Module contents

class `pyanaconda.ui.``UserInterface`(storage, payload, instclass)

  Bases: `object`

  This is the base class for all kinds of install UIs. It primarily defines what kinds of dialogs and entry widgets every interface must provide that the rest of anaconda may rely upon.

  Create a new UserInterface instance.

  The arguments this base class accepts defines the API that interfaces have to work with. A UserInterface does not get free reign over everything in the anaconda class, as that would be a big mess. Instead, a UserInterface may count on the following:

  storage – An instance of storage.Storage. This is useful for
    determining what storage devices are present and how they are configured.
  payload – An instance of a packaging.Payload subclass. This
    is useful for displaying and selecting packages to install, and in carrying out the actual installation.
  instclass – An instance of a BaseInstallClass subclass. This
    is useful for determining distribution-specific installation information like default package selections and default partitioning.
  `meh_interface`

    Returns an interface for exception handling (defined by python-meh’s AbstractIntf class).

  `paths` = {}
  `run`()

    Run the interface. This should do little more than just pass through to something else’s run method, but is provided here in case more is needed. This method must be provided by all subclasses.

  `setup`(data)

    Construct all the objects required to implement this interface. This method must be provided by all subclasses.

  `showDetailedError`(message, details, buttons=None)
  `showError`(message)

    Display an error dialog with the given message. There is no return value. This method must be implemented by all UserInterface subclasses.

    In the code, this method should be used sparingly and only for critical errors that anaconda cannot figure out how to recover from.

  `showYesNoQuestion`(message)

    Display a dialog with the given message that presents the user a yes or no choice. This method returns True if the yes choice is selected, and False if the no choice is selected. From here, anaconda can figure out what to do next. This method must be implemented by all UserInterface subclasses.

    In the code, this method should be used sparingly and only for those times where anaconda cannot make a reasonable decision. We don’t want to overwhelm the user with choices.

  `tty_num`

    Returns the number of tty the UserInterface is running on.

  classmethod `update_paths`(pathdict)

    Receives pathdict and appends it’s contents to the current class defined search path dictionary.