pyanaconda.ui.gui package

Subpackages

Submodules

pyanaconda.ui.gui.helpers module

class pyanaconda.ui.gui.helpers.GUIDialogInputCheckHandler

Bases: pyanaconda.ui.gui.helpers.GUIInputCheckHandler

Provide InputCheckHandler functionality for Gtk dialogs.

This class provides a helper method for setting an error message on an entry field. Implementors of this class must still provide a set_status method in order to control the sensitivty of widgets or ignore activated signals.

set_status(inputcheck)
class pyanaconda.ui.gui.helpers.GUIInputCheckHandler

Bases: pyanaconda.ui.helpers.InputCheckHandler

Provide InputCheckHandler functionality for Gtk input screens.

This class assumes that all input objects are of type GtkEditable and attaches InputCheck.update_check_status to the changed signal.

add_check(input_obj, run_check, data=None)
get_input(input_obj)
class pyanaconda.ui.gui.helpers.GUISpokeInputCheckHandler

Bases: pyanaconda.ui.gui.helpers.GUIInputCheckHandler

Provide InputCheckHandler functionality for graphical spokes.

This class implements set_status to set a message in the warning area of the spoke window and provides an implementation of on_back_clicked to prevent the user from exiting a spoke with bad input.

clear_info()
on_back_clicked(window)

Check whether the input validation checks allow the spoke to be exited.

Unlike NormalSpoke.on_back_clicked, this function returns a boolean value. Classes implementing this class should run GUISpokeInputCheckHandler.on_back_clicked, and if it succeeded, run NormalSpoke.on_back_clicked.

set_status(inputcheck)

Update the warning with the input validation error from the first error message.

set_warning(msg)
window

pyanaconda.ui.gui.utils module

class pyanaconda.ui.gui.utils.GtkActionList

Bases: object

Class for scheduling Gtk actions to be all run at once.

add_action(func, *args)

Add Gtk action to be run later.

fire()

Run all scheduled Gtk actions.

pyanaconda.ui.gui.utils.blockedHandler(*args, **kwds)

Prevent a GLib signal handling function from being called during some block of code.

pyanaconda.ui.gui.utils.busyCursor()
pyanaconda.ui.gui.utils.escape_markup(value)

Escape strings for use within Pango markup.

This function converts the value to a string before passing markup_escape_text().

pyanaconda.ui.gui.utils.fancy_set_sensitive(widget, value)

Set the sensitivity of a widget, and then set the sensitivity of all widgets it is a mnemonic widget for. This has the effect of marking both an entry and its label as sensitive/insensitive, for instance.

pyanaconda.ui.gui.utils.fire_gtk_action(func, *args)

Run some Gtk action in the main thread and wait for it.

pyanaconda.ui.gui.utils.gtk_action_nowait(func)

Decorator method which ensures every call of the decorated function to be executed in the context of Gtk main loop even if called from a non-main thread. The new method does not wait for the callback to finish.

pyanaconda.ui.gui.utils.gtk_action_wait(func)

Decorator method which ensures every call of the decorated function to be executed in the context of Gtk main loop even if called from a non-main thread and returns the ret value after the decorated method finishes.

pyanaconda.ui.gui.utils.gtk_batch_map(action, items, args=(), pre_func=None, batch_size=1)

Function that maps an action on items in a way that makes the action run in the main thread, but without blocking the main thread for a noticeable time. If a pre-processing function is given it is mapped on the items first before the action happens in the main thread.

MUST NOT BE CALLED NOR WAITED FOR FROM THE MAIN THREAD.

Parameters:
  • action ((action_item, *args) -> None) – any action that has to be done on the items in the main thread
  • items (iterable) – an iterable of items that the action should be mapped on
  • args (tuple) – additional arguments passed to the action function
  • pre_func (item -> action_item) – a function that is mapped on the items before they are passed to the action function
  • batch_size – how many items should be processed in one run in the main loop
Raises AssertionError:
 

if called from the main thread

Returns:

None

pyanaconda.ui.gui.utils.gtk_call_once(func, *args)

Wrapper for GLib.idle_add call that ensures the func is called only once.

pyanaconda.ui.gui.utils.ignoreEscape(dlg)

Prevent a dialog from accepting the escape keybinding, which emits a close signal and will cause the dialog to close with some return value we are likely not expecting. Instead, this method will cause the escape key to do nothing for the given GtkDialog.

pyanaconda.ui.gui.utils.override_cell_property(tree_column, cell_renderer, propname, property_func, data=None)

Override a single property of a cell renderer.

