fsleyes_widgets.floatslider¶
This module provides two classes, the FloatSlider and
SliderSpinPanel, which allow the user to modify floating point
values.
-
class
fsleyes_widgets.floatslider.FloatSlider(parent, value=None, minValue=None, maxValue=None, style=0)¶ Bases:
wx._core.PanelFloating point slider widget.
This class is an alternative to
wx.Slider, which supports floating point numbers of any range. The desired range is transformed into the internal range \([-2^{31}, 2^{31-1}]\).A
EVT_SLIDERevent is emitted whenever the user changes the value.Create a
FloatSlider.The following style flags are available:
FS_MOUSEWHEELIf set, mouse wheel events on the slider will change the value. FS_INTEGERIf set, the slider will store an integer value instead of a floating point value. Parameters: - parent – The
wxparent object. - value – Initial slider value.
- minValue – Minimum slider value.
- maxValue – Maximum slider value.
- style – A combination of
FS_MOUSEWHEELandFS_INTEGER.
-
__init__(parent, value=None, minValue=None, maxValue=None, style=0)¶ Create a
FloatSlider.The following style flags are available:
FS_MOUSEWHEELIf set, mouse wheel events on the slider will change the value. FS_INTEGERIf set, the slider will store an integer value instead of a floating point value. Parameters: - parent – The
wxparent object. - value – Initial slider value.
- minValue – Minimum slider value.
- maxValue – Maximum slider value.
- style – A combination of
FS_MOUSEWHEELandFS_INTEGER.
- parent – The
-
GetRange()¶ Return a tuple containing the (minimum, maximum) slider values.
-
SetRange(minValue, maxValue)¶ Set the minimum/maximum slider values.
-
GetMin()¶ Return the minimum slider value.
-
GetMax()¶ Return the maximum slider value.
-
SetMin(minValue)¶ Set the minimum slider value.
-
SetMax(maxValue)¶ Set the maximum slider value.
-
SetValue(value)¶ Set the slider value. Returns
Trueif the value changed,Falseotherwise.
-
GetValue()¶ Returns the slider value.
-
_FloatSlider__SetRange(minValue, maxValue)¶ Set the minimum/maximum slider values.
This logic is not in the public
SetRange()method so we can overcome a chicken-and-egg problem in__init__()-SetValue()needs__realMinand__realMaxto be set, butSetRange()needs to retrieve the value before setting__realMinand__realMax.
-
_FloatSlider__onMouseDown(ev)¶ Only called when running on GTK. Sets an internal dragging flag, and calls
__mouseMove().
-
_FloatSlider__onMouseMove(ev)¶ Only called when running on GTK. Updates the slider value based on the mouse location.
-
_FloatSlider__onMouseUp(ev)¶ Only called when running on GTK. Clears the internal dragging flag.
-
_FloatSlider__onMouseWheel(ev)¶ If the
FS_MOUSEWHEELstyle is set, this method is called when the mouse wheel is spun over the slider widget.Increases/decreases the slider value accordingly.
-
_FloatSlider__onSlider(ev)¶ Called when the child
wx.Sliderinstance generates anEVT_SLIDERevent. If the slider value has changed, the event is propagated upwards.
-
_FloatSlider__realToSlider(value)¶ Converts the given value from real space to slider space.
-
_FloatSlider__sliderToReal(value)¶ Converts the given value from slider space to real space.
-
__module__= 'fsleyes_widgets.floatslider'¶
- parent – The
-
class
fsleyes_widgets.floatslider.SliderSpinPanel(parent, value=None, minValue=None, maxValue=None, label=None, style=None, spinWidth=None)¶ Bases:
wx._core.PanelA panel containing a
FloatSliderand aFloatSpinCtrl.The slider and spinbox are linked such that changes to one are reflected in the other. The
SliderSpinPanelclass also provides the option to have the minimum/maximum limits displayed on either side of the slider/spinbox, and to have those limits editable via aNumberDialog.Users of the
SliderSpinPanelmay wish to bind listeners to the following events:EVT_SSP_VALUE: Emitted when the slider value changes.EVT_SSP_LIMIT: Emitted when the slider limits change.
Create a
SliderSpinPanel.The following style flags are available:
SSP_SHOW_LIMITSIf set, the data range limits are shown alongside the slider/spin control widgets. SSP_EDIT_LIMITSIf set, and SSP_SHOW_LIMITSis also set, the data range limits are shown on buttons alongside the slider/spin control widgets.SSP_MOUSEWHEELIf set, mouse wheel events on the slider/spin controls will change the value. SSP_INTEGERIf set, the SliderSpinPanelwill store an integer value instead of floating point value.Parameters: - parent – A parent control.
- value – Initial slider/spin value.
- minValue – Minimum slider/spin value.
- maxValue – Maximum slider/spin value.
- label – If not
None, awx.StaticTextwidget is added to the left of the slider, containing the given label. - style – A combination of
SSP_SHOW_LIMITS,SSP_EDIT_LIMITS,SSP_NO_LIMITS,SSP_MOUSEWHEELandSSP_INTEGER. Defaults toSSP_SHOW_LIMITS. - spinWidth – Desired spin control width in characters. See the
FloatSpinCtrlclass.
-
__init__(parent, value=None, minValue=None, maxValue=None, label=None, style=None, spinWidth=None)¶ Create a
SliderSpinPanel.The following style flags are available:
SSP_SHOW_LIMITSIf set, the data range limits are shown alongside the slider/spin control widgets. SSP_EDIT_LIMITSIf set, and SSP_SHOW_LIMITSis also set, the data range limits are shown on buttons alongside the slider/spin control widgets.SSP_MOUSEWHEELIf set, mouse wheel events on the slider/spin controls will change the value. SSP_INTEGERIf set, the SliderSpinPanelwill store an integer value instead of floating point value.Parameters: - parent – A parent control.
- value – Initial slider/spin value.
- minValue – Minimum slider/spin value.
- maxValue – Maximum slider/spin value.
- label – If not
None, awx.StaticTextwidget is added to the left of the slider, containing the given label. - style – A combination of
SSP_SHOW_LIMITS,SSP_EDIT_LIMITS,SSP_NO_LIMITS,SSP_MOUSEWHEELandSSP_INTEGER. Defaults toSSP_SHOW_LIMITS. - spinWidth – Desired spin control width in characters. See the
FloatSpinCtrlclass.
-
slider¶ Returts a reference to the
FloatSlidercontained in thisSliderSpinPanel.
-
spinCtrl¶ Returts a reference to the
FloatSpinCtrlcontained in thisSliderSpinPanel.
-
GetRange()¶ Return a tuple containing the (minimum, maximum) slider/spinbox values.
-
GetMin()¶ Returns the minimum slider/spinbox value.
-
GetMax()¶ Returns the maximum slider/spinbox value.
-
GetValue()¶ Returns the current slider/spinbox value.
-
SetRange(minValue, maxValue)¶ Sets the minimum/maximum slider/spinbox values.
-
SetMin(minValue)¶ Sets the minimum slider/spinbox value.
-
SetMax(maxValue)¶ Sets the maximum slider/spinbox value.
-
SetValue(value)¶ Sets the current slider/spinbox value.
-
_SliderSpinPanel__onLimitButton(ev)¶ Only called if the
SSP_SHOW_LIMITSandSSP_EDIT_LIMITSstyle flags are set.Called when either of the minimum/maximum limit buttons are clicked.
Pops up a
NumberDialogwindow. If the user changes the limit value, updates the slider/spin limits, and emits anEVT_SSP_LIMITevent.
-
_SliderSpinPanel__onSlider(ev)¶ Called when the user changes the slider value.
Updates the spinbox value and emits an
EVT_SSP_VALUEevent.
-
_SliderSpinPanel__onSpin(ev)¶ Called when the user changes the spinbox value.
Updates the slider value and emits an
EVT_SSP_VALUEevent.
-
__module__= 'fsleyes_widgets.floatslider'¶
-
fsleyes_widgets.floatslider.FS_MOUSEWHEEL= 1¶ If set, mouse wheel events on the slider will change the value.
-
fsleyes_widgets.floatslider.FS_INTEGER= 2¶ If set, the slider will store an integer value instead of a floating point value.
-
fsleyes_widgets.floatslider.EVT_SSP_VALUE= <wx.core.PyEventBinder object>¶ Identifier for the
SliderSpinValueEvent.
-
fsleyes_widgets.floatslider.EVT_SSP_LIMIT= <wx.core.PyEventBinder object>¶ Identifier for the
SliderSpinLimitEvent.
-
fsleyes_widgets.floatslider.SliderSpinValueEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.floatslider.SliderSpinLimitEvent¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.floatslider.SSP_SHOW_LIMITS= 1¶ If set, the data range limits are shown alongside the slider/spin control widgets.
-
fsleyes_widgets.floatslider.SSP_EDIT_LIMITS= 2¶ If set, and
SSP_SHOW_LIMITSis also set, the data range limits are shown on buttons alongside the slider/spin control widgets.When the user pushes the button, a
NumberDialogis shown, allowing the user to change the data range.
-
fsleyes_widgets.floatslider.SSP_MOUSEWHEEL= 4¶ If set, mouse wheel events on the slider/spin controls will change the value.
-
fsleyes_widgets.floatslider.SSP_INTEGER= 8¶ If set, the
SliderSpinPanelwill store an integer value instead of floating point value.
-
fsleyes_widgets.floatslider.SSP_NO_LIMITS= 16¶ If set, the user is able to enter values outside of the range into the spin controls.