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)¶ Bases:
wx._core.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:
RP_INTEGER
If set, the RangePanel
stores integer values, rather than floating point.RP_MOUSEWHEEL
If set, the user will be able to change the range values with the mouse wheel. RP_SLIDER
If set, FloatSlider
widgets will be used to control the range values.RP_NO_LIMIT
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
.
-
__init__
(parent, minValue=None, maxValue=None, lowValue=None, highValue=None, lowLabel=None, highLabel=None, minDistance=None, spinWidth=None, style=0)¶ 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
.
- parent – The
-
lowWidget
¶ Returns the low widget, either a
FloatSlider
orFloatSpinCtrl
.
-
highWidget
¶ Returns the high widget, either a
FloatSlider
orFloatSpinCtrl
.
-
GetDistance
()¶ Returns the minimum distance that is maintained between the low/high range values.
-
SetDistance
(distance)¶ Sets the minimum distance to be maintained between the low/high range values.
-
GetLow
()¶ Returns the current low range value.
-
GetHigh
()¶ Returns the current high range value.
-
SetLow
(lowValue)¶ Set the current low range value
-
SetHigh
(highValue)¶ Set the current high range value
-
GetRange
()¶ Returns a tuple containing the current (low, high) range values.
-
SetRange
(lowValue, highValue)¶ Sets the current (low, high) range values, making sure that they are at within the low/high limits, and least (min distance) apart.
-
GetLimits
()¶ Returns a tuple containing the current (minimum, maximum) range limit values.
-
SetLimits
(minValue, maxValue)¶ Sets the current (minimum, maximum) range limit values.
-
GetMin
()¶ Returns the current minimum range value.
-
GetMax
()¶ Returns the current maximum range value.
-
SetMin
(minValue)¶ Sets the current minimum range value.
-
SetMax
(maxValue)¶ Sets the current maximum range value.
-
_RangePanel__onHighChange
(ev=None)¶ Called when the user changes the high widget.
Attempts to make sure that the low widget is at least (high value - min distance), then posts a
RangeEvent
.
-
_RangePanel__onLowChange
(ev=None)¶ Called when the user changes the low widget.
Attempts to make sure that the high widget is at least (low value + min distance), then posts a
RangeEvent
.
-
__module__
= 'fsleyes_widgets.rangeslider'¶
- parent – The
-
class
fsleyes_widgets.rangeslider.
RangeSliderSpinPanel
(parent, minValue=None, maxValue=None, lowValue=None, highValue=None, minDistance=None, lowLabel=None, highLabel=None, spinWidth=None, style=None)¶ Bases:
wx._core.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:
RSSP_INTEGER
If set, the RangeSliderSpinPanel
stores integer values, rather than floating point.RSSP_MOUSEWHEEL
If set, the user will be able to change the range values with the mouse wheel. RSSP_SHOW_LIMITS
If set, the minimum/maximum range values are shown alongside the range controls. RSSP_EDIT_LIMITS
If set, and RSSP_SHOW_LIMITS
is also set, the minimum/maximum range values are shown alongside the range controls on buttons.RSSP_NO_LIMIT
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. 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
.
-
__init__
(parent, minValue=None, maxValue=None, lowValue=None, highValue=None, minDistance=None, lowLabel=None, highLabel=None, spinWidth=None, style=None)¶ 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. 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
.
- parent – The
-
lowSlider
¶ Returns the
FloatSlider
for the low range.
-
highSlider
¶ Returns the
FloatSlider
for the high range.
-
lowSpin
¶ Returns the
FloatSpinCtrl
for the low range.
-
highSpin
¶ Returns the
FloatSpinCtrl
for the high range.
-
minButton
¶ Returns the button to edit the lower range limit, or
None
ifRSSP_EDIT_LIMITS
is not active.
-
maxButton
¶ Returns the button to edit the upper range limit, or
None
ifRSSP_EDIT_LIMITS
is not active.
-
GetDistance
()¶ Returns the minimum distance between the low/high range values.
-
SetDistance
(distance)¶ Sets the minimum distance between the low/high range values.
-
GetLimits
()¶ Returns the minimum/maximum range values.
-
SetLimits
(minValue, maxValue)¶ Sets the minimum/maximum range values.
-
SetMin
(minValue)¶ Sets the minimum range value.
-
SetMax
(maxValue)¶ Sets the maximum range value.
-
GetMin
()¶ Returns the minimum range value.
-
GetMax
()¶ Returns the maximum range value.
-
GetLow
()¶ Returns the current low range value.
-
GetHigh
()¶ Returns the current high range value.
-
SetLow
(lowValue)¶ Sets the current low range value.
-
SetHigh
(highValue)¶ Sets the current high range value.
-
GetRange
()¶ Return the current (low, high) range values.
-
SetRange
(lowValue, highValue)¶ Set the current low and high range values.
-
_RangeSliderSpinPanel__onLimitButton
(ev)¶ Called when one of the min/max buttons is pushed. Pops up a dialog prompting the user to enter a new value, and updates the range limits accordingly. Emits a
RangeLimitEvent
.
-
_RangeSliderSpinPanel__onRangeChange
(ev)¶ Called when the user edits the limits on either the slider or spinboxes. Syncs the change between the sliders and spinboxes, and re-posts the event.
-
__module__
= 'fsleyes_widgets.rangeslider'¶
- parent – The
-
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
¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.rangeslider.
LowRangeEvent
¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.rangeslider.
HighRangeEvent
¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event
-
fsleyes_widgets.rangeslider.
RangeLimitEvent
¶ alias of
wx.lib.newevent.NewEvent.<locals>._Event