property_func takes the same arguments as GtkTreeCellDataFunc: (TreeViewColumn, CellRenderer, TreeModel, TreeIter, data). Instead of being expected to manipulate the CellRenderer itself, this method should instead return the value to which the property should be set.

This method calls set_cell_data_func on the column and renderer.

Parameters:
  • column (GtkTreeViewColumn) – the column to override
  • cell_renderer (GtkCellRenderer) – the cell renderer to override
  • propname (str) – the property to set on the renderer
  • property_func (function) – a function that returns the value of the property to set
  • data – Optional data to pass to property_func
pyanaconda.ui.gui.utils.really_hide(widget)

Some widgets need to be both hidden, and have no_show_all set on them to prevent them from being shown later when the screen is redrawn. This method takes care of that.

pyanaconda.ui.gui.utils.really_show(widget)

Some widgets need to have no_show_all unset before they can also be shown, so they are displayed later when the screen is redrawn. This method takes care of that.

pyanaconda.ui.gui.utils.setViewportBackground(vp, color='@theme_bg_color')

Set the background color of the GtkViewport vp to be the same as the overall UI background. This should not be called for every viewport, as that will affect things like TreeViews as well.

pyanaconda.ui.gui.utils.set_treeview_selection(treeview, item, col=0)

Select the given item in the given treeview and scroll to it.

Parameters:
  • treeview (GtkTreeView) – treeview to select and item in
  • item (str) – item to be selected
  • col (int) – column to search for the item in
Returns:

selected iterator or None if item was not found

Return type:

GtkTreeIter or None

pyanaconda.ui.gui.utils.setup_gtk_direction()

Set the right direction (RTL/LTR) of the Gtk widget’s and their layout based on the current language configuration.

pyanaconda.ui.gui.utils.timed_action(delay=300, threshold=750, busy_cursor=True)

Function returning decorator for decorating often repeated actions that need to happen in the main loop (entry/slider change callbacks, typically), but that may take a long time causing the GUI freeze for a noticeable time.

Parameters:
  • delay (int) – number of milliseconds to wait for another invocation of the decorated function before it is actually called
  • threshold (int) – upper bound (in milliseconds) to wait for the decorated function to be called from the first/last time
  • busy_cursor (bool) – whether the cursor should be made busy or not in the meantime of the decorated function being invocated from outside and it actually being called
pyanaconda.ui.gui.utils.unbusyCursor()

pyanaconda.ui.gui.xkl_wrapper module

This module include functions and classes for dealing with multiple layouts in Anaconda. It wraps the libxklavier functionality to protect Anaconda from dealing with its “nice” API that looks like a Lisp-influenced “good old C” and also systemd-localed functionality.

It provides a XklWrapper class with several methods that can be used for listing and various modifications of keyboard layouts settings.

class pyanaconda.ui.gui.xkl_wrapper.LayoutInfo

Bases: tuple

LayoutInfo(lang, desc)

desc

Alias for field number 1

lang

Alias for field number 0

pyanaconda.ui.gui.xkl_wrapper.Xkb_(x)
class pyanaconda.ui.gui.xkl_wrapper.XklWrapper

Bases: object

Class wrapping the libxklavier functionality

Use this class as a singleton class because it provides read-only data and initialization (that takes quite a lot of time) reads always the same data. It doesn’t have sense to make multiple instances

activate_default_layout(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

add_layout(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

get_available_layouts()

A generator yielding layouts (no need to store them as a bunch)

get_current_layout()

Get current activated X layout and variant

Returns:current activated X layout and variant (e.g. “cz (qwerty)”)
static get_instance()
get_layout_variant_description(layout_variant, with_lang=True, xlated=True)

Get description of the given layout-variant.

Parameters:
  • layout_variant (str) – layout-variant specification (e.g. ‘cz (qwerty)’)
  • with_lang (bool) – whether to include language of the layout-variant (if defined) in the description or not
  • xlated (bool) – whethe to return translated or english version of the description
Returns:

description of the layout-variant specification (e.g. ‘Czech (qwerty)’)

Return type:

str

get_switch_opt_description(switch_opt)

Get description of the given layout switching option.

Parameters:switch_opt (str) – switching option name/ID (e.g. ‘grp:alt_shift_toggle’)
Returns:description of the layout switching option (e.g. ‘Alt + Shift’)
Return type:str
get_switching_options()

Method returning list of available layout switching options

is_valid_layout(layout)

Return if given layout is valid layout or not

remove_layout(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

replace_layouts(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

set_switching_options(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

exception pyanaconda.ui.gui.xkl_wrapper.XklWrapperError

Bases: pyanaconda.keyboard.KeyboardConfigError

Exception class for reporting libxklavier-related problems

pyanaconda.ui.gui.xkl_wrapper.iso_(x)

Module contents

class pyanaconda.ui.gui.GraphicalUserInterface(storage, payload, instclass, distributionText=<function distributionText at 0x7f6215aea8c0>, isFinal=False, quitDialog=<class 'pyanaconda.ui.gui.QuitDialog'>, gui_lock=None, fullscreen=False)

Bases: pyanaconda.ui.UserInterface

This is the standard GTK+ interface we try to steer everything to using. It is suitable for use both directly and via VNC.

basemask = 'pyanaconda.ui'
basepath = '/home/bcl/Red_Hat/projs/anaconda/pyanaconda/ui/gui'
dir = '/usr/lib/site-python'
getActionClasses(hubs)

Grab all relevant standalone spokes, add them to the passed list of hubs and order the list according to the relationships between hubs and standalones.

meh_interface
path = '/usr/lib64/python2.7/site-packages/pyanaconda/ui'
pathlist = set(['/tmp/updates/pyanaconda/ui', '/usr/lib/site-python/pyanaconda/ui', '/usr/lib/python2.7/site-packages/pyanaconda/ui', '/home/bcl/Red_Hat/projs/anaconda/pyanaconda/ui/gui', '/usr/lib64/python2.7/site-packages/pyanaconda/ui'])
paths = {'hubs': [('pyanaconda.ui.gui.hubs.%s', '/tmp/updates/pyanaconda/ui/gui/hubs'), ('pyanaconda.ui.gui.hubs.%s', '/usr/lib/site-python/pyanaconda/ui/gui/hubs'), ('pyanaconda.ui.gui.hubs.%s', '/usr/lib/python2.7/site-packages/pyanaconda/ui/gui/hubs'), ('pyanaconda.ui.gui.hubs.%s', '/home/bcl/Red_Hat/projs/anaconda/pyanaconda/ui/gui/gui/hubs'), ('pyanaconda.ui.gui.hubs.%s', '/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/hubs')], 'spokes': [('pyanaconda.ui.gui.spokes.%s', '/tmp/updates/pyanaconda/ui/gui/spokes'), ('pyanaconda.ui.gui.spokes.%s', '/usr/lib/site-python/pyanaconda/ui/gui/spokes'), ('pyanaconda.ui.gui.spokes.%s', '/usr/lib/python2.7/site-packages/pyanaconda/ui/gui/spokes'), ('pyanaconda.ui.gui.spokes.%s', '/home/bcl/Red_Hat/projs/anaconda/pyanaconda/ui/gui/gui/spokes'), ('pyanaconda.ui.gui.spokes.%s', '/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes')], 'categories': [('pyanaconda.ui.categories.%s', '/tmp/updates/pyanaconda/ui/categories'), ('pyanaconda.ui.categories.%s', '/usr/lib/site-python/pyanaconda/ui/categories'), ('pyanaconda.ui.categories.%s', '/usr/lib/python2.7/site-packages/pyanaconda/ui/categories'), ('pyanaconda.ui.categories.%s', '/home/bcl/Red_Hat/projs/anaconda/pyanaconda/ui/gui/categories'), ('pyanaconda.ui.categories.%s', '/usr/lib64/python2.7/site-packages/pyanaconda/ui/categories')]}
run()
setup(data)
showDetailedError(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

showError(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

showYesNoQuestion(*args, **kwargs)

The new body for the decorated method. If needed, it uses closure bound queue variable which is valid until the reference to this method is destroyed.

sitepackages = ['/usr/lib64/python2.7/site-packages/pyanaconda/ui', '/usr/lib/python2.7/site-packages/pyanaconda/ui', '/usr/lib/site-python/pyanaconda/ui']
tty_num
updatepath = '/tmp/updates/pyanaconda/ui'
class pyanaconda.ui.gui.QuitDialog(data)

Bases: pyanaconda.ui.gui.GUIObject

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.
skipTo – If this attribute is set to something other than None,

it must be the name of a class (as a string). Then, the interface will skip to the first instance of that class in the action list instead of going on to whatever the next action is normally.

Note that actions may only skip ahead, never backwards. Also, standalone spokes may not skip to an individual spoke off a hub. They can only skip to the hub itself.

MESSAGE = ''
builderObjects = ['quitDialog']
mainWidgetName = 'quitDialog'
run()
uiFile = 'main.glade'