gui.calibration.progress — Shows the calibration procedure’s progress

This module contains the ProgressWidgetHandler class, which manages a group of widgets that show the progress of the calibration procedure while it is running.

The class listens to CalibrationStarted and CalibrationOver events to determine whether the calibration procedure is running. While it is running, it periodically obtains progress information from the responsible CalibrationManager, and uses this information to update two progress bars that show the estimated progress of the ongoing calibration stage and the calibration procedure as whole, and two labels that show the estimated time remaining for both.

The top-level container of these widgets can be accessed using the handler’s widget property. Clients also need to keep a reference to the handler itself to prevent it from being reclaimed as garbage, but need not otherwise deal with it.

The ProgressWidgetHandler allows clients to register additional gtk.ProgressBar and gtk.Label instances, however, which will then receive periodic progress updates as well.

The ProgressWidgetHandler Class

class gui.calibration.progress.ProgressWidgetHandler(system)
Creates a new instance of this class, which shows the progress of calibration procedures performed on the given ProductionSystem.
ProgressWidgetHandler.widget
The top-level container of the widgets that show the progress. Immutable.
ProgressWidgetHandler.updateInterval
The interval in which the progress widgets are updated, in milliseconds. This is a class attribute, but it can be set on an instance before the calibration procedure is started to override the default value.

Registering Additional Widgets

ProgressWidgetHandler.addStageProgressBar(bar, showText=True)
Registers the given gtk.ProgressBar for periodic updates with the progress of the ongoing calibration stage while the calibration procedure is running. If showText is True, the stage progress in percent will also be shown as a string on the progress bar.
ProgressWidgetHandler.addTotalProgressBar(bar, showText=True)
Registers the given gtk.ProgressBar for periodic updates with the progress of the entire calibration procedure while it is running. If showText is True, the total progress in percent will also be shown as a string on the progress bar.
ProgressWidgetHandler.addDefaultStageProgressLabel(label)
A convenience method that calls addProgressLabel() with a suitable template for a label that is to show the progress of the ongoing calibration stage.
ProgressWidgetHandler.addDefaultTotalProgressLabel(label)
A convenience method that calls addProgressLabel() with a suitable template for a label that is to show the calibration procedure’s total progress.
ProgressWidgetHandler.addProgressLabel(label, template, noTimeTemplate)

Registers the given gtk.Label for periodic updates with the calibration procedure’s progress while it is running. The label’s text will be set to template if the remaining duration of the stage and the calibration procedure as a while are known, and to noTimeTemplate otherwise. The templates may include the following mapping keys:

%(action)s:
A localized description of the action that is being performed (e.g. 'Heating with 8 mA').
%(stageProgress)s and %(totalProgress)s:
The progress of the ongoing calibration stage and the entire calibration procedure, as a string (e.g. '23%').
%(stageTimeLeft)s and %(totalTimeLeft)s:
The estimated time remaining until the completion of the ongoing calibration stage and the entire calibration procedure, as a localized string (e.g. '3 minutes, 14 seconds'), or the localized equivalent of 'unknown' if the time left is not known.
%(emptyString)s:
The empty string.