pymodaq 3.6.13__py3-none-any.whl → 4.0.1__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.
Potentially problematic release.
This version of pymodaq might be problematic. Click here for more details.
- pymodaq/__init__.py +13 -6
- pymodaq/control_modules/__init__.py +0 -7
- pymodaq/control_modules/daq_move.py +965 -2
- pymodaq/control_modules/daq_move_ui.py +319 -0
- pymodaq/control_modules/daq_viewer.py +1573 -3
- pymodaq/control_modules/daq_viewer_ui.py +393 -0
- pymodaq/control_modules/mocks.py +51 -0
- pymodaq/control_modules/move_utility_classes.py +709 -8
- pymodaq/control_modules/utils.py +256 -0
- pymodaq/control_modules/viewer_utility_classes.py +663 -6
- pymodaq/daq_utils.py +89 -0
- pymodaq/dashboard.py +91 -72
- pymodaq/examples/custom_app.py +12 -11
- pymodaq/examples/custom_viewer.py +10 -10
- pymodaq/examples/function_plotter.py +16 -13
- pymodaq/examples/nonlinearscanner.py +8 -6
- pymodaq/examples/parameter_ex.py +7 -7
- pymodaq/examples/preset_MockCamera.xml +1 -0
- pymodaq/extensions/__init__.py +16 -0
- pymodaq/extensions/console.py +76 -0
- pymodaq/{daq_logger.py → extensions/daq_logger.py} +115 -65
- pymodaq/extensions/daq_scan.py +1339 -0
- pymodaq/extensions/daq_scan_ui.py +240 -0
- pymodaq/extensions/h5browser.py +23 -0
- pymodaq/{pid → extensions/pid}/__init__.py +4 -2
- pymodaq/{pid → extensions/pid}/daq_move_PID.py +2 -2
- pymodaq/{pid → extensions/pid}/pid_controller.py +48 -36
- pymodaq/{pid → extensions/pid}/utils.py +52 -6
- pymodaq/extensions/utils.py +40 -0
- pymodaq/post_treatment/__init__.py +6 -0
- pymodaq/{daq_analysis → post_treatment/daq_analysis}/daq_analysis_main.py +17 -17
- pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_main.py +8 -14
- pymodaq/post_treatment/load_and_plot.py +219 -0
- pymodaq/post_treatment/process_to_scalar.py +263 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +1 -1
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +1 -0
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +109784 -109173
- pymodaq/resources/QtDesigner_Ressources/icons.svg +142 -0
- pymodaq/resources/VERSION +1 -1
- pymodaq/resources/config_template.toml +32 -13
- pymodaq/resources/preset_default.xml +1 -1
- pymodaq/{daq_utils → utils}/Tuto innosetup/script_full_setup.iss +1 -1
- pymodaq/utils/__init__.py +0 -29
- pymodaq/utils/abstract/__init__.py +48 -0
- pymodaq/{daq_utils → utils}/abstract/logger.py +7 -3
- pymodaq/utils/array_manipulation.py +379 -8
- pymodaq/{daq_utils → utils}/calibration_camera.py +6 -6
- pymodaq/{daq_utils → utils}/chrono_timer.py +1 -1
- pymodaq/utils/config.py +448 -0
- pymodaq/utils/conftests.py +5 -0
- pymodaq/utils/daq_utils.py +828 -8
- pymodaq/utils/data.py +1873 -7
- pymodaq/{daq_utils → utils}/db/db_logger/db_logger.py +86 -47
- pymodaq/{daq_utils → utils}/db/db_logger/db_logger_models.py +31 -10
- pymodaq/{daq_utils → utils}/enums.py +12 -7
- pymodaq/utils/exceptions.py +37 -0
- pymodaq/utils/factory.py +82 -0
- pymodaq/{daq_utils → utils}/gui_utils/__init__.py +1 -1
- pymodaq/utils/gui_utils/custom_app.py +129 -0
- pymodaq/utils/gui_utils/file_io.py +66 -0
- pymodaq/{daq_utils → utils}/gui_utils/layout.py +2 -2
- pymodaq/{daq_utils → utils}/gui_utils/utils.py +13 -3
- pymodaq/{daq_utils → utils}/gui_utils/widgets/__init__.py +2 -2
- pymodaq/utils/gui_utils/widgets/label.py +24 -0
- pymodaq/{daq_utils → utils}/gui_utils/widgets/lcd.py +12 -7
- pymodaq/{daq_utils → utils}/gui_utils/widgets/push.py +66 -2
- pymodaq/{daq_utils → utils}/gui_utils/widgets/qled.py +6 -4
- pymodaq/utils/gui_utils/widgets/spinbox.py +24 -0
- pymodaq/{daq_utils → utils}/gui_utils/widgets/table.py +2 -2
- pymodaq/utils/h5modules/__init__.py +1 -0
- pymodaq/{daq_utils/h5backend.py → utils/h5modules/backends.py} +200 -112
- pymodaq/utils/h5modules/browsing.py +683 -0
- pymodaq/utils/h5modules/data_saving.py +839 -0
- pymodaq/utils/h5modules/h5logging.py +110 -0
- pymodaq/utils/h5modules/module_saving.py +350 -0
- pymodaq/utils/h5modules/saving.py +914 -0
- pymodaq/utils/h5modules/utils.py +85 -0
- pymodaq/utils/logger.py +64 -6
- pymodaq/utils/managers/action_manager.py +460 -0
- pymodaq/{daq_utils → utils}/managers/batchscan_manager.py +144 -112
- pymodaq/{daq_utils → utils}/managers/modules_manager.py +188 -114
- pymodaq/{daq_utils → utils}/managers/overshoot_manager.py +3 -3
- pymodaq/utils/managers/parameter_manager.py +110 -0
- pymodaq/{daq_utils → utils}/managers/preset_manager.py +17 -13
- pymodaq/{daq_utils → utils}/managers/preset_manager_utils.py +8 -7
- pymodaq/{daq_utils → utils}/managers/remote_manager.py +7 -6
- pymodaq/{daq_utils → utils}/managers/roi_manager.py +148 -57
- pymodaq/utils/math_utils.py +546 -10
- pymodaq/{daq_utils → utils}/messenger.py +5 -1
- pymodaq/utils/parameter/__init__.py +2 -15
- pymodaq/{daq_utils → utils}/parameter/ioxml.py +12 -6
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/__init__.py +1 -3
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/filedir.py +1 -1
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/itemselect.py +3 -0
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/led.py +1 -1
- pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +161 -0
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/slide.py +1 -1
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/table.py +1 -1
- pymodaq/utils/parameter/utils.py +206 -11
- pymodaq/utils/plotting/data_viewers/__init__.py +6 -0
- pymodaq/utils/plotting/data_viewers/viewer.py +393 -0
- pymodaq/utils/plotting/data_viewers/viewer0D.py +251 -0
- pymodaq/utils/plotting/data_viewers/viewer1D.py +574 -0
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer1Dbasic.py +8 -3
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D.py +292 -357
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D_basic.py +58 -75
- pymodaq/utils/plotting/data_viewers/viewerND.py +738 -0
- pymodaq/{daq_utils → utils}/plotting/gant_chart.py +2 -2
- pymodaq/{daq_utils → utils}/plotting/items/axis_scaled.py +4 -2
- pymodaq/{daq_utils → utils}/plotting/items/image.py +8 -6
- pymodaq/utils/plotting/navigator.py +355 -0
- pymodaq/utils/plotting/scan_selector.py +480 -0
- pymodaq/utils/plotting/utils/axes_viewer.py +88 -0
- pymodaq/utils/plotting/utils/filter.py +538 -0
- pymodaq/utils/plotting/utils/lineout.py +224 -0
- pymodaq/{daq_utils → utils}/plotting/utils/plot_utils.py +196 -84
- pymodaq/{daq_utils → utils}/plotting/utils/signalND.py +21 -13
- pymodaq/utils/plotting/widgets.py +76 -0
- pymodaq/utils/scanner/__init__.py +10 -0
- pymodaq/utils/scanner/scan_factory.py +204 -0
- pymodaq/utils/scanner/scanner.py +271 -0
- pymodaq/utils/scanner/scanners/_1d_scanners.py +117 -0
- pymodaq/utils/scanner/scanners/_2d_scanners.py +293 -0
- pymodaq/utils/scanner/scanners/sequential.py +192 -0
- pymodaq/utils/scanner/scanners/tabular.py +294 -0
- pymodaq/utils/scanner/utils.py +83 -0
- pymodaq/utils/slicing.py +47 -0
- pymodaq/utils/svg/__init__.py +6 -0
- pymodaq/utils/svg/svg_renderer.py +20 -0
- pymodaq/utils/svg/svg_view.py +35 -0
- pymodaq/utils/svg/svg_viewer2D.py +51 -0
- pymodaq/{daq_utils → utils}/tcp_server_client.py +36 -37
- pymodaq/{daq_utils → utils}/tree_layout/tree_layout_main.py +50 -35
- pymodaq/utils/units.py +216 -0
- pymodaq-4.0.1.dist-info/METADATA +159 -0
- {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info}/RECORD +167 -170
- {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info}/WHEEL +1 -2
- pymodaq-4.0.1.dist-info/entry_points.txt +8 -0
- pymodaq/daq_move/daq_move_gui.py +0 -279
- pymodaq/daq_move/daq_move_gui.ui +0 -534
- pymodaq/daq_move/daq_move_main.py +0 -1042
- pymodaq/daq_move/process_from_QtDesigner_DAQ_Move_GUI.bat +0 -2
- pymodaq/daq_move/utility_classes.py +0 -686
- pymodaq/daq_scan.py +0 -2160
- pymodaq/daq_utils/array_manipulation.py +0 -386
- pymodaq/daq_utils/config.py +0 -273
- pymodaq/daq_utils/conftests.py +0 -7
- pymodaq/daq_utils/custom_parameter_tree.py +0 -9
- pymodaq/daq_utils/daq_enums.py +0 -133
- pymodaq/daq_utils/daq_utils.py +0 -1402
- pymodaq/daq_utils/exceptions.py +0 -71
- pymodaq/daq_utils/gui_utils/custom_app.py +0 -103
- pymodaq/daq_utils/gui_utils/file_io.py +0 -75
- pymodaq/daq_utils/gui_utils/widgets/spinbox.py +0 -9
- pymodaq/daq_utils/h5exporter_hyperspy.py +0 -115
- pymodaq/daq_utils/h5exporters.py +0 -242
- pymodaq/daq_utils/h5modules.py +0 -1559
- pymodaq/daq_utils/h5utils.py +0 -241
- pymodaq/daq_utils/managers/action_manager.py +0 -236
- pymodaq/daq_utils/managers/parameter_manager.py +0 -57
- pymodaq/daq_utils/math_utils.py +0 -705
- pymodaq/daq_utils/parameter/__init__.py +0 -1
- pymodaq/daq_utils/parameter/oldpymodaq_ptypes.py +0 -1626
- pymodaq/daq_utils/parameter/pymodaq_ptypes/pixmap.py +0 -85
- pymodaq/daq_utils/parameter/utils.py +0 -136
- pymodaq/daq_utils/plotting/data_viewers/__init__.py +0 -0
- pymodaq/daq_utils/plotting/data_viewers/process_from_QtDesigner_0DViewer_GUI.bat +0 -2
- pymodaq/daq_utils/plotting/data_viewers/viewer0D.py +0 -204
- pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.py +0 -89
- pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.ui +0 -131
- pymodaq/daq_utils/plotting/data_viewers/viewer1D.py +0 -781
- pymodaq/daq_utils/plotting/data_viewers/viewerND.py +0 -894
- pymodaq/daq_utils/plotting/data_viewers/viewerbase.py +0 -64
- pymodaq/daq_utils/plotting/items/__init__.py +0 -0
- pymodaq/daq_utils/plotting/navigator.py +0 -500
- pymodaq/daq_utils/plotting/scan_selector.py +0 -289
- pymodaq/daq_utils/plotting/utils/__init__.py +0 -0
- pymodaq/daq_utils/plotting/utils/filter.py +0 -236
- pymodaq/daq_utils/plotting/viewer0D/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewer0D/viewer0D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewer1D/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewer1D/viewer1D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewer1D/viewer1Dbasic.py +0 -4
- pymodaq/daq_utils/plotting/viewer2D/viewer_2D_basic.py +0 -4
- pymodaq/daq_utils/plotting/viewer2D/viewer_2D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewerND/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewerND/viewerND_main.py +0 -4
- pymodaq/daq_utils/scanner.py +0 -1289
- pymodaq/daq_utils/tree_layout/__init__.py +0 -0
- pymodaq/daq_viewer/__init__.py +0 -0
- pymodaq/daq_viewer/daq_gui_settings.py +0 -237
- pymodaq/daq_viewer/daq_gui_settings.ui +0 -441
- pymodaq/daq_viewer/daq_viewer_main.py +0 -2225
- pymodaq/daq_viewer/process_from_QtDesigner_DAQ_GUI_settings.bat +0 -2
- pymodaq/daq_viewer/utility_classes.py +0 -673
- pymodaq/examples/logger_image/__init__.py +0 -0
- pymodaq/examples/logger_image/logger_displayer.py +0 -121
- pymodaq/examples/logger_image/setup.svg +0 -3119
- pymodaq/examples/logger_image/setup_svg.py +0 -114
- pymodaq/h5browser.py +0 -39
- pymodaq/utils/scanner.py +0 -15
- pymodaq-3.6.13.dist-info/METADATA +0 -39
- pymodaq-3.6.13.dist-info/entry_points.txt +0 -8
- pymodaq-3.6.13.dist-info/top_level.txt +0 -1
- /pymodaq/{daq_analysis → post_treatment/daq_analysis}/__init__.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/__init__.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.ui +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -0
- /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.odt +0 -0
- /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.pdf +0 -0
- /pymodaq/{daq_move → utils/db}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils/db/db_logger}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/gui_utils/dock.py +0 -0
- /pymodaq/{daq_utils → utils}/gui_utils/list_picker.py +0 -0
- /pymodaq/{daq_utils/abstract → utils/managers}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/bool.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/date.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/list.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/numeric.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/tableview.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/text.py +0 -0
- /pymodaq/{daq_utils/db → utils/plotting}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/plotting/image_viewer.py +0 -0
- /pymodaq/{daq_utils/db/db_logger → utils/plotting/items}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/plotting/items/crosshair.py +0 -0
- /pymodaq/{daq_utils/managers → utils/plotting/utils}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/qvariant.py +0 -0
- /pymodaq/{daq_utils/plotting/viewer2D → utils/scanner/scanners}/__init__.py +0 -0
- /pymodaq/{daq_utils/plotting → utils/tree_layout}/__init__.py +0 -0
- {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created the 28/07/2022
|
|
4
|
+
|
|
5
|
+
@author: Sebastien Weber
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import List
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from qtpy import QtWidgets
|
|
12
|
+
from qtpy.QtCore import Signal
|
|
13
|
+
from qtpy.QtWidgets import QHBoxLayout, QVBoxLayout, QGridLayout, QWidget, QToolBar, QComboBox
|
|
14
|
+
|
|
15
|
+
from pymodaq.utils.daq_utils import ThreadCommand
|
|
16
|
+
from pymodaq.utils.gui_utils.custom_app import CustomApp
|
|
17
|
+
from pymodaq.utils.gui_utils.widgets import PushButtonIcon, LabelWithFont, SpinBox, QSpinBox_ro, QLED
|
|
18
|
+
from pymodaq.control_modules.utils import ControlModuleUI
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DAQ_Move_UI(ControlModuleUI):
|
|
22
|
+
"""DAQ_Move user interface.
|
|
23
|
+
|
|
24
|
+
This class manages the UI and emit dedicated signals depending on actions from the user
|
|
25
|
+
|
|
26
|
+
Attributes
|
|
27
|
+
----------
|
|
28
|
+
command_sig: Signal[Threadcommand]
|
|
29
|
+
This signal is emitted whenever some actions done by the user has to be
|
|
30
|
+
applied on the main module. Possible commands are:
|
|
31
|
+
* init
|
|
32
|
+
* quit
|
|
33
|
+
* get_value
|
|
34
|
+
* loop_get_value
|
|
35
|
+
* find_home
|
|
36
|
+
* stop
|
|
37
|
+
* move_abs
|
|
38
|
+
* move_rel
|
|
39
|
+
* show_log
|
|
40
|
+
* actuator_changed
|
|
41
|
+
* rel_value
|
|
42
|
+
|
|
43
|
+
Methods
|
|
44
|
+
-------
|
|
45
|
+
display_value(value: float)
|
|
46
|
+
Update the display of the actuator's value on the UI
|
|
47
|
+
do_init()
|
|
48
|
+
Programmatic init
|
|
49
|
+
|
|
50
|
+
See Also
|
|
51
|
+
--------
|
|
52
|
+
pymodaq.utils.daq_utils.ThreadCommand
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
def __init__(self, parent, title="DAQ_Move"):
|
|
56
|
+
|
|
57
|
+
super().__init__(parent)
|
|
58
|
+
self.title = title
|
|
59
|
+
self.setup_ui()
|
|
60
|
+
|
|
61
|
+
self.enable_move_buttons(False)
|
|
62
|
+
|
|
63
|
+
def display_value(self, value: float):
|
|
64
|
+
self.current_value_sb.setValue(value)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def actuator_init(self):
|
|
68
|
+
"""bool: the status of the init LED."""
|
|
69
|
+
return self.ini_state_led.get_state()
|
|
70
|
+
|
|
71
|
+
@actuator_init.setter
|
|
72
|
+
def actuator_init(self, status):
|
|
73
|
+
self.ini_state_led.set_as(status)
|
|
74
|
+
self.enable_move_buttons(status)
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def actuator(self):
|
|
78
|
+
return self.actuators_combo.currentText()
|
|
79
|
+
|
|
80
|
+
@actuator.setter
|
|
81
|
+
def actuator(self, act_name: str):
|
|
82
|
+
self.actuators_combo.setCurrentText(act_name)
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def actuators(self):
|
|
86
|
+
return [self.actuators_combo.itemText(ind) for ind in range(self.actuators_combo.count())]
|
|
87
|
+
|
|
88
|
+
@actuators.setter
|
|
89
|
+
def actuators(self, actuators: List[str]):
|
|
90
|
+
self.actuators_combo.clear()
|
|
91
|
+
self.actuators_combo.addItems(actuators)
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def move_done(self):
|
|
95
|
+
"""bool: the status of the move_done LED."""
|
|
96
|
+
return self.move_done_led.get_state()
|
|
97
|
+
|
|
98
|
+
@move_done.setter
|
|
99
|
+
def move_done(self, status):
|
|
100
|
+
self.move_done_led.set_as(status)
|
|
101
|
+
|
|
102
|
+
def set_settings_tree(self, tree):
|
|
103
|
+
self.settings_ui.layout().addWidget(tree)
|
|
104
|
+
|
|
105
|
+
def enable_move_buttons(self, status):
|
|
106
|
+
self.abs_value_sb.setEnabled(status)
|
|
107
|
+
self.abs_value_sb_2.setEnabled(status)
|
|
108
|
+
self.control_ui.setEnabled(status)
|
|
109
|
+
|
|
110
|
+
self.get_action('move_abs').setEnabled(status)
|
|
111
|
+
self.get_action('move_abs_2').setEnabled(status)
|
|
112
|
+
|
|
113
|
+
def set_spinbox_properties(self, **properties):
|
|
114
|
+
if 'decimals' in properties:
|
|
115
|
+
self.abs_value_sb.setDecimals(properties['decimals'])
|
|
116
|
+
self.abs_value_sb_2.setDecimals(properties['decimals'])
|
|
117
|
+
self.abs_value_sb_bis.setDecimals(properties['decimals'])
|
|
118
|
+
if 'minimum' in properties:
|
|
119
|
+
self.abs_value_sb.setMinimum()
|
|
120
|
+
self.abs_value_sb_2.setMinimum(properties['minimum'])
|
|
121
|
+
self.abs_value_sb_bis.setMinimum(properties['minimum'])
|
|
122
|
+
if 'maximum' in properties:
|
|
123
|
+
self.abs_value_sb.setMaximum()
|
|
124
|
+
self.abs_value_sb_2.setMaximum(properties['maximum'])
|
|
125
|
+
self.abs_value_sb_bis.setMaximum(properties['maximum'])
|
|
126
|
+
if 'step' in properties:
|
|
127
|
+
self.abs_value_sb.setSingleStep(properties['step'])
|
|
128
|
+
self.abs_value_sb_2.setSingleStep(properties['step'])
|
|
129
|
+
self.abs_value_sb_bis.setSingleStep(properties['step'])
|
|
130
|
+
|
|
131
|
+
def setup_docks(self):
|
|
132
|
+
self.parent.setLayout(QVBoxLayout())
|
|
133
|
+
self.parent.layout().setSizeConstraint(QHBoxLayout.SetFixedSize)
|
|
134
|
+
self.parent.layout().setContentsMargins(2, 2, 2, 2)
|
|
135
|
+
|
|
136
|
+
widget = QWidget()
|
|
137
|
+
widget.setLayout(QHBoxLayout())
|
|
138
|
+
self.parent.layout().addWidget(widget)
|
|
139
|
+
|
|
140
|
+
self.main_ui = QWidget()
|
|
141
|
+
self.control_ui = QWidget()
|
|
142
|
+
self.settings_ui = QWidget()
|
|
143
|
+
|
|
144
|
+
left_widget = QWidget()
|
|
145
|
+
left_widget.setLayout(QVBoxLayout())
|
|
146
|
+
left_widget.layout().addWidget(self.main_ui)
|
|
147
|
+
left_widget.layout().addWidget(self.control_ui)
|
|
148
|
+
left_widget.layout().setContentsMargins(0, 0, 0, 0)
|
|
149
|
+
left_widget.layout().addStretch()
|
|
150
|
+
widget.layout().addWidget(left_widget)
|
|
151
|
+
widget.layout().addWidget(self.settings_ui)
|
|
152
|
+
widget.layout().addStretch()
|
|
153
|
+
|
|
154
|
+
# populate the main ui
|
|
155
|
+
self.move_toolbar = QToolBar()
|
|
156
|
+
self.main_ui.setLayout(QGridLayout())
|
|
157
|
+
self.main_ui.layout().setSpacing(0)
|
|
158
|
+
self.main_ui.layout().setContentsMargins(0, 0, 0, 0)
|
|
159
|
+
|
|
160
|
+
self.main_ui.layout().addWidget(self.toolbar, 0, 0, 1, 2)
|
|
161
|
+
self.main_ui.layout().addWidget(self.move_toolbar, 1, 0, 1, 2)
|
|
162
|
+
|
|
163
|
+
self.abs_value_sb = SpinBox()
|
|
164
|
+
self.abs_value_sb.setStyleSheet("background-color : lightgreen; color: black")
|
|
165
|
+
self.abs_value_sb_2 = SpinBox()
|
|
166
|
+
self.abs_value_sb_2.setStyleSheet("background-color : lightcoral; color: black")
|
|
167
|
+
self.move_toolbar.addWidget(self.abs_value_sb)
|
|
168
|
+
self.move_toolbar.addWidget(self.abs_value_sb_2)
|
|
169
|
+
|
|
170
|
+
self.main_ui.layout().addWidget(LabelWithFont('Actuator:'), 2, 0)
|
|
171
|
+
self.actuators_combo = QComboBox()
|
|
172
|
+
self.main_ui.layout().addWidget(self.actuators_combo, 2, 1)
|
|
173
|
+
self.ini_actuator_pb = PushButtonIcon('ini', 'Initialization', checkable=True,
|
|
174
|
+
tip='Start This actuator initialization')
|
|
175
|
+
self.main_ui.layout().addWidget(self.ini_actuator_pb, 3, 0)
|
|
176
|
+
self.ini_state_led = QLED(readonly=True)
|
|
177
|
+
self.main_ui.layout().addWidget(self.ini_state_led, 3, 1)
|
|
178
|
+
self.main_ui.layout().addWidget(LabelWithFont('Current value:'), 4, 0)
|
|
179
|
+
self.move_done_led = QLED(readonly=True)
|
|
180
|
+
self.main_ui.layout().addWidget(self.move_done_led, 4, 1)
|
|
181
|
+
self.current_value_sb = QSpinBox_ro(font_size=30, min_height=35)
|
|
182
|
+
self.main_ui.layout().addWidget(self.current_value_sb, 5, 0, 1, 2)
|
|
183
|
+
|
|
184
|
+
# populate the control ui
|
|
185
|
+
self.control_ui.setLayout(QGridLayout())
|
|
186
|
+
self.control_ui.layout().addWidget(LabelWithFont('Abs. Value'), 0, 0)
|
|
187
|
+
self.find_home_pb = PushButtonIcon('home2', 'Find Home')
|
|
188
|
+
self.control_ui.layout().addWidget(self.find_home_pb, 0, 1)
|
|
189
|
+
self.abs_value_sb_bis = SpinBox()
|
|
190
|
+
self.control_ui.layout().addWidget(self.abs_value_sb_bis, 1, 0)
|
|
191
|
+
self.move_abs_pb = PushButtonIcon('Move', 'Set Abs.',
|
|
192
|
+
tip='Set the value of the actuator to the set absolute value')
|
|
193
|
+
self.control_ui.layout().addWidget(self.move_abs_pb, 1, 1)
|
|
194
|
+
self.control_ui.layout().addWidget(LabelWithFont('Rel. Increment'), 2, 0)
|
|
195
|
+
self.move_rel_plus_pb = PushButtonIcon('MoveUp', 'Set Rel. (+)')
|
|
196
|
+
self.control_ui.layout().addWidget(self.move_rel_plus_pb, 2, 1)
|
|
197
|
+
|
|
198
|
+
self.rel_value_sb = SpinBox()
|
|
199
|
+
self.control_ui.layout().addWidget(self.rel_value_sb, 3, 0)
|
|
200
|
+
self.move_rel_minus_pb = PushButtonIcon('MoveDown', 'Set Rel. (-)')
|
|
201
|
+
self.control_ui.layout().addWidget(self.move_rel_minus_pb, 3, 1)
|
|
202
|
+
self.stop_pb = PushButtonIcon('stop', 'Stop')
|
|
203
|
+
self.control_ui.layout().addWidget(self.stop_pb, 4, 0)
|
|
204
|
+
self.get_value_pb = PushButtonIcon('Help_32', 'Update Value')
|
|
205
|
+
self.control_ui.layout().addWidget(self.get_value_pb, 4, 1)
|
|
206
|
+
self.control_ui.layout().setContentsMargins(0, 0, 0, 0)
|
|
207
|
+
|
|
208
|
+
self.settings_ui.setLayout(QHBoxLayout())
|
|
209
|
+
self.settings_ui.layout().setContentsMargins(0, 0, 0, 0)
|
|
210
|
+
|
|
211
|
+
self.control_ui.setVisible(False)
|
|
212
|
+
self.settings_ui.setVisible(False)
|
|
213
|
+
|
|
214
|
+
self.statusbar = QtWidgets.QStatusBar()
|
|
215
|
+
self.statusbar.setMaximumHeight(30)
|
|
216
|
+
self.parent.layout().addWidget(self.statusbar)
|
|
217
|
+
|
|
218
|
+
def setup_actions(self):
|
|
219
|
+
self.add_action('move_abs', 'Move Abs', 'go_to_1', "Move to the set absolute value",
|
|
220
|
+
toolbar=self.move_toolbar)
|
|
221
|
+
self.add_action('move_abs_2', 'Move Abs', 'go_to_2', "Move to the other set absolute value",
|
|
222
|
+
toolbar=self.move_toolbar)
|
|
223
|
+
self.add_action('show_controls', 'Show Controls', 'Add_Step', "Show more controls", checkable=True,
|
|
224
|
+
toolbar=self.toolbar)
|
|
225
|
+
self.add_action('show_settings', 'Show Settings', 'Settings', "Show Settings", checkable=True,
|
|
226
|
+
toolbar=self.toolbar)
|
|
227
|
+
self.add_action('refresh_value', 'Refresh', 'Refresh2', "Refresh Value", checkable=True,
|
|
228
|
+
toolbar=self.toolbar)
|
|
229
|
+
self.add_action('stop', 'Stop', 'stop', "Stop Motion", checkable=False,
|
|
230
|
+
toolbar=self.toolbar)
|
|
231
|
+
self.add_action('quit', 'Quit the module', 'close2')
|
|
232
|
+
self.add_action('log', 'Show Log file', 'information2')
|
|
233
|
+
|
|
234
|
+
self.toolbar.addWidget(LabelWithFont(self.title, font_name="Tahoma", font_size=14, isbold=True, isitalic=True))
|
|
235
|
+
|
|
236
|
+
def connect_things(self):
|
|
237
|
+
self.connect_action('show_controls', lambda show: self.control_ui.setVisible(show))
|
|
238
|
+
self.connect_action('show_settings', lambda show: self.settings_ui.setVisible(show))
|
|
239
|
+
self.connect_action('quit', lambda: self.command_sig.emit(ThreadCommand('quit', )))
|
|
240
|
+
self.connect_action('refresh_value',
|
|
241
|
+
lambda do_refresh: self.command_sig.emit(ThreadCommand('loop_get_value', do_refresh)))
|
|
242
|
+
self.connect_action('move_abs', lambda: self.emit_move_abs(self.abs_value_sb))
|
|
243
|
+
self.connect_action('move_abs_2', lambda: self.emit_move_abs(self.abs_value_sb_2))
|
|
244
|
+
self.connect_action('log', lambda: self.command_sig.emit(ThreadCommand('show_log', )))
|
|
245
|
+
self.connect_action('stop', lambda: self.command_sig.emit(ThreadCommand('stop', )))
|
|
246
|
+
|
|
247
|
+
self.move_abs_pb.clicked.connect(lambda: self.emit_move_abs(self.abs_value_sb_bis))
|
|
248
|
+
|
|
249
|
+
self.rel_value_sb.valueChanged.connect(lambda: self.command_sig.emit(
|
|
250
|
+
ThreadCommand('rel_value', self.rel_value_sb.value())))
|
|
251
|
+
self.move_rel_plus_pb.clicked.connect(lambda: self.emit_move_rel('+'))
|
|
252
|
+
self.move_rel_minus_pb.clicked.connect(lambda: self.emit_move_rel('-'))
|
|
253
|
+
|
|
254
|
+
self.find_home_pb.clicked.connect(lambda: self.command_sig.emit(ThreadCommand('find_home', )))
|
|
255
|
+
self.stop_pb.clicked.connect(lambda: self.command_sig.emit(ThreadCommand('stop', )))
|
|
256
|
+
self.get_value_pb.clicked.connect(lambda: self.command_sig.emit(ThreadCommand('get_value', )))
|
|
257
|
+
|
|
258
|
+
self.ini_actuator_pb.clicked.connect(self.send_init)
|
|
259
|
+
|
|
260
|
+
self.actuators_combo.currentTextChanged.connect(
|
|
261
|
+
lambda act: self.command_sig.emit(ThreadCommand('actuator_changed', act)))
|
|
262
|
+
|
|
263
|
+
def do_init(self, do_init=True):
|
|
264
|
+
"""Programmatically press the Init button
|
|
265
|
+
API entry
|
|
266
|
+
Parameters
|
|
267
|
+
----------
|
|
268
|
+
do_init: bool
|
|
269
|
+
will fire the Init button depending on the argument value and the button check state
|
|
270
|
+
"""
|
|
271
|
+
if (do_init and not self.ini_actuator_pb.isChecked()) or ((not do_init) and self.ini_actuator_pb.isChecked()):
|
|
272
|
+
self.ini_actuator_pb.click()
|
|
273
|
+
|
|
274
|
+
def send_init(self):
|
|
275
|
+
self.actuators_combo.setEnabled(not self.ini_actuator_pb.isChecked())
|
|
276
|
+
self.command_sig.emit(ThreadCommand('init', [self.ini_actuator_pb.isChecked(),
|
|
277
|
+
self.actuators_combo.currentText()]))
|
|
278
|
+
|
|
279
|
+
def emit_move_abs(self, spinbox):
|
|
280
|
+
self.command_sig.emit(ThreadCommand('move_abs', spinbox.value()))
|
|
281
|
+
|
|
282
|
+
def emit_move_rel(self, sign):
|
|
283
|
+
self.command_sig.emit(ThreadCommand('move_rel', self.rel_value_sb.value() * (1 if sign == '+'
|
|
284
|
+
else -1)))
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def main(init_qt=True):
|
|
293
|
+
from pymodaq.utils.gui_utils.dock import DockArea
|
|
294
|
+
if init_qt: # used for the test suite
|
|
295
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
296
|
+
|
|
297
|
+
actuators = [f'act{ind}' for ind in range(5)]
|
|
298
|
+
|
|
299
|
+
widget = QtWidgets.QWidget()
|
|
300
|
+
prog = DAQ_Move_UI(widget, title="test")
|
|
301
|
+
widget.show()
|
|
302
|
+
|
|
303
|
+
def print_command_sig(cmd_sig):
|
|
304
|
+
print(cmd_sig)
|
|
305
|
+
if cmd_sig.command == 'init':
|
|
306
|
+
prog.enable_move_buttons(True)
|
|
307
|
+
|
|
308
|
+
prog.command_sig.connect(print_command_sig)
|
|
309
|
+
prog.actuators = actuators
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
if init_qt:
|
|
314
|
+
sys.exit(app.exec_())
|
|
315
|
+
return prog, widget
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
if __name__ == '__main__':
|
|
319
|
+
main()
|