fsleyes_widgets.rangeslider
This module provides the RangePanel
and
RangeSliderSpinPanel
classes, both of which contain controls allowing
the user to modify a range.
The RangeSliderSpinPanel
is a widget which contains two
RangePanel
widgets - one with sliders, and one with spinboxes. All
four control widgets are linked.
- class fsleyes_widgets.rangeslider.RangePanel(parent, minValue=None, maxValue=None, lowValue=None, highValue=None, lowLabel=None, highLabel=None, minDistance=None, spinWidth=None, style=0)[source]
Bases:
Panel
RangePanel
is a widget which contains two sliders or spinboxes (eitherFloatSlider
, orFloatSpinCtrl
), allowing a range to be set.When the user changes the low range value to a value beyond the current high value, the high value is increased such that it remains at least a minimum value above the low value. The inverse relationship is also enforced. Whenever the user chenges the low or high range values,
EVT_LOW_RANGE
orEVT_HIGH_RANGE
events are generated respectively.A situation may arise whereby a change to one limit will affect the other ( e.g. when enforcing a minimum distance between the values). When this occurs, an
EVT_RANGE
event is generated. So you may need to listen for all three types of event.The following style flags are available:
If set, the
RangePanel
stores integer values, rather than floating point.If set, the user will be able to change the range values with the mouse wheel.
If set,
FloatSlider
widgets will be used to control the range values.If set, and
RP_SLIDER
is not set, the user will be able to enter values into the spin controls that are beyond the current minimum/maximum range values.Create a
RangePanel
.- Parameters:
parent – The
wx
parent object.minValue – Minimum range value.
maxValue – Maximum range value.
lowLabel – If not
None
, awx.StaticText
widget is placed to the left of the low widget, containing the given label.highLabel – If not
None
, awx.StaticText
widget is placed to the left of the high widget, containing the given label.lowValue – Initial low range value.
highValue – Initial high range value.
minDistance – Minimum distance to be maintained between low/high values.
spinWidth – Desired spin control width. See the
FloatSpinCtrl
class.style – A combination of
RP_MOUSEWHEEL
,RP_INTEGER
,RP_SLIDER
, andRP_NO_LIMIT
.
- property lowWidget
Returns the low widget, either a
FloatSlider
orFloatSpinCtrl
.
- property highWidget
Returns the high widget, either a
FloatSlider
orFloatSpinCtrl
.
- GetDistance()[source]
Returns the minimum distance that is maintained between the low/high range values.
- SetDistance(distance)[source]
Sets the minimum distance to be maintained between the low/high range values.
- class fsleyes_widgets.rangeslider.RangeSliderSpinPanel(parent, minValue=None, maxValue=None, lowValue=None, highValue=None, minDistance=None, lowLabel=None, highLabel=None, spinWidth=None, style=None)[source]
Bases:
Panel
A
wx.Panel
which contains two sliders and two spinboxes.The sliders and spinboxes are contained within two
RangePanel
instances respectively. One slider and spinbox pair is used to edit the low value of a range, and the other slider/spinbox used to edit the high range value. Buttons are optionally displayed on either end which display the minimum/maximum limits and, when clicked, allow the user to modify said limits.The
RangeSliderSpinPanel
forwards events from theRangePanel
instances when the user edits the low/high range values, and generates aRangeLimitEvent
when the user edits the range limits.The following style flags are available:
If set, the
RangeSliderSpinPanel
stores integer values, rather than floating point.If set, the user will be able to change the range values with the mouse wheel.
If set, the minimum/maximum range values are shown alongside the range controls.
If set, and
RSSP_SHOW_LIMITS
is also set, the minimum/maximum range values are shown alongside the range controls on buttons.If set, the user is able to enter values into the spin controls which are outside of the current minimum/maximum.
A
RangeSliderSpinPanel
will look something like this:Create a
RangeSliderSpinPanel
.- Parameters:
parent – The
wx
parent object.minValue – Minimum low value.
maxValue – Maximum high value.
lowValue – Initial low value.
highValue – Initial high value.
minDistance – Minimum distance to maintain between low and high values.
lowLabel – If not
None
, awx.StaticText
widget is placed to the left of the low slider, containing the label.highLabel – If not
None
, awx.StaticText
widget is placed to the left of the high slider, containing the label.spinWidth – Desired spin control width. Defaults to 6. See the
FloatSpinCtrl
class.style – A combination of
RSSP_INTEGER
,RSSP_MOUSEWHEEL
,RSSP_SHOW_LIMITS
,RSSP_EDIT_LIMITS
, andRSSP_NO_LIMIT
. Defaults toRSSP_SHOW_LIMITS
.
- property lowSlider
Returns the
FloatSlider
for the low range.
- property highSlider
Returns the
FloatSlider
for the high range.
- property lowSpin
Returns the
FloatSpinCtrl
for the low range.
- property highSpin
Returns the
FloatSpinCtrl
for the high range.
- property minButton
Returns the button to edit the lower range limit, or
None
ifRSSP_EDIT_LIMITS
is not active.
- property maxButton
Returns the button to edit the upper range limit, or
None
ifRSSP_EDIT_LIMITS
is not active.
- fsleyes_widgets.rangeslider.RP_INTEGER = 1
If set, the
RangePanel
stores integer values, rather than floating point.
- fsleyes_widgets.rangeslider.RP_MOUSEWHEEL = 2
If set, the user will be able to change the range values with the mouse wheel.
- fsleyes_widgets.rangeslider.RP_SLIDER = 4
If set,
FloatSlider
widgets will be used to control the range values. If not set,FloatSpinCtrl
widgets are used.
- fsleyes_widgets.rangeslider.RP_NO_LIMIT = 8
If set, and
RP_SLIDER
is not set, the user will be able to enter values into the spin controls that are beyond the current minimum/maximum range values.
- fsleyes_widgets.rangeslider.RSSP_INTEGER = 1
If set, the
RangeSliderSpinPanel
stores integer values, rather than floating point.
- fsleyes_widgets.rangeslider.RSSP_MOUSEWHEEL = 2
If set, the user will be able to change the range values with the mouse wheel.
- fsleyes_widgets.rangeslider.RSSP_SHOW_LIMITS = 4
If set, the minimum/maximum range values are shown alongside the range controls.
- fsleyes_widgets.rangeslider.RSSP_EDIT_LIMITS = 8
If set, and
RSSP_SHOW_LIMITS
is also set, the minimum/maximum range values are shown alongside the range controls on buttons. When the presses a button, a dialog is displayed allowing them to change the range limits.
- fsleyes_widgets.rangeslider.RSSP_NO_LIMIT = 16
If set, the user is able to enter values into the spin controls which are outside of the current minimum/maximum.
- fsleyes_widgets.rangeslider.EVT_RANGE = <wx.core.PyEventBinder object>
Identifier for the
RangeEvent
.
- fsleyes_widgets.rangeslider.EVT_LOW_RANGE = <wx.core.PyEventBinder object>
Identifier for the
LowRangeEvent
.
- fsleyes_widgets.rangeslider.EVT_HIGH_RANGE = <wx.core.PyEventBinder object>
Identifier for the
HighRangeEvent
.
- fsleyes_widgets.rangeslider.EVT_RANGE_LIMIT = <wx.core.PyEventBinder object>
Identifier for the
RangeLimitEvent
.
- fsleyes_widgets.rangeslider.RangeEvent
Event emitted by
RangePanel
andRangeSliderSpinPanel
objects when either of their low or high values change. Contains two attributes,low
andhigh
, containing the new low/high range values.
- fsleyes_widgets.rangeslider.LowRangeEvent
Event emitted by
RangePanel
andRangeSliderSpinPanel
objects when their low value changes. Contains one attributes,low
, containing the new low range value.
- fsleyes_widgets.rangeslider.HighRangeEvent
Event emitted by
RangePanel
andRangeSliderSpinPanel
objects when their high value changes. Contains one attributes,high
, containing the new high range value.
- fsleyes_widgets.rangeslider.RangeLimitEvent
Event emitted by
RangeSliderSpinPanel
objects when the user modifies the range limits. Contains two attributes,min
andmax
, containing the new minimum/maximum range limits.