PyDMSlider¶
-
class
pydm.widgets.slider.
PyDMSlider
(parent=None, init_channel=None)[source]¶ 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.
-
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.
-
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.
- Parameters
val (float) –
- Returns
- Return type
int
-
hasTracking
()[source]¶ An alternative function to get the tracking property, to match what Qt provides for QSlider.
-
ignoreMouseWheel
¶ 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.
-
init_for_designer
()[source]¶ Method called after the constructor to tweak configurations for when using the widget with the Qt Designer
-
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
- Returns
- Return type
float
-
property
minimum
¶ The current value being used for the lower limit
- Returns
- Return type
float
-
num_steps
¶ The number of steps on the slider
- Returns
- Return type
int
-
orientation
¶ The slider orientation (Horizontal or Vertical)
- Returns
Qt.Horizontal or Qt.Vertical
- Return type
int
-
setTracking
(checked)[source]¶ An alternative function to set the tracking property, to match what Qt provides for QSlider.
-
set_enable_state
()[source]¶ Determines wether or not the widget must be enabled or not depending on the write access, connection state and presence of limits information
-
set_slider_to_closest_value
(val)[source]¶ Set the value for the slider according to a given value.
- Parameters
val (float) –
-
setup_widgets_for_orientation
(new_orientation)[source]¶ Reconstruct the widget given the orientation.
- Parameters
new_orientation (int) – Qt.Horizontal or Qt.Vertical
-
showLimitLabels
¶ Whether or not the high and low limits should be displayed on the slider.
- Returns
- Return type
bool
-
showValueLabel
¶ Whether or not the current value should be displayed on the slider.
- Returns
- Return type
bool
-
tickPosition
¶ Where to draw tick marks for the slider.
- Returns
- Return type
QSlider.TickPosition
-
tracking
¶ 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.
-
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
-
userDefinedLimits
¶ Wether or not to use limits defined by the user and not from the channel
- Returns
- Return type
bool
-
userMaximum
¶ Upper user defined limit value
- Returns
- Return type
float
-
userMinimum
¶ Lower user defined limit value
- Returns
- Return type
float
-
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.