microeye 2.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microEye/__init__.py +47 -0
- microEye/_version.py +2 -0
- microEye/analysis/__init__.py +1 -0
- microEye/analysis/checklist_dialog.py +143 -0
- microEye/analysis/cmosMaps.py +228 -0
- microEye/analysis/filters/__init__.py +9 -0
- microEye/analysis/filters/base.py +21 -0
- microEye/analysis/filters/spatial.py +338 -0
- microEye/analysis/filters/temporal.py +76 -0
- microEye/analysis/fitting/__init__.py +0 -0
- microEye/analysis/fitting/fit.py +680 -0
- microEye/analysis/fitting/nena.py +375 -0
- microEye/analysis/fitting/phasor_fit.py +90 -0
- microEye/analysis/fitting/processing.py +317 -0
- microEye/analysis/fitting/psf/__init__.py +6 -0
- microEye/analysis/fitting/psf/extract.py +1129 -0
- microEye/analysis/fitting/psf/rubost_mean.py +150 -0
- microEye/analysis/fitting/psf/spline.py +167 -0
- microEye/analysis/fitting/psf/stats/__init__.py +12 -0
- microEye/analysis/fitting/psf/stats/core.py +295 -0
- microEye/analysis/fitting/psf/stats/curve_fit.py +708 -0
- microEye/analysis/fitting/psf/stats/io.py +104 -0
- microEye/analysis/fitting/psf/stats/slope_fit.py +171 -0
- microEye/analysis/fitting/psf/temp.py +147 -0
- microEye/analysis/fitting/psf/test.py +47 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUfunctions.py +657 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUmleFit_LM.py +1336 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUsplineLib.py +270 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/__init__.py +1 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUfunctions.py +609 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_EMCCD.py +1396 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_sCMOS.py +1426 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUsplineLib.py +231 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/__init__.py +2 -0
- microEye/analysis/fitting/pyfit3Dcspline/__init__.py +10 -0
- microEye/analysis/fitting/pyfit3Dcspline/constants.py +27 -0
- microEye/analysis/fitting/pyfit3Dcspline/mainfunctions.py +903 -0
- microEye/analysis/fitting/results.py +917 -0
- microEye/analysis/fitting/results_stats.py +251 -0
- microEye/analysis/fitting/tardis.py +209 -0
- microEye/analysis/multi_viewer.py +568 -0
- microEye/analysis/processing/__init__.py +1 -0
- microEye/analysis/processing/frc.py +120 -0
- microEye/analysis/rendering/__init__.py +3 -0
- microEye/analysis/rendering/base.py +452 -0
- microEye/analysis/rendering/cloud.py +215 -0
- microEye/analysis/rendering/core.py +47 -0
- microEye/analysis/rendering/volumetric.py +198 -0
- microEye/analysis/tools/__init__.py +0 -0
- microEye/analysis/tools/kymograms.py +1079 -0
- microEye/analysis/tools/roi_selectors.py +556 -0
- microEye/analysis/utils/__init__.py +3 -0
- microEye/analysis/utils/coordinates.py +18 -0
- microEye/analysis/utils/images.py +68 -0
- microEye/analysis/utils/windows.py +19 -0
- microEye/analysis/viewer/__init__.py +3 -0
- microEye/analysis/viewer/image_options_widget.py +615 -0
- microEye/analysis/viewer/images.py +1225 -0
- microEye/analysis/viewer/layers_widget.py +415 -0
- microEye/analysis/viewer/localizations.py +1304 -0
- microEye/analysis/viewer/psf.py +1003 -0
- microEye/analysis/viewer/volume.py +456 -0
- microEye/hardware/__init__.py +3 -0
- microEye/hardware/cams/__init__.py +29 -0
- microEye/hardware/cams/camera_calibration.py +99 -0
- microEye/hardware/cams/camera_list.py +528 -0
- microEye/hardware/cams/camera_options.py +694 -0
- microEye/hardware/cams/camera_panel.py +941 -0
- microEye/hardware/cams/dummy/__init__.py +1 -0
- microEye/hardware/cams/dummy/dummy_panel.py +759 -0
- microEye/hardware/cams/jobs.py +497 -0
- microEye/hardware/cams/line_profiler.py +99 -0
- microEye/hardware/cams/linescan/IR_Cam.py +474 -0
- microEye/hardware/cams/linescan/__init__.py +1 -0
- microEye/hardware/cams/micam.py +524 -0
- microEye/hardware/cams/pco/__init__.py +58 -0
- microEye/hardware/cams/pco/enums.py +382 -0
- microEye/hardware/cams/pco/pco_cam.py +761 -0
- microEye/hardware/cams/pco/pco_panel.py +477 -0
- microEye/hardware/cams/shortcuts.py +312 -0
- microEye/hardware/cams/thorlabs/__init__.py +1 -0
- microEye/hardware/cams/thorlabs/thorlabs.py +1508 -0
- microEye/hardware/cams/thorlabs/thorlabs_panel.py +850 -0
- microEye/hardware/cams/ueye/__init__.py +1 -0
- microEye/hardware/cams/ueye/ueye_camera.py +1023 -0
- microEye/hardware/cams/ueye/ueye_panel.py +861 -0
- microEye/hardware/cams/vimba/__init__.py +1 -0
- microEye/hardware/cams/vimba/vimba_cam.py +1000 -0
- microEye/hardware/cams/vimba/vimba_panel.py +813 -0
- microEye/hardware/device.py +60 -0
- microEye/hardware/lasers/__init__.py +13 -0
- microEye/hardware/lasers/io_matchbox.py +791 -0
- microEye/hardware/lasers/io_params.py +85 -0
- microEye/hardware/lasers/io_single_laser.py +742 -0
- microEye/hardware/lasers/laser_relay.py +594 -0
- microEye/hardware/mieye/__init__.py +1 -0
- microEye/hardware/mieye/acquisition_manager.py +467 -0
- microEye/hardware/mieye/devices_manager.py +533 -0
- microEye/hardware/mieye/miEye.py +659 -0
- microEye/hardware/misc/__init__.py +0 -0
- microEye/hardware/misc/acquisition_view.py +71 -0
- microEye/hardware/misc/reglo.py +761 -0
- microEye/hardware/misc/temp.py +188 -0
- microEye/hardware/port_config.py +59 -0
- microEye/hardware/protocols/__init__.py +2 -0
- microEye/hardware/protocols/actions.py +402 -0
- microEye/hardware/protocols/actions_items.py +703 -0
- microEye/hardware/protocols/designer.py +244 -0
- microEye/hardware/protocols/scene_manager.py +191 -0
- microEye/hardware/protocols/serialization.py +97 -0
- microEye/hardware/pycromanager/__init__.py +16 -0
- microEye/hardware/pycromanager/core.py +1433 -0
- microEye/hardware/pycromanager/devices.py +461 -0
- microEye/hardware/pycromanager/enums.py +107 -0
- microEye/hardware/pycromanager/headless.py +153 -0
- microEye/hardware/pycromanager/utils.py +34 -0
- microEye/hardware/pycromanager/widgets/__init__.py +5 -0
- microEye/hardware/pycromanager/widgets/bridges.py +407 -0
- microEye/hardware/pycromanager/widgets/headless_manager.py +258 -0
- microEye/hardware/pycromanager/widgets/headless_options.py +224 -0
- microEye/hardware/pycromanager/widgets/pycro_panel.py +455 -0
- microEye/hardware/stages/__init__.py +18 -0
- microEye/hardware/stages/elliptec/__init__.py +5 -0
- microEye/hardware/stages/elliptec/baseDevice.py +314 -0
- microEye/hardware/stages/elliptec/device.py +384 -0
- microEye/hardware/stages/elliptec/deviceID.py +212 -0
- microEye/hardware/stages/elliptec/devicePort.py +379 -0
- microEye/hardware/stages/elliptec/deviceStatus.py +65 -0
- microEye/hardware/stages/elliptec/devicesView.py +706 -0
- microEye/hardware/stages/elliptec/ellDevices.py +134 -0
- microEye/hardware/stages/elliptec/messageUpdater.py +34 -0
- microEye/hardware/stages/elliptec/motorInfo.py +153 -0
- microEye/hardware/stages/elliptec/stage.py +62 -0
- microEye/hardware/stages/elliptec/test.py +139 -0
- microEye/hardware/stages/kinesis/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/enums.py +1002 -0
- microEye/hardware/stages/kinesis/kdc101/factory.py +171 -0
- microEye/hardware/stages/kinesis/kdc101/kdc101.py +718 -0
- microEye/hardware/stages/kinesis/kinesis.py +776 -0
- microEye/hardware/stages/piezo_concept.py +607 -0
- microEye/hardware/stages/stabilizer.py +785 -0
- microEye/hardware/stages/stage.py +89 -0
- microEye/hardware/widgets/__init__.py +10 -0
- microEye/hardware/widgets/controller.py +246 -0
- microEye/hardware/widgets/devices.py +133 -0
- microEye/hardware/widgets/focusWidget.py +264 -0
- microEye/hardware/widgets/qlist_slider.py +113 -0
- microEye/hardware/widgets/scan_acquisition.py +424 -0
- microEye/icons/1024.png +0 -0
- microEye/icons/128.png +0 -0
- microEye/icons/16.png +0 -0
- microEye/icons/24.png +0 -0
- microEye/icons/256.png +0 -0
- microEye/icons/32.png +0 -0
- microEye/icons/48.png +0 -0
- microEye/icons/512.png +0 -0
- microEye/icons/64.png +0 -0
- microEye/icons/__init__.py +0 -0
- microEye/icons/close.svg +88 -0
- microEye/icons/mieye.png +0 -0
- microEye/icons/min.svg +83 -0
- microEye/icons/viewer.png +0 -0
- microEye/launcher.py +42 -0
- microEye/qt.py +181 -0
- microEye/utils/__init__.py +2 -0
- microEye/utils/enum_encoder.py +10 -0
- microEye/utils/expandable_groupbox.py +93 -0
- microEye/utils/gui_helper.py +457 -0
- microEye/utils/hid/__init__.py +8 -0
- microEye/utils/hid/controller.py +153 -0
- microEye/utils/hid/device.py +63 -0
- microEye/utils/hid/enums.py +140 -0
- microEye/utils/hid/utils.py +58 -0
- microEye/utils/labelled_slider.py +134 -0
- microEye/utils/metadata.py +599 -0
- microEye/utils/metadata_tree.py +718 -0
- microEye/utils/micro_launcher.py +245 -0
- microEye/utils/parameter_tree.py +325 -0
- microEye/utils/pyscripting.py +444 -0
- microEye/utils/retry_exec.py +35 -0
- microEye/utils/start_gui.py +112 -0
- microEye/utils/thread_worker.py +115 -0
- microEye/utils/uImage.py +1512 -0
- microeye-2.3.2.dist-info/METADATA +401 -0
- microeye-2.3.2.dist-info/RECORD +190 -0
- microeye-2.3.2.dist-info/WHEEL +5 -0
- microeye-2.3.2.dist-info/entry_points.txt +2 -0
- microeye-2.3.2.dist-info/licenses/LICENSE +674 -0
- microeye-2.3.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Buttons(Enum):
|
|
7
|
+
'''
|
|
8
|
+
Enum representing controller buttons.
|
|
9
|
+
|
|
10
|
+
Each enum member has a unique value representing its state in the report,
|
|
11
|
+
along with additional information like identifier, description, etc.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
A : Buttons
|
|
16
|
+
Represents the X/A button on the controller.
|
|
17
|
+
B : Buttons
|
|
18
|
+
Represents the O/B button on the controller.
|
|
19
|
+
X : Buttons
|
|
20
|
+
Represents the Sq/X button on the controller.
|
|
21
|
+
Y : Buttons
|
|
22
|
+
Represents the Tri/Y button on the controller.
|
|
23
|
+
L1 : Buttons
|
|
24
|
+
Represents the L1 button on the controller.
|
|
25
|
+
R1 : Buttons
|
|
26
|
+
Represents the R1 button on the controller.
|
|
27
|
+
Share : Buttons
|
|
28
|
+
Represents the Share button on the controller.
|
|
29
|
+
Options : Buttons
|
|
30
|
+
Represents the Options button on the controller.
|
|
31
|
+
L3 : Buttons
|
|
32
|
+
Represents the L3 button on the controller.
|
|
33
|
+
R3 : Buttons
|
|
34
|
+
Represents the R3 button on the controller.
|
|
35
|
+
UP : Buttons
|
|
36
|
+
Represents the D-Pad UP button on the controller.
|
|
37
|
+
RIGHT : Buttons
|
|
38
|
+
Represents the D-Pad RIGHT button on the controller.
|
|
39
|
+
DOWN : Buttons
|
|
40
|
+
Represents the D-Pad DOWN button on the controller.
|
|
41
|
+
LEFT : Buttons
|
|
42
|
+
Represents the D-Pad LEFT button on the controller.
|
|
43
|
+
|
|
44
|
+
Methods
|
|
45
|
+
-------
|
|
46
|
+
__str__()
|
|
47
|
+
String representation of the button.
|
|
48
|
+
from_string(s)
|
|
49
|
+
Get an enum member based on its string representation.
|
|
50
|
+
from_value(ch, id)
|
|
51
|
+
Get an enum member based on its channel and identifier.
|
|
52
|
+
strings()
|
|
53
|
+
Get an array of string representations of all enum members.
|
|
54
|
+
'''
|
|
55
|
+
A = (1, 0, 'X/A')
|
|
56
|
+
B = (2, 0, 'O/B')
|
|
57
|
+
X = (4, 0, 'Sq/X')
|
|
58
|
+
Y = (8, 0, 'Tri/Y')
|
|
59
|
+
L1 = (16, 0, 'L1')
|
|
60
|
+
R1 = (32, 0, 'R1')
|
|
61
|
+
Share = (64, 0, 'Share')
|
|
62
|
+
Options = (128, 0, 'Options')
|
|
63
|
+
|
|
64
|
+
L3 = (1, 1, 'L3')
|
|
65
|
+
R3 = (2, 1, 'R3')
|
|
66
|
+
UP = (4, 1, 'D-Pad UP')
|
|
67
|
+
RIGHT = (12, 1, 'D-Pad RIGHT')
|
|
68
|
+
DOWN = (20, 1, 'D-Pad DOWN')
|
|
69
|
+
LEFT = (28, 1, 'D-Pad LEFT')
|
|
70
|
+
|
|
71
|
+
def __str__(self):
|
|
72
|
+
'''String representation of the button.'''
|
|
73
|
+
return self.value[-1]
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_string(cls, s):
|
|
77
|
+
'''Get an enum member based on its string representation.'''
|
|
78
|
+
for column in cls:
|
|
79
|
+
if column.value[-1] == s:
|
|
80
|
+
return column
|
|
81
|
+
raise ValueError(cls.__name__ + ' has no value matching "' + s + '"')
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_value(cls, ch, id):
|
|
85
|
+
'''Get an enum member based on its channel and identifier.
|
|
86
|
+
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
|
+
ch : int
|
|
90
|
+
The channel of the button.
|
|
91
|
+
id : int
|
|
92
|
+
The identifier of the button.
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
Buttons
|
|
97
|
+
The enum member representing the button with the
|
|
98
|
+
given channel and identifier.
|
|
99
|
+
|
|
100
|
+
Raises
|
|
101
|
+
------
|
|
102
|
+
ValueError
|
|
103
|
+
If no enum member is found with the given channel and identifier.
|
|
104
|
+
'''
|
|
105
|
+
for column in cls:
|
|
106
|
+
if column.value[0] == id and column.value[1] == ch:
|
|
107
|
+
return column
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def strings(cls):
|
|
112
|
+
'''Get an array of string representations of all enum members.'''
|
|
113
|
+
res = []
|
|
114
|
+
for column in cls:
|
|
115
|
+
res.append(column.value[-1])
|
|
116
|
+
return np.array(res)
|
|
117
|
+
|
|
118
|
+
class hidParams(Enum):
|
|
119
|
+
'''
|
|
120
|
+
Enum class defining hidController parameters.
|
|
121
|
+
'''
|
|
122
|
+
TITLE = 'HID Controller'
|
|
123
|
+
DEVICE = 'Device'
|
|
124
|
+
REFRESH = 'Refresh'
|
|
125
|
+
OPEN = 'Open'
|
|
126
|
+
CLOSE = 'Close'
|
|
127
|
+
|
|
128
|
+
REMOVE = 'Remove Device'
|
|
129
|
+
|
|
130
|
+
def __str__(self):
|
|
131
|
+
'''
|
|
132
|
+
Return the last part of the enum value (Param name).
|
|
133
|
+
'''
|
|
134
|
+
return self.value.split('.')[-1]
|
|
135
|
+
|
|
136
|
+
def get_path(self):
|
|
137
|
+
'''
|
|
138
|
+
Return the full parameter path.
|
|
139
|
+
'''
|
|
140
|
+
return self.value.split('.')
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def map_range(value, args):
|
|
5
|
+
'''
|
|
6
|
+
Map a value from one range to another.
|
|
7
|
+
|
|
8
|
+
... (rest of the map_range function docstring)
|
|
9
|
+
'''
|
|
10
|
+
old_min, old_max, new_min, new_max = args
|
|
11
|
+
return (new_min +
|
|
12
|
+
(new_max - new_min) * (value - old_min) / (old_max - old_min))
|
|
13
|
+
|
|
14
|
+
def dz_scaled_radial(stick_input, deadzone):
|
|
15
|
+
'''
|
|
16
|
+
Apply a scaled radial transformation with deadzone.
|
|
17
|
+
|
|
18
|
+
... (rest of the dz_scaled_radial function docstring)
|
|
19
|
+
'''
|
|
20
|
+
input_magnitude = np.linalg.norm(stick_input)
|
|
21
|
+
if input_magnitude < deadzone:
|
|
22
|
+
return 0, 0
|
|
23
|
+
else:
|
|
24
|
+
input_normalized = stick_input / input_magnitude
|
|
25
|
+
retval = input_normalized * map_range(
|
|
26
|
+
input_magnitude, (deadzone, 1, 0, 1))
|
|
27
|
+
return retval[0], retval[1]
|
|
28
|
+
|
|
29
|
+
def dz_sloped_scaled_axial(stick_input, deadzone, n=1):
|
|
30
|
+
'''
|
|
31
|
+
Apply a sloped scaled axial transformation with deadzone.
|
|
32
|
+
|
|
33
|
+
... (rest of the dz_sloped_scaled_axial function docstring)
|
|
34
|
+
'''
|
|
35
|
+
x_val = 0
|
|
36
|
+
y_val = 0
|
|
37
|
+
deadzone_x = deadzone * np.power(abs(stick_input[1]), n)
|
|
38
|
+
deadzone_y = deadzone * np.power(abs(stick_input[0]), n)
|
|
39
|
+
sign = np.sign(stick_input)
|
|
40
|
+
if abs(stick_input[0]) > deadzone_x:
|
|
41
|
+
x_val = sign[0] * map_range(abs(stick_input[0]), (deadzone_x, 1, 0, 1))
|
|
42
|
+
if abs(stick_input[1]) > deadzone_y:
|
|
43
|
+
y_val = sign[1] * map_range(abs(stick_input[1]), (deadzone_y, 1, 0, 1))
|
|
44
|
+
return x_val, y_val
|
|
45
|
+
|
|
46
|
+
def dz_hybrid(stick_input, deadzone):
|
|
47
|
+
'''
|
|
48
|
+
Apply a hybrid transformation with deadzone.
|
|
49
|
+
|
|
50
|
+
... (rest of the dz_hybrid function docstring)
|
|
51
|
+
'''
|
|
52
|
+
input_magnitude = np.linalg.norm(stick_input)
|
|
53
|
+
if input_magnitude < deadzone:
|
|
54
|
+
return 0, 0
|
|
55
|
+
|
|
56
|
+
partial_output = dz_scaled_radial(stick_input, deadzone)
|
|
57
|
+
|
|
58
|
+
return partial_output
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
from microEye.qt import Qt, QtWidgets, Signal
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class LabelledSlider(QtWidgets.QWidget):
|
|
5
|
+
'''
|
|
6
|
+
A custom widget representing a labeled slider with optional range labels.
|
|
7
|
+
|
|
8
|
+
Attributes:
|
|
9
|
+
finished (Signal): Signal emitted when editing is finished.
|
|
10
|
+
valueChanged (Signal): Signal emitted when value is changed.
|
|
11
|
+
'''
|
|
12
|
+
|
|
13
|
+
finished = Signal()
|
|
14
|
+
valueChanged = Signal(int)
|
|
15
|
+
|
|
16
|
+
def __init__(self, parent=None, show_range_labels=True, vrange=(0, 100), offset=1):
|
|
17
|
+
'''
|
|
18
|
+
Initialize the LabelledSlider widget.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
parent : QWidget, optional
|
|
23
|
+
Parent widget, by default None.
|
|
24
|
+
show_range_labels : bool, optional
|
|
25
|
+
Whether to show range labels, by default True.
|
|
26
|
+
'''
|
|
27
|
+
super().__init__(parent)
|
|
28
|
+
self._offset = offset
|
|
29
|
+
self.initUI(vrange)
|
|
30
|
+
self.showRangeLabels(show_range_labels)
|
|
31
|
+
|
|
32
|
+
def initUI(self, vrange: tuple[int, int]):
|
|
33
|
+
'''
|
|
34
|
+
Initialize the UI components of the widget.
|
|
35
|
+
'''
|
|
36
|
+
self.slider = QtWidgets.QSlider(
|
|
37
|
+
tickPosition=QtWidgets.QSlider.TickPosition.NoTicks,
|
|
38
|
+
orientation=Qt.Orientation.Horizontal,
|
|
39
|
+
)
|
|
40
|
+
self.slider.setMaximum(0)
|
|
41
|
+
|
|
42
|
+
self.label = QtWidgets.QSpinBox()
|
|
43
|
+
self.label.setSizePolicy(
|
|
44
|
+
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
|
|
45
|
+
QtWidgets.QSizePolicy.Policy.Expanding,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
self.label.valueChanged.connect(self.changeValue)
|
|
49
|
+
self.slider.valueChanged.connect(self.changeValue)
|
|
50
|
+
self.slider.sliderReleased.connect(lambda: self.finished.emit())
|
|
51
|
+
self.label.editingFinished.connect(lambda: self.finished.emit())
|
|
52
|
+
|
|
53
|
+
self.label_minimum = QtWidgets.QLabel()
|
|
54
|
+
self.label_maximum = QtWidgets.QLabel()
|
|
55
|
+
|
|
56
|
+
self.slider.rangeChanged.connect(
|
|
57
|
+
lambda min, max: self.label_minimum.setNum(vrange[0] + self._offset)
|
|
58
|
+
)
|
|
59
|
+
self.slider.rangeChanged.connect(
|
|
60
|
+
lambda min, max: self.label_maximum.setNum(vrange[1] + self._offset)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
slider_hbox = QtWidgets.QHBoxLayout(self)
|
|
64
|
+
slider_hbox.setContentsMargins(0, 0, 0, 0)
|
|
65
|
+
slider_hbox.setSpacing(0)
|
|
66
|
+
|
|
67
|
+
slider_hbox.addWidget(self.label_minimum)
|
|
68
|
+
slider_hbox.addWidget(self.slider)
|
|
69
|
+
slider_hbox.addWidget(self.label_maximum)
|
|
70
|
+
slider_hbox.addWidget(self.label)
|
|
71
|
+
|
|
72
|
+
self.setRange(*vrange)
|
|
73
|
+
|
|
74
|
+
def setRange(self, min: int, max: int):
|
|
75
|
+
'''
|
|
76
|
+
Set the range for the slider.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
min : int
|
|
81
|
+
Minimum value of the range.
|
|
82
|
+
max : int
|
|
83
|
+
Maximum value of the range.
|
|
84
|
+
'''
|
|
85
|
+
self.label.setMinimum(min + self._offset)
|
|
86
|
+
self.label.setMaximum(max + self._offset)
|
|
87
|
+
self.slider.setMinimum(min)
|
|
88
|
+
self.slider.setMaximum(max)
|
|
89
|
+
|
|
90
|
+
def changeValue(self, value):
|
|
91
|
+
'''
|
|
92
|
+
Change the value of the slider.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
value : int
|
|
97
|
+
New value of the slider.
|
|
98
|
+
'''
|
|
99
|
+
self.label.blockSignals(True)
|
|
100
|
+
self.slider.blockSignals(True)
|
|
101
|
+
|
|
102
|
+
if self.sender() is self.slider:
|
|
103
|
+
self.label.setValue(value + self._offset)
|
|
104
|
+
else:
|
|
105
|
+
self.slider.setValue(value - self._offset)
|
|
106
|
+
|
|
107
|
+
self.label.blockSignals(False)
|
|
108
|
+
self.slider.blockSignals(False)
|
|
109
|
+
|
|
110
|
+
self.valueChanged.emit(value)
|
|
111
|
+
|
|
112
|
+
def showRangeLabels(self, show=True):
|
|
113
|
+
'''
|
|
114
|
+
Show or hide the range labels.
|
|
115
|
+
|
|
116
|
+
Parameters
|
|
117
|
+
----------
|
|
118
|
+
show : bool, optional
|
|
119
|
+
Whether to show range labels, by default True.
|
|
120
|
+
'''
|
|
121
|
+
self.label_minimum.setVisible(show)
|
|
122
|
+
self.label_maximum.setVisible(show)
|
|
123
|
+
|
|
124
|
+
def value(self):
|
|
125
|
+
return self.slider.value()
|
|
126
|
+
|
|
127
|
+
def maximum(self):
|
|
128
|
+
return self.slider.maximum()
|
|
129
|
+
|
|
130
|
+
def minimum(self):
|
|
131
|
+
return self.slider.minimum()
|
|
132
|
+
|
|
133
|
+
def setValue(self, value: int):
|
|
134
|
+
return self.slider.setValue(value)
|