PyDMSlider
- class pydm.widgets.slider.PyDMSlider(parent=None, init_channel=None)[source]
Bases:
QFrame
,TextFormatter
,PyDMWritableWidget
A QSlider with support for Channels and more from PyDM.
- Parameters:
parent (QWidget) – The parent widget for the Label
init_channel (str, optional) – The channel to be used by the widget.
Method for the ‘ok’ button in the slider parameters menu.
Method which attempts to set the user imputed data from the slider parameters menu.
- connection_changed(connected)[source]
Callback invoked when the connection state of the Channel is changed. This callback acts on the connection state to enable/disable the widget and also trigger the change on alarm severity to ALARM_DISCONNECTED.
- Parameters:
connected (int) – When this value is 0 the channel is disconnected, 1 otherwise.
- create_slider_positions_to_value_map()[source]
Wrapper around step_size_to_slider_positions_value_map to ensure the func is only called after a step_size has been set
- Returns:
positions_to_value_map – list with all possible allowed slider readback values
- Return type:
list
- ctrl_limit_changed(which, new_limit)[source]
Callback invoked when the Channel receives new control limit values.
- Parameters:
which (str) – Which control limit was changed. “UPPER” or “LOWER”
new_limit (float) – New value for the control limit
- find_closest_slider_position_to_value(val)[source]
Find and returns the index for the closest position on the slider for a given value.
- Return type:
int
- hasTracking()[source]
An alternative function to get the tracking property, to match what Qt provides for QSlider.
- init_for_designer()[source]
Method called after the constructor to tweak configurations for when using the widget with the Qt Designer
- init_step_size_channel(pv_address: str, slot: callable)[source]
Connects instance attribute self.step_size_channel_pv to a PyDMChannel
- Parameters:
pv_address (str) – Channel name of PV that connection will be established too.
slot (callable) – callback function to invoke when channel value changes.
- internal_slider_moved(val)[source]
Method invoked when the slider is moved.
- Parameters:
val (float) –
- internal_slider_value_changed(val)[source]
Method invoked when a new value is selected on the slider. This will cause the new value to be emitted to the signal unless mute_internal_slider_changes is True.
- Parameters:
val (int) –
- property maximum
The current value being used for the upper limit
- Return type:
float
- property minimum
The current value being used for the lower limit
- Return type:
float
- mousePressEvent(mouse_event)[source]
Method to open slider parameters menu with a right click.
- Parameters:
mouse_event (mousePressEvent) –
- prop_type
alias of
Orientation
- readIgnoreMouseWheel() bool [source]
If true, the mouse wheel will not change the value of the slider. This is useful if you want to put sliders inside a scroll view, and don’t want to accidentally change the slider as you are scrolling.
- readOrientation() int | PyQt5.QtCore.Qt.Orientation [source]
The slider orientation (Horizontal or Vertical)
- Returns:
Qt.Horizontal or Qt.Vertical
- Return type:
int
- readShowLimitLabels() bool [source]
Whether or not the high and low limits should be displayed on the slider.
- Return type:
bool
- readShowValueLabel() bool [source]
Whether or not the current value should be displayed on the slider.
- Return type:
bool
- readTickPosition() TickPosition [source]
Where to draw tick marks for the slider.
- Return type:
QSlider.TickPosition
- readTracking() bool [source]
If tracking is enabled (the default), the slider emits new values while the slider is being dragged. If tracking is disabled, it will only emit new values when the user releases the slider. Tracking can cause PyDM to rapidly send new values to the channel. If you are using the slider to control physical hardware, consider whether the device you want to control can handle large amounts of changes in a short timespan.
- readUserDefinedLimits() bool [source]
Whether or not to use limits defined by the user and not from the channel
- Return type:
bool
- setOrientation(new_orientation) None [source]
The slider orientation (Horizontal or Vertical)
- Parameters:
new_orientation (Qt.Orientation) – Qt.Horizontal or Qt.Vertical
- setShowLimitLabels(checked) None [source]
Whether or not the high and low limits should be displayed on the slider.
- Parameters:
checked (bool) –
- setShowValueLabel(checked) None [source]
Whether or not the current value should be displayed on the slider.
- Parameters:
checked (bool) –
- setTickPosition(position) None [source]
Where to draw tick marks for the slider.
Parameter
position : QSlider.TickPosition
- setTracking(checked)[source]
An alternative function to set the tracking property, to match what Qt provides for QSlider.
- setUserDefinedLimits(user_defined_limits) None [source]
Whether or not to use limits defined by the user and not from the channel
- Parameters:
user_defined_limits (bool) –
- set_enable_state()[source]
Determines Whether or not the widget must be enabled or not depending on the write access, connection state and presence of limits information
- set_num_steps(new_steps) None [source]
The number of steps on the slider
- Parameters:
new_steps (int) –
- set_slider_to_closest_value(val)[source]
Set the value for the slider according to a given value.
- Parameters:
val (float) –
- set_step_size(new_step_size) None [source]
The number of steps on the slider
- Parameters:
new_step_size (float) –
- setup_widgets_for_orientation(new_orientation)[source]
Reconstruct the widget given the orientation.
- Parameters:
new_orientation (Qt.Orientation) – Qt.Horizontal or Qt.Vertical
- Method that builds a menu to modify a set of Slider Parameters:
value
new step size (float or channel) and scale factor for step size
precision or if precision is defined from a channel
format of numbers on slider (min, max, value) - float or exp
- step_size_changed(new_val)[source]
PyQT Slot for changes on the Value of the Channel This slot sends the value to the step_size setter.
- Parameters:
new_val (int, float) –
- step_size_to_slider_positions_value_map()[source]
Given a value increment by step size and record allowed values until self.maximum, Repeat with decrementer until self.minimum, take results and create a linear array of allowed values where the length of the array is the number of slider positions. and the slider position i has value array[i].
- update_format_string()[source]
Reconstruct the format string to be used when representing the output value.
- Returns:
format_string – The format string to be used including or not the precision and unit
- Return type:
str
- property value
Channel readback value used to determine slider position and generate a slider positions to value map
- value_changed(new_val)[source]
Callback invoked when the Channel value is changed.
- Parameters:
new_val (int or float) – The new value from the channel.
- write_access_changed(new_write_access)[source]
Callback invoked when the Channel has new write access value. This callback calls check_enable_state so it can act on the widget enabling or disabling it accordingly
- Parameters:
new_write_access (bool) – True if write operations to the channel are allowed.
Note
See QFrame Documentation for all inherited properties and methods.