Widgets - Controllers and Conversion

Every property type has a default widget. For example, a bool property will be translated to a Checkbox. An editable input to a Text Line Edit, etc. It is possible to convert from one widget type to another for customization. In order to mutate a controller widget please select the widget and right-click to show the custom menu. The picture below shows the possible conversions for a State property. The default controller is a State Color Field widget.

Conversion of Widgets

These conversions offer a vast range of scene customizations.

Other common conversions are from vectors to plots. A vector property (list of values) can be seamlessly converted to a Plot, as shown in the following Figure. As it is known for the XY Plot, one more vector is needed for the plot to be valid.

list_to_plot.png

Basic Widgets

The Tables below offer a cheatsheet regarding the possible widgets the user can choose for displaying primitive types.

Basic Widgets

Integer

Float

Boolean

String

Vector

Evaluate_Expression

R

R

R

Hexadecimal_

W

Single_Bit

R

Value_Field

R

R

R

SpinBox

W

W

Toggle_Field

RW

Switch_Bool

R

Text-Float-Integer-Field

W

W

W

List

RW

Evaluate Expression

This widget can be used to manually define the formatting using python string formatting ("{:.2f}".format(x)) or to derive another value with a function.

string_change_expression.png

The full namespace of python builtins and numpy can be used to define the function. The example below uses the log function of numpy.

expression_valuated.png

Note

The Evaluate Expression widget background is colored according to the alarm and warning attributes of the property if the value exceeds a threshold.

List

The List widget is used to display vector properties. This widget is used for both displaying and editing vector properties and does not provide any alarm information.

list.png

The edit widget provides a list dialog which can be opened by clicking on the button to the right.

list_dialog.png

The list dialog offers a comfortable way to modify vectors with a large number of elements.

Value Field

The Value Field refers to a default widget for representing values. It is typically chosen as first widget when a normal readonly property is dragged onto the scene. This widget is able to visualize and work with defined property displayTypes of ‘bin’, ‘oct’ and ‘hex’. If the property defines one of the attributes absoluteError or relativeError, the widget will derive the formatting display. For floating point properties a maximum precision of 8 is provided.

value_field.png

Note

The Value Field widget is one of the first choice elements to display alarms and warnings of simple property types. The widget background is colored correspondingly and the value exceeded an alarm value.

Generic Lamp

This widget is used for string properties which have a displayType State, the so-called State Elements. The property value is displayed with the corresponding state color.

generic_lamps.png

State Color Field

This widget is used for string properties which have a displayType State, the so-called State Elements. In addition, this widget comes with a context menu action to display the state string on the widget!

state_color_field.png

Single Bit

This widget is used to visualize single bits from integer properties. It has a rectangular rounded shape and comes with two context menu options:

  • Change the bit number to evaluate

  • Invert the color logic

By default the State.ACTIVE is used when the Bit is actively set! The State.PASSIVE color then illustrates if the Bit is not set.

single_bit.png

SpinBox

The spinbox can be referred to as a standard widget in every Qt application. This widget comes with two context menu options

  • The number of decimals (default: 3)

  • The stepsize which is can be eventually used for stepping (default: 0.0)

spinbox.png

Note

The stepping via a spinbox widget is achieved by using arrow key-strokes!

Switch Bool

Shows the operator the state of the bool property with colors in a circular shape. By default the State.PASSIVE color is used for False and the State.ACTIVE color belongs to True. The logic of the coloring can be toggled via the context menu of the widget.

switch_bool.png

Text-Float-Integer Field

The field boxes are building the default widgets for editing the property values of basic float, integer and string types.

text_field_widget.png

In addition, the Float Field has a context menu option to assign the number of decimals. The default value (-1) disables the decimal formatting. Once, a decimal has been specified, a validator will take care of correct value input.

Toggle Field

As the default widget for a boolean this widget simply shows the True and False with a check-mark in a box.

toggle_field.png

The Table Element

The table-element is applicable for VECTOR_HASH properties, which have a ‘rowSchema’ attribute. The rowSchema is a Hash, which defines the column layout, i.e. column count, column data types and column headers.

In case the table description (rowSchema) contains a ‘displayedName’ field for a property this is used as the column header, otherwise the property key is used.

  • For string fields with options supplied the cell is rendered as a drop down menu.

  • Boolean fields are rendered as check boxes.

Additional manipulation functionality includes, adding, deleting and duplicating rows (the latter require a cell or row to be selected).

The Table widget supports drag and drop of deviceId’s from the navigation panel. Dropping on a string cell will replace the string with the deviceId. Dropping on a non-string cell or on an empty region will add a row in which the first string-type column encountered is pre-filled with the deviceID.

table_element.png

Functional Widgets

Functional Widgets

Integer

Float

Boolean

String

Vector

ComboBox

RW

RW

RW

Analog_Widget

R

R

Progress_Bar

R

R

TextLog

R

PopUp

R

Slider

W

W

Knob_

W

W

DeviceSceneLink

R

Analog Widget

The Analog Widget is fully designed to display alarms and warnings of a property. It provides an estimate how far the actual value (indicated as black scaler) is within or close to an alarm or warning region.

analog_widget.png

Note

For this widget a set of attribute values for alarms or warnings has to be provided. Hence, either alarmLow and alarmHigh or warnLow and warnHigh must be defined on the karabo property.

Combo Box

The so-called ComboBox widget is used to edit karabo properties which have a predefined selection of values. In the example shown below the Karabacon scantool has a fixed scan type selection which can be then edited.

combobox_widget.png

Note

For this widget the attribute options has to be defined on the karabo property with defined values.

Progress Bar

The Progress Bar widget shows to the user the property percentage value taking in consideration its maximum and minimum values.

progress_bar.png

Note

For this widget attribute values for a mininum value minInc or minExc and a maximum value maxInc or maxExc must be defined on the karabo property.

Slider

The widget can be changed to a Slider enabling to comfortably slide through the minimum and maximum values of a property. This widget is typically used for gain or exposure settings in cameras.

Slider Widget

The widget comes with a number widget to show the current edit value. This can be optionally disabled. In addition, the step size of the slider can be configured via the context menu.

Note

For this widget attribute values for a mininum value minInc or minExc and a maximum value maxInc or maxExc must be defined on the karabo property.

Text Log

This widget is typically used to display and log the status property of devices. Every value update with a new timestamp will be displayed. It comes together with a clear button and a timestamp for each value modification.

text_log_widget.png

Icon Widgets

Iconset

This type of widget will just show a icon in the scene.

iconset.png

It’s possible to add an icon image using an url or from a file.

iconset_options.png

Icons

The ‘Value Field’ for an integer, a floating or a string property can be converted to an Icon Widget using the right click context menu item Change Widget -> Icons. The Icon widget can show an icon corresponding to a condition, for the value.

Custom icons can be set on Icon Widget depending on the property values. This can be done using the ‘Change Icons’ dialog. Use Icons:Properties-> Change Icons… right click context menu items to open the dialog.

change_icons_dialog.png

In order to define a condition, enter the value and hit “+” button. For floating properties the dialog provides radio buttons to choose the operator ‘<’ or ‘<=’. For integers the operator ‘<=’ is selected by default and the radio buttons are hidden.

For string properties with options, the dialog shows up with these options listed. For string properties with no pre-defined options, the dialog provides a widget to enter the value and hit “+” button to add it.

Select the condition from the list and use
  • ‘Open Icon File’ to open an image file containing the icon.

  • ‘Paste from Clipboard’ to paste the image from the clipboard. Please

make sure to copy the image (ie, file content) and not the image file.

The preview of the imported icon can be seen on the right side of the dialog.

It is further possible to remove a selected condition via “-” button.

Plot Framework

Karabo has a builtin plot framwork based on PyQtGraph. Typically, a plot comes with natively provided extra features which are shown in the Context Menu. The context menu is accessible like in any other widget controller by selecting the controller in the design mode of the scene and via right-clicking on the plot widget.

Commonly, axes configurations can be accessed via native double-clicking on the plot axes for the Axis Menu or a few settings can be adjusted via a right-click on the plot itself to trigger the View Menu.

The **Axes Menu** of a Graph Plot

The Axis Menu is available to set the Range of the axis of interest. Either autorange or a fixed range can be defined. The View Menu offers the possiblity to autorange a plot or if available, configure the linear or logarithmic scale of a plot.

The **View Menu** of a Graph Plot

The next sessions will describe all plot widgets available in Karabo.

Graph Framework

Integer

Float

Boolean

String

Vector

Vector Bar Graph

R

Vector Fill Graph

R

Vector HistoGram Graph

R

Vector XY Graph

R

Vector XY Scatter

R

VectorRoll Graph

R

MultiCurve Graph

R

R

Sparkline

R

R

Scatter Graph

R

R

Trend Graph

R

R

R

State Graph

R

Alarm Graph

R

Trend Graphs

Trend Graph is a widget that shows the evolution of one or more properties over time. The plot itself offers quick access buttons to scale the trend data logs in either:

  1. 10 minutes

  2. one hour

  3. one day

  4. one week.

The trend graph may be set to either display the full range of values or a detailed zoomed range. A trendline will provide automatic data reduction after 900 values. In addition, a trend graph can request historic data of up to 500 values from the Dataloggers.

  • Data will be requested when there is no data

  • Data will be requested when the x-axis is sufficiently changed (buttons)

  • Data will be requested when the operator zoomes in and has less data points

Trend Graph widget

The same functionality is available for the State and Alarm properties of devices.

Trend Graph widget
Trend Graph widget

Multi-Curve Graph

The multi-curve graph is the widget to choose if multiple properties have to be plotted with respect to a reference (x).

Multi Curve Graph Widget

The property that is mutated for this controller is referred to as the reference property. Whenever this property is externally updated, the graph will add another measurement point. A typical use case would be a scan of multiple properties with respect to a reference. The toolbar of this widget is equipped with a reset button which can be externally armed with a boolean property.

Sparkline

The sparkline is similar to a trend graph and shows changes of a property over the selected time base.

  • The timebases can be chosen to be either 60 seconds, 10 minutes or 60 minutes

  • The sparkline maximum number of data points is 120 in an average fashion for all time bases

  • The sparkline will request historic data at the beginning

  • A change indicator arrow will provide the direction in case of changes larger than 5%

  • The minimum and maximum value of the bins are plotted in addition

Sparkline

In this widget it is possible to disable or enable the alarm ranges via the context menu.