Fork PyRPL on GitHub

pyrpl.widgets package

Submodules

pyrpl.widgets.attribute_widgets module

AttributeWidgets’ hierarchy is parallel to Attribute’ hierarchy

An instance attr of Attribute can create its AttributeWidget counterPart by calling attr.create_widget(name, parent).

class pyrpl.widgets.attribute_widgets.BaseAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: <MagicMock name='mock.QtWidgets' id='139827381765584'>.QWidget

Base class for attribute widgets.

The widget usually contains a label and a subwidget (property ‘widget’ of the instance), corresponding to the associated attribute. The subwidget is the created by the function make_widget.

AttributeWidgets are always contained in a ModuleWidget and should be fully managed by this ModuleWidget.

If widget_name==””, then only the subwidget is shown without label.

A minimum widget should implmenet set_widget, _update, and possibly module_value.

attribute_descriptor
attribute_value
editing()[source]

User is editing the property graphically don’t mess up with him :return:

set_horizontal()[source]

puts the label to the left of the widget instead of atop

value_changed = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
wheelEvent(event)[source]

Handle mouse wheel event.

widget_value

Property for the current value of the widget.

The associated setter takes care of not re-emitting signals when the gui value is modified through the setter.

write_attribute_value_to_widget()[source]

trivial helper function, updates widget value from the attribute

write_widget_value_to_attribute()[source]
class pyrpl.widgets.attribute_widgets.BasePropertyListPropertyWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

A widget for a list of Attributes, deriving its functionality from the underlying widgets

append_default()[source]
delitem(index=-1)[source]
editing()[source]
element_widget_cls
insert(index, value)[source]

” make a new element widget - this function is called by the attribute

number
select(index)[source]
setitem(index, value)[source]
update_attribute_by_name(new_value_list)[source]
update_widget_names()[source]
class pyrpl.widgets.attribute_widgets.BoolAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Checkbox for boolean attributes

class pyrpl.widgets.attribute_widgets.BoolIgnoreAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BoolAttributeWidget

Like BoolAttributeWidget with additional option ‘ignore’ that is shown as a grey check in GUI

class pyrpl.widgets.attribute_widgets.ComplexAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.FloatAttributeWidget

Widget for complex values

SpinBox

alias of ComplexSpinBox

class pyrpl.widgets.attribute_widgets.CurveAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.DataAttributeWidget

Plots a curve (complex or real), with an id number as input.

get_xy_data(new_value)[source]

helper function to extract xy data from a curve object

class pyrpl.widgets.attribute_widgets.CurveSelectAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.SelectAttributeWidget

Select one or many curves.

class pyrpl.widgets.attribute_widgets.DataAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.PlotAttributeWidget

Plots a curve (complex or real), with an array as input.

class pyrpl.widgets.attribute_widgets.FilterAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Property for list of floats (to be chosen in a list of valid_frequencies) The attribute descriptor needs to expose a function valid_frequencies(module)

decimals = 3
refresh_options(module)[source]
set_max_cols(n_cols)[source]
class pyrpl.widgets.attribute_widgets.FloatAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.NumberAttributeWidget

Widget for float values

SpinBox

alias of FloatSpinBox

class pyrpl.widgets.attribute_widgets.IntAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.NumberAttributeWidget

Widget for integer values.

SpinBox

alias of IntSpinBox

class pyrpl.widgets.attribute_widgets.LedAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Boolean property with a button whose text and color indicates whether

button_clicked()[source]
class pyrpl.widgets.attribute_widgets.ListComboBox(number, name, options, decimals=3)[source]

Bases: <MagicMock name='mock.QtWidgets' id='139827381765584'>.QWidget

change_options(new_options)[source]
get_list()[source]
set_list(val)[source]
set_max_cols(n_cols)[source]

If more than n boxes are required, go to next line

value_changed = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
class pyrpl.widgets.attribute_widgets.ListElementWidget(parent, startindex, *args, **kwargs)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

this is a wrapper class to embed any AttributeWidget as an element of BasePropertyListPropertyWidget. Its usage is found in the property element_widget_cls of BasePropertyListPropertyWidget.

attribute_value
focusInEvent(QFocusEvent)[source]
index
mousePressEvent(event)[source]
remove_this_element()[source]
class pyrpl.widgets.attribute_widgets.NumberAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Base widget for float and int.

SpinBox

alias of NumberSpinBox

editing()[source]
keyPressEvent(event)[source]

forwards all key events to spinbox

keyReleaseEvent(event)[source]

forwards all key events to spinbox

set_log_increment()[source]
set_per_second(val)[source]
class pyrpl.widgets.attribute_widgets.PlotAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

time()[source]
class pyrpl.widgets.attribute_widgets.SelectAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Multiple choice property.

change_options(new_options=None)[source]

The options of the combobox can be changed dynamically.

new_options is an argument that is ignored, since the new options are available as a property to the widget already.

options
class pyrpl.widgets.attribute_widgets.StringAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.BaseAttributeWidget

Widget for string values.

