5.12. TUI Add-on basic features
Anaconda also supports a text-based interface (TUI). This interface is more limited in its capabilities, but on some systems it might be the only choice for an interactive installation. For more information about differences between the text-based interface and graphical interface and about limitations of the TUI, see Introduction to Anaconda and add-ons.
To add support for the text interface into your add-on, create a new set of subpackages under the tui directory as described in Anaconda add-on structure.
The text mode support in the installer is based on the simpleline library, which only allows very simple user interaction. The text mode interface:
- Does not support cursor movement - instead, it acts like a line printer.
- Does not support any visual enhancements, such as using different colors or fonts, for example.
Internally, the simpleline toolkit has three main classes: App, UIScreen and Widget. Widgets are units containing information to be printed on the screen. They are placed on UIScreens that are switched by a single instance of the App class. On top of the basic elements, hubs, spokes and dialogs all contain various widgets in a way similar to the graphical interface.
The most important classes for an add-on are NormalTUISpoke and various other classes defined in the pyanaconda.ui.tui.spokes package. All those classes are based on the TUIObject class, which itself is an equivalent of the GUIObject class. Each TUI spoke is a Python class inheriting from the NormalTUISpoke class, overriding special arguments and methods defined by the API. Because the text interface is simpler than the GUI, there are only two such arguments:
-
title- determines the title of the spoke, similar to the title argument in the GUI. -
category- determines the category of the spoke as a string; the category name is not displayed anywhere, it is only used for grouping.
The TUI handles categories differently than the GUI. Assign a pre-existing category to your new spoke. Creating a new category would require patching Anaconda, and brings little benefit.
Each spoke is also expected to override several methods, namely init, initialize, refresh, apply, execute, input, prompt, and properties (ready, completed, mandatory, and status).