pyanaconda
package contains several helper and utility functions and constructs which may be used by hubs and spokes and which have not been covered in the previous section. Most of them are located in pyanaconda.ui.gui.utils
.
englightbox
content manager which is also used in Anaconda. This manager can put a window into a lightbox to increase its visibility and focus it and to prevent users interacting with the underlying window. To demonstrate this function, the sample add-on contains a button which opens a new dialog window; the dialog itself is a special HelloWorldDialog
inheriting from the GUIObject
class, which is defined in pyanaconda.ui.gui.__init__
.
dialog
class defines the run
method which runs and destroys an internal Gtk dialog accessible through the self.window
attribute, which is populated using a mainWidgetName
class attribute with the same meaning. Therefore, the code defining the dialog is very simple, as demonstrated in the following example:
Example 12. Defining a englightbox Dialog
# every GUIObject gets ksdata in __init__ dialog = HelloWorldDialog(self.data) # show dialog above the lightbox with enlightbox(self.window, dialog.window): dialog.run()
enlightbox
context manager to run the dialog within a lightbox. The context manager needs a reference to the window of the spoke and to the dialog's window to instantiate the lightbox for them.
FirstbootSpokeMixIn
(or, more precisely, mixin) as the first inherited class defined in the pyanaconda.ui.common
module.
FirstbootOnlySpokeMixIn
class.
@gtk_action_wait
and @gtk_action_nowait
decorators), but they are out of scope of this guide. Readers are recommended to go through the installer's sources for examples.