class pyrpl.widgets.attribute_widgets.TextAttributeWidget(module, attribute_name, widget_name=None)[source]

Bases: pyrpl.widgets.attribute_widgets.StringAttributeWidget

Property for multiline string values.

pyrpl.widgets.pyrpl_widget module

class pyrpl.widgets.pyrpl_widget.ExceptionLauncher[source]

Bases: <MagicMock name='mock.QtCore' id='139827381803152'>.QObject

display_exception(etype, evalue, tb)[source]
display_log(record)[source]
show_exception = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
show_log = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
class pyrpl.widgets.pyrpl_widget.LogHandler[source]

Bases: <MagicMock name='mock.QtCore' id='139827381803152'>.QObject, logging.Handler

A handler class which sends log strings to a wx object

emit(record)[source]

Emit a record.

show_log = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
pyrpl.widgets.pyrpl_widget.patch_excepthook()[source]

pyrpl.widgets.spinbox module

class pyrpl.widgets.spinbox.ComplexSpinBox(*args, **kwargs)[source]

Bases: pyrpl.widgets.spinbox.FloatSpinBox

Two spinboxes representing a complex number, with the right keyboard shortcuts (up down for imag, left/right for real).

forward_to_subspinboxes(func)[source]

a decorator that forwards function calls to subspinboxes

keyPressEvent(event)[source]
keyReleaseEvent(event)[source]
make_layout()[source]
setDecimals(*args, **kwargs)[source]
setFixedWidth(*args, **kwargs)[source]
setMaximum(*args, **kwargs)[source]
setMinimum(*args, **kwargs)[source]
setSingleStep(*args, **kwargs)[source]
set_log_increment(*args, **kwargs)[source]
set_min_size(*args, **kwargs)[source]
set_per_second(*args, **kwargs)[source]
update_tooltip(*args, **kwargs)[source]
val
wheelEvent(event)[source]
class pyrpl.widgets.spinbox.FloatSpinBox(label, decimals=4, min=-1, max=1, increment=0.0001220703125, **kwargs)[source]

Bases: pyrpl.widgets.spinbox.NumberSpinBox

Number spin box for float values

max_num_letter

Returns the maximum number of letters

val
class pyrpl.widgets.spinbox.IntSpinBox(label, min=-8192, max=8192, increment=1, per_second=10, **kwargs)[source]

Bases: pyrpl.widgets.spinbox.NumberSpinBox

Number spin box for integer values

max_num_letter

Maximum number of letters in line

setMaximum(val)[source]
val
class pyrpl.widgets.spinbox.NumberSpinBox(label='', min=-1, max=1, increment=0.0001220703125, log_increment=False, halflife_seconds=0.5, per_second=0.2)[source]

Bases: <MagicMock name='mock.QtWidgets' id='139827381765584'>.QWidget

Base class for spinbox with numerical value.

The button can be either in log_increment mode, or linear increment.
  • In log_increment: the halflife_seconds value determines how long it takes when the user keeps clicking on the “*”/”/” buttons to change the value by a factor 2. Since the underlying register is assumed to be represented by an int, its values are separated by a minimal separation, called “increment”. The time to wait before refreshing the value is adjusted automatically so that the log behavior is still correct, even when the value becomes comparable to the increment.
  • In linear increment, the value is immediately incremented by the
increment, then, nothing happens during a time given by timer_initial_latency. Only after that the value is incremented by “increment” every timer_min_interval.
MOUSE_WHEEL_ACTIVATED = False
change_initial_latency

latency for continuous update when a button is pressed

change_interval = 0.02
change_sign
continue_step()[source]
finish_step()[source]
first_step()[source]

Once +/- pressed for timer_initial_latency ms, start to update continuously

forward_to_subspinboxes(func)[source]

a decorator that forwards function calls to subspinboxes

is_decreasing
is_increasing
keyPressEvent(event)[source]
keyReleaseEvent(event)[source]
make_layout()[source]
max_num_letter

Returns the maximum number of letters

saturate(val)[source]
selected = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
setDecimals(val)[source]
setMaximum(val)[source]
setMinimum(val)[source]
setSingleStep(val)[source]
setValue(val)[source]

replace this function with something useful in derived classes

set_log_increment()[source]
set_min_size()[source]

sets the min size for content to fit.

set_per_second(val)[source]
update_tooltip()[source]

The tooltip uses the values of min/max/increment...

validate()[source]

make sure a new value is inside the allowed bounds after a manual change of the value

value()[source]

replace this function with something useful in derived classes

value_changed = <MagicMock name='mock.QtCore.Signal()' id='139827380610576'>
wheelEvent(event)[source]

Handle mouse wheel event. No distinction between linear and log. :param event: :return:

pyrpl.widgets.startup_widget module

pyrpl.widgets.yml_editor module

class pyrpl.widgets.yml_editor.YmlEditor(module, state)[source]

Bases: <MagicMock name='mock.QtWidgets' id='139827381765584'>.QWidget

cancel()[source]
load_all()[source]
refresh()[source]
save()[source]
sizeHint()[source]

Module contents