Introduction to blivet-gui¶
Building Blocks¶
BlivetUtils¶
BlivetUtils
class provides higher level API for Blivet library. It creates the
blivet.Blivet
object (storage
) and all blivet methods are called using this
class.
BlivetGUI¶
BlivetGUI
is the main class for the GUI. There are separate classes for every UI part. These
classes create all the necessary Gtk widgets (or loads them from Glade files) and provide signal handlers and other
helper functions.
- Important GUI objects:
ActionsMenu
– context (right click) menu for user actionsDeviceToolbar
– toolbar with device-related actions (add, edit, remove…)ActionsToolbar
– toolbar with “global” actions (process or clear actions, main menu)ListDevices
– list of “root” devices (disks, volume groups, RAIDs…)LogicalView
– displays list of children of selected device (both as list using Gtk.TreeView and graphically usingRectangle
)PhysicalView
– displays list of parents of selected device
Dialogs¶
- Most of the user interaction is done using dialogs. Some important dialogs include:
AddDialog
– dialog for adding new devicesResizeDialog
– dialog for resizing existing devicesErrorDialog
,ExceptionDialog
,ConfirmDialog
– simple dialogs to display errors, exceptions and informationProcessingActions
– dialog displaying progress during processing actionsLoadingWindow
– dialog displaying progress during blivet-gui start
Multiprocess Communication¶
Blivet-gui creates two processes – blivet-gui for the UI and blivet-gui-daemon for working with blivet.
Two processes are necessary because blivet needs root privileges to work with storage but GUI applications shouldn’t be running with root privileges.
Both processes communicate using a socket file.
Proxy¶
Blivet-gui uses pickle to send objects between the processes. Unfortunately most blivet objects are not picklable.
To solve this, server and client parts of blivet-gui communicate using “proxy objects”.
When BlivetGUI
“asks” for some “information” that isn’t picklable (e.g. using
get_disks()
that returns list of blivet.devices.storage.StorageDevice
),
BlivetUtilsServer
creates a new instance of ProxyID
and sends it to the client instead. When client receives it, it creates an instance of
ClientProxyObject
and sends it to the BlivetGUI
instead.
ClientProxyObject
has a custom __getattr__ method and has the ProxyID so it can ask
the server for values of attributes that BlivetGUI
asks for. Thanks to this,
BlivetGUI
can work with the blivet object without having it.
Note
It isn’t possible to call methods of proxied objects. Only attributes (and properties) are supported.
ProxyDataContainer
is a helper class used as a simple picklable container similar
to namedtuple.
BlivetGUIClient¶
BlivetGUIClient
provides support for multiprocess communication for the client part of
the blivet-gui. BlivetGUI
has an instance of the BlivetGUIClient
and uses it to communicate with the BlivetUtils
via BlivetUtilsServer
.
BlivetGUI
can call BlivetUtils
methods using
remote_call()
method.
BlivetUtilsServer¶
BlivetUtilsServer
provides support for multiprocess communication for the server part
of the blivet-gui. It’s a synchronous socketserver, it has an instance of BlivetUtils
and
processes tasks from the BlivetGUIClient
.
Note
Only one blivet-gui-daemon process can run at a time and it can communicate with only one blivet-gui process. “Binary” file blivet-gui should be used to start blivet-gui. It will automatically spawn the blivet-gui-daemon process with root privileges using pkexec.