pymodaq 5.0.17__py3-none-any.whl → 5.1.0__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 +23 -11
- pymodaq/control_modules/__init__.py +1 -0
- pymodaq/control_modules/daq_move.py +458 -246
- pymodaq/control_modules/daq_move_ui/__init__.py +0 -0
- pymodaq/control_modules/daq_move_ui/factory.py +48 -0
- pymodaq/control_modules/{daq_move_ui.py → daq_move_ui/ui_base.py} +168 -210
- pymodaq/control_modules/daq_move_ui/uis/__init__.py +0 -0
- pymodaq/control_modules/daq_move_ui/uis/binary.py +139 -0
- pymodaq/control_modules/daq_move_ui/uis/original.py +120 -0
- pymodaq/control_modules/daq_move_ui/uis/relative.py +124 -0
- pymodaq/control_modules/daq_move_ui/uis/simple.py +126 -0
- pymodaq/control_modules/daq_viewer.py +113 -101
- pymodaq/control_modules/daq_viewer_ui.py +41 -31
- pymodaq/control_modules/mocks.py +2 -2
- pymodaq/control_modules/move_utility_classes.py +113 -41
- pymodaq/control_modules/thread_commands.py +137 -0
- pymodaq/control_modules/ui_utils.py +72 -0
- pymodaq/control_modules/utils.py +107 -63
- pymodaq/control_modules/viewer_utility_classes.py +13 -17
- pymodaq/dashboard.py +1294 -625
- pymodaq/examples/qt_less_standalone_module.py +48 -11
- pymodaq/extensions/__init__.py +8 -3
- pymodaq/extensions/adaptive/__init__.py +2 -0
- pymodaq/extensions/adaptive/adaptive_optimization.py +179 -0
- pymodaq/extensions/adaptive/loss_function/_1d_loss_functions.py +73 -0
- pymodaq/extensions/adaptive/loss_function/_2d_loss_functions.py +73 -0
- pymodaq/extensions/adaptive/loss_function/__init__.py +3 -0
- pymodaq/extensions/adaptive/loss_function/loss_factory.py +110 -0
- pymodaq/extensions/adaptive/utils.py +123 -0
- pymodaq/extensions/bayesian/__init__.py +1 -1
- pymodaq/extensions/bayesian/acquisition/__init__.py +2 -0
- pymodaq/extensions/bayesian/acquisition/acquisition_function_factory.py +80 -0
- pymodaq/extensions/bayesian/acquisition/base_acquisition_function.py +105 -0
- pymodaq/extensions/bayesian/bayesian_optimization.py +143 -0
- pymodaq/extensions/bayesian/utils.py +71 -297
- pymodaq/extensions/daq_logger/daq_logger.py +7 -12
- pymodaq/extensions/daq_logger/h5logging.py +1 -1
- pymodaq/extensions/daq_scan.py +30 -55
- pymodaq/extensions/data_mixer/__init__.py +0 -0
- pymodaq/extensions/data_mixer/daq_0Dviewer_DataMixer.py +97 -0
- pymodaq/extensions/data_mixer/data_mixer.py +262 -0
- pymodaq/extensions/data_mixer/model.py +108 -0
- pymodaq/extensions/data_mixer/models/__init__.py +0 -0
- pymodaq/extensions/data_mixer/models/equation_model.py +91 -0
- pymodaq/extensions/data_mixer/models/gaussian_fit_model.py +65 -0
- pymodaq/extensions/data_mixer/parser.py +53 -0
- pymodaq/extensions/data_mixer/utils.py +23 -0
- pymodaq/extensions/h5browser.py +3 -34
- pymodaq/extensions/optimizers_base/__init__.py +0 -0
- pymodaq/extensions/optimizers_base/optimizer.py +1016 -0
- pymodaq/extensions/optimizers_base/thread_commands.py +22 -0
- pymodaq/extensions/optimizers_base/utils.py +427 -0
- pymodaq/extensions/pid/actuator_controller.py +3 -2
- pymodaq/extensions/pid/daq_move_PID.py +107 -30
- pymodaq/extensions/pid/pid_controller.py +613 -287
- pymodaq/extensions/pid/utils.py +8 -5
- pymodaq/extensions/utils.py +17 -2
- pymodaq/resources/config_template.toml +57 -0
- pymodaq/resources/preset_default.xml +1 -1
- pymodaq/utils/config.py +13 -4
- pymodaq/utils/daq_utils.py +14 -0
- pymodaq/utils/data.py +1 -0
- pymodaq/utils/gui_utils/loader_utils.py +25 -15
- pymodaq/utils/h5modules/module_saving.py +134 -22
- pymodaq/utils/leco/daq_move_LECODirector.py +123 -84
- pymodaq/utils/leco/daq_xDviewer_LECODirector.py +84 -97
- pymodaq/utils/leco/director_utils.py +32 -16
- pymodaq/utils/leco/leco_director.py +104 -27
- pymodaq/utils/leco/pymodaq_listener.py +186 -97
- pymodaq/utils/leco/rpc_method_definitions.py +43 -0
- pymodaq/utils/leco/utils.py +25 -25
- pymodaq/utils/managers/batchscan_manager.py +12 -11
- pymodaq/utils/managers/modules_manager.py +74 -33
- pymodaq/utils/managers/overshoot_manager.py +11 -10
- pymodaq/utils/managers/preset_manager.py +100 -64
- pymodaq/utils/managers/preset_manager_utils.py +163 -107
- pymodaq/utils/managers/remote_manager.py +21 -16
- pymodaq/utils/scanner/scan_factory.py +18 -4
- pymodaq/utils/scanner/scan_selector.py +1 -3
- pymodaq/utils/scanner/scanner.py +35 -6
- pymodaq/utils/scanner/scanners/_1d_scanners.py +15 -46
- pymodaq/utils/scanner/scanners/_2d_scanners.py +21 -68
- pymodaq/utils/scanner/scanners/sequential.py +50 -31
- pymodaq/utils/scanner/scanners/tabular.py +45 -28
- {pymodaq-5.0.17.dist-info → pymodaq-5.1.0.dist-info}/METADATA +7 -6
- pymodaq-5.1.0.dist-info/RECORD +154 -0
- {pymodaq-5.0.17.dist-info → pymodaq-5.1.0.dist-info}/entry_points.txt +0 -2
- pymodaq/extensions/bayesian/bayesian_optimisation.py +0 -685
- pymodaq/utils/leco/desktop.ini +0 -2
- pymodaq-5.0.17.dist-info/RECORD +0 -121
- {pymodaq-5.0.17.dist-info → pymodaq-5.1.0.dist-info}/WHEEL +0 -0
- {pymodaq-5.0.17.dist-info → pymodaq-5.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from qtpy.QtCore import Qt
|
|
2
|
+
from qtpy.QtWidgets import QVBoxLayout, QWidget, QHBoxLayout, QToolBar, QGridLayout
|
|
3
|
+
from qtpy import QtWidgets
|
|
4
|
+
|
|
5
|
+
from pymodaq.control_modules.daq_move_ui.ui_base import DAQ_Move_UI_Base
|
|
6
|
+
from pymodaq.control_modules.thread_commands import UiToMainMove
|
|
7
|
+
from pymodaq_data import DataToExport
|
|
8
|
+
from pymodaq_gui.plotting.data_viewers import ViewerDispatcher
|
|
9
|
+
from pymodaq_gui.utils import DockArea
|
|
10
|
+
from pymodaq_gui.utils.widgets import LabelWithFont
|
|
11
|
+
from pymodaq_utils.utils import ThreadCommand
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from ..factory import ActuatorUIFactory
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@ActuatorUIFactory.register('Original')
|
|
18
|
+
class DAQ_Move_UI(DAQ_Move_UI_Base):
|
|
19
|
+
is_compact = False
|
|
20
|
+
|
|
21
|
+
def __init__(self, parent, title="DAQ_Move"):
|
|
22
|
+
super().__init__(parent, title)
|
|
23
|
+
|
|
24
|
+
def setup_docks(self):
|
|
25
|
+
super().setup_docks()
|
|
26
|
+
|
|
27
|
+
self.parent.setLayout(QVBoxLayout())
|
|
28
|
+
#self.parent.layout().setSizeConstraint(QHBoxLayout.SetFixedSize)
|
|
29
|
+
self.parent.layout().setContentsMargins(2, 2, 2, 2)
|
|
30
|
+
|
|
31
|
+
widget = QWidget()
|
|
32
|
+
widget.setLayout(QHBoxLayout())
|
|
33
|
+
splitter_hor = QtWidgets.QSplitter(Qt.Orientation.Horizontal)
|
|
34
|
+
widget.layout().addWidget(splitter_hor)
|
|
35
|
+
self.parent.layout().addWidget(widget)
|
|
36
|
+
|
|
37
|
+
self.main_ui = QWidget()
|
|
38
|
+
|
|
39
|
+
self.control_widget = QWidget()
|
|
40
|
+
self.populate_control_ui(self.control_widget)
|
|
41
|
+
|
|
42
|
+
self.settings_ui = QWidget()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
left_widget = QWidget()
|
|
46
|
+
left_widget.setLayout(QVBoxLayout())
|
|
47
|
+
left_widget.layout().addWidget(self.main_ui)
|
|
48
|
+
left_widget.layout().addWidget(self.control_widget)
|
|
49
|
+
left_widget.layout().setContentsMargins(0, 0, 0, 0)
|
|
50
|
+
left_widget.layout().addStretch()
|
|
51
|
+
splitter_hor.addWidget(left_widget)
|
|
52
|
+
splitter_hor.addWidget(self.settings_ui)
|
|
53
|
+
#widget.layout().addStretch()
|
|
54
|
+
|
|
55
|
+
# populate the main ui
|
|
56
|
+
self.move_toolbar = QToolBar()
|
|
57
|
+
self.main_ui.setLayout(QGridLayout())
|
|
58
|
+
self.main_ui.layout().setSpacing(0)
|
|
59
|
+
self.main_ui.layout().setContentsMargins(0, 0, 0, 0)
|
|
60
|
+
|
|
61
|
+
self.main_ui.layout().addWidget(self.toolbar, 0, 0, 1, 2)
|
|
62
|
+
self.main_ui.layout().addWidget(self.move_toolbar, 1, 0, 1, 2)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
self.move_toolbar.addWidget(self.abs_value_sb)
|
|
66
|
+
self.move_toolbar.addWidget(self.abs_value_sb_2)
|
|
67
|
+
|
|
68
|
+
self.main_ui.layout().addWidget(LabelWithFont('Actuator:'), 2, 0)
|
|
69
|
+
|
|
70
|
+
self.main_ui.layout().addWidget(self.actuators_combo, 2, 1)
|
|
71
|
+
|
|
72
|
+
self.main_ui.layout().addWidget(self.ini_actuator_pb, 3, 0)
|
|
73
|
+
self.main_ui.layout().addWidget(self.ini_state_led, 3, 1)
|
|
74
|
+
self.main_ui.layout().addWidget(LabelWithFont('Current value:'), 4, 0)
|
|
75
|
+
self.main_ui.layout().addWidget(self.move_done_led, 4, 1)
|
|
76
|
+
|
|
77
|
+
self.main_ui.layout().addWidget(self.current_value_sb, 5, 0, 1, 2)
|
|
78
|
+
|
|
79
|
+
self.settings_ui.setLayout(QHBoxLayout())
|
|
80
|
+
self.settings_ui.layout().setContentsMargins(0, 0, 0, 0)
|
|
81
|
+
self.settings_ui.setVisible(False)
|
|
82
|
+
|
|
83
|
+
self.statusbar = QtWidgets.QStatusBar()
|
|
84
|
+
self.statusbar.setMaximumHeight(30)
|
|
85
|
+
self.parent.layout().addWidget(self.statusbar)
|
|
86
|
+
|
|
87
|
+
def setup_actions(self):
|
|
88
|
+
self.add_widget('name', LabelWithFont(f'{self.title}', font_name="Tahoma",
|
|
89
|
+
font_size=14, isbold=True, isitalic=True),
|
|
90
|
+
toolbar=self.toolbar)
|
|
91
|
+
self.add_action('move_abs', 'Move Abs', 'go_to_1', "Move to the set absolute value",
|
|
92
|
+
toolbar=self.move_toolbar)
|
|
93
|
+
self.add_action('move_abs_2', 'Move Abs', 'go_to_2', "Move to the other set absolute value",
|
|
94
|
+
toolbar=self.move_toolbar)
|
|
95
|
+
|
|
96
|
+
self.add_action('show_controls', 'Show Controls', 'Add_Step', "Show more controls", checkable=True,
|
|
97
|
+
toolbar=self.toolbar)
|
|
98
|
+
self.add_action('show_settings', 'Show Settings', 'tree', "Show Settings", checkable=True,
|
|
99
|
+
toolbar=self.toolbar)
|
|
100
|
+
self.add_action('show_config', 'Show Config', 'Settings', "Show PyMoDAQ Config", checkable=False,
|
|
101
|
+
toolbar=self.toolbar)
|
|
102
|
+
self.add_action('show_graph', 'Show Graph', 'graph', "Show Graph", checkable=True,
|
|
103
|
+
toolbar=self.toolbar)
|
|
104
|
+
self.add_action('refresh_value', 'Refresh', 'Refresh2', "Refresh Value", checkable=True,
|
|
105
|
+
toolbar=self.toolbar)
|
|
106
|
+
self.add_action('stop', 'Stop', 'stop', "Stop Motion", checkable=False,
|
|
107
|
+
toolbar=self.toolbar)
|
|
108
|
+
self.add_action('quit', 'Quit the module', 'close2')
|
|
109
|
+
self.add_action('log', 'Show Log file', 'information2')
|
|
110
|
+
|
|
111
|
+
def connect_things(self):
|
|
112
|
+
super().connect_things()
|
|
113
|
+
|
|
114
|
+
def set_settings_tree(self, tree):
|
|
115
|
+
super().set_settings_tree(tree)
|
|
116
|
+
self.settings_ui.layout().addWidget(tree)
|
|
117
|
+
|
|
118
|
+
def show_tree(self, show: bool = True):
|
|
119
|
+
super().show_tree(show)
|
|
120
|
+
self.settings_ui.setVisible(show)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from qtpy.QtWidgets import QVBoxLayout, QToolBar
|
|
4
|
+
from qtpy import QtWidgets
|
|
5
|
+
|
|
6
|
+
from pymodaq.control_modules.daq_move_ui.ui_base import DAQ_Move_UI_Base
|
|
7
|
+
from pymodaq.control_modules.thread_commands import UiToMainMove
|
|
8
|
+
from pymodaq_gui.utils.widgets import LabelWithFont
|
|
9
|
+
from pymodaq_utils.utils import ThreadCommand
|
|
10
|
+
|
|
11
|
+
from pymodaq.control_modules.daq_move_ui.factory import ActuatorUIFactory
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@ActuatorUIFactory.register('Relative')
|
|
15
|
+
class DAQ_Move_UI_Relative(DAQ_Move_UI_Base):
|
|
16
|
+
is_compact = True
|
|
17
|
+
def __init__(self, parent, title="DAQ_Move"):
|
|
18
|
+
|
|
19
|
+
super().__init__(parent, title)
|
|
20
|
+
|
|
21
|
+
def setup_docks(self):
|
|
22
|
+
super().setup_docks()
|
|
23
|
+
|
|
24
|
+
self.parent.setLayout(QVBoxLayout())
|
|
25
|
+
self.parent.layout().setContentsMargins(0, 0, 0, 0)
|
|
26
|
+
|
|
27
|
+
self.move_toolbar = QToolBar()
|
|
28
|
+
self.parent.layout().addWidget(self.move_toolbar)
|
|
29
|
+
|
|
30
|
+
self.current_value_sb.set_font_size(10)
|
|
31
|
+
self.current_value_sb.setMinimumHeight(20)
|
|
32
|
+
self.current_value_sb.setMinimumWidth(80)
|
|
33
|
+
|
|
34
|
+
self.control_widget = QtWidgets.QWidget()
|
|
35
|
+
self.populate_control_ui(self.control_widget)
|
|
36
|
+
|
|
37
|
+
def setup_actions(self):
|
|
38
|
+
self.add_widget('name', LabelWithFont(f'{self.title}', font_name="Tahoma",
|
|
39
|
+
font_size=14, isbold=True, isitalic=True),
|
|
40
|
+
toolbar=self.move_toolbar)
|
|
41
|
+
|
|
42
|
+
self.add_widget('actuators_combo', self.actuators_combo, toolbar=self.move_toolbar)
|
|
43
|
+
self.add_action('ini_actuator', 'Ini. Actuator', 'ini', toolbar=self.move_toolbar)
|
|
44
|
+
self.add_widget('ini_led', self.ini_state_led, toolbar=self.move_toolbar)
|
|
45
|
+
self.move_toolbar.addSeparator()
|
|
46
|
+
self.add_widget('current', self.current_value_sb, toolbar=self.move_toolbar)
|
|
47
|
+
self.add_widget('move_done', self.move_done_led, toolbar=self.move_toolbar)
|
|
48
|
+
self.move_toolbar.addSeparator()
|
|
49
|
+
self.add_widget('rel_move', self.rel_value_sb, toolbar=self.move_toolbar)
|
|
50
|
+
self.add_action('move_rel_plus', 'Set Rel. (+)', 'MoveUp', toolbar=self.move_toolbar)
|
|
51
|
+
self.add_action('move_rel_minus', 'Set Rel. (-)', 'MoveDown', toolbar=self.move_toolbar)
|
|
52
|
+
|
|
53
|
+
self.add_action('stop', 'Stop', 'stop', "Stop Motion", toolbar=self.move_toolbar)
|
|
54
|
+
self.move_toolbar.addSeparator()
|
|
55
|
+
self.add_action('show_settings', 'Show Settings', 'tree', "Show Settings", checkable=True,
|
|
56
|
+
toolbar=self.move_toolbar)
|
|
57
|
+
self.add_action('show_controls', 'Show Controls', 'Add_Step', "Show more controls", checkable=True,
|
|
58
|
+
toolbar=self.move_toolbar)
|
|
59
|
+
self.add_action('show_graph', 'Show Graph', 'graph', "Show Graph", checkable=True,
|
|
60
|
+
toolbar=self.move_toolbar)
|
|
61
|
+
self.add_action('refresh_value', 'Refresh', 'Refresh2', "Refresh Value", checkable=True,
|
|
62
|
+
toolbar=self.move_toolbar)
|
|
63
|
+
self.move_toolbar.addSeparator()
|
|
64
|
+
self.add_action('show_config', 'Show Config', 'Settings', "Show PyMoDAQ Config", checkable=False,
|
|
65
|
+
toolbar=self.move_toolbar)
|
|
66
|
+
self.add_action('quit', 'Quit the module', 'close2', toolbar=self.move_toolbar)
|
|
67
|
+
self.add_action('log', 'Show Log file', 'information2', toolbar=self.move_toolbar)
|
|
68
|
+
self.add_widget('status', self.statusbar, toolbar=self.move_toolbar)
|
|
69
|
+
|
|
70
|
+
def connect_things(self):
|
|
71
|
+
super().connect_things()
|
|
72
|
+
|
|
73
|
+
self.connect_action('move_rel_plus', lambda: self.emit_move_rel('+'))
|
|
74
|
+
self.connect_action('move_rel_minus', lambda: self.emit_move_rel('-'))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main(init_qt=True):
|
|
78
|
+
from pymodaq_gui.utils.dock import DockArea, Dock
|
|
79
|
+
if init_qt: # used for the test suite
|
|
80
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
81
|
+
|
|
82
|
+
actuators = [f'act{ind}' for ind in range(5)]
|
|
83
|
+
|
|
84
|
+
win = QtWidgets.QMainWindow()
|
|
85
|
+
area = DockArea()
|
|
86
|
+
win.setCentralWidget(area)
|
|
87
|
+
win.resize(1000, 500)
|
|
88
|
+
win.setWindowTitle('extension_name')
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
dock = Dock('Test')
|
|
92
|
+
dock.layout.setSpacing(0)
|
|
93
|
+
dock.layout.setContentsMargins(0,0,0,0)
|
|
94
|
+
area.addDock(dock)
|
|
95
|
+
widget = QtWidgets.QWidget()
|
|
96
|
+
widget.setMaximumHeight(60)
|
|
97
|
+
prog = DAQ_Move_UI_Relative(widget, title="test")
|
|
98
|
+
widget.show()
|
|
99
|
+
|
|
100
|
+
for ind in range(10):
|
|
101
|
+
widget = QtWidgets.QWidget()
|
|
102
|
+
widget.setMaximumHeight(60)
|
|
103
|
+
dock.addWidget(widget)
|
|
104
|
+
prog = DAQ_Move_UI_Relative(widget, title="test")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def print_command_sig(cmd_sig):
|
|
108
|
+
print(cmd_sig)
|
|
109
|
+
if cmd_sig.command == UiToMainMove.INIT:
|
|
110
|
+
prog.enable_move_buttons(True)
|
|
111
|
+
elif cmd_sig.command == UiToMainMove.MOVE_ABS:
|
|
112
|
+
prog.display_value(cmd_sig.attribute)
|
|
113
|
+
|
|
114
|
+
prog.command_sig.connect(print_command_sig)
|
|
115
|
+
prog.actuators = actuators
|
|
116
|
+
|
|
117
|
+
win.show()
|
|
118
|
+
if init_qt:
|
|
119
|
+
sys.exit(app.exec_())
|
|
120
|
+
return prog, widget
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
if __name__ == '__main__':
|
|
124
|
+
main()
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from qtpy.QtWidgets import QVBoxLayout, QToolBar
|
|
4
|
+
from qtpy import QtWidgets
|
|
5
|
+
|
|
6
|
+
from pymodaq.control_modules.daq_move_ui.ui_base import DAQ_Move_UI_Base
|
|
7
|
+
from pymodaq.control_modules.thread_commands import UiToMainMove
|
|
8
|
+
from pymodaq_gui.utils.widgets import LabelWithFont
|
|
9
|
+
from pymodaq_utils.utils import ThreadCommand
|
|
10
|
+
|
|
11
|
+
from pymodaq.control_modules.daq_move_ui.factory import ActuatorUIFactory
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@ActuatorUIFactory.register('Simple')
|
|
15
|
+
class DAQ_Move_UI_Simple(DAQ_Move_UI_Base):
|
|
16
|
+
is_compact = True
|
|
17
|
+
def __init__(self, parent, title="DAQ_Move"):
|
|
18
|
+
|
|
19
|
+
super().__init__(parent, title)
|
|
20
|
+
|
|
21
|
+
def setup_docks(self):
|
|
22
|
+
super().setup_docks()
|
|
23
|
+
|
|
24
|
+
self.parent.setLayout(QVBoxLayout())
|
|
25
|
+
self.parent.layout().setContentsMargins(0, 0, 0, 0)
|
|
26
|
+
|
|
27
|
+
self.move_toolbar = QToolBar()
|
|
28
|
+
self.parent.layout().addWidget(self.move_toolbar)
|
|
29
|
+
|
|
30
|
+
self.abs_value_sb_2.setMinimumWidth(80)
|
|
31
|
+
self.abs_value_sb.setMinimumWidth(80)
|
|
32
|
+
self.current_value_sb.set_font_size(10)
|
|
33
|
+
self.current_value_sb.setMinimumHeight(20)
|
|
34
|
+
self.current_value_sb.setMinimumWidth(80)
|
|
35
|
+
|
|
36
|
+
self.control_widget = QtWidgets.QWidget()
|
|
37
|
+
self.populate_control_ui(self.control_widget)
|
|
38
|
+
|
|
39
|
+
def setup_actions(self):
|
|
40
|
+
self.add_widget('name', LabelWithFont(f'{self.title}', font_name="Tahoma",
|
|
41
|
+
font_size=14, isbold=True, isitalic=True),
|
|
42
|
+
toolbar=self.move_toolbar)
|
|
43
|
+
|
|
44
|
+
self.add_widget('actuators_combo', self.actuators_combo, toolbar=self.move_toolbar)
|
|
45
|
+
self.add_action('ini_actuator', 'Ini. Actuator', 'ini', toolbar=self.move_toolbar)
|
|
46
|
+
self.add_widget('ini_led', self.ini_state_led, toolbar=self.move_toolbar)
|
|
47
|
+
self.add_widget('current', self.current_value_sb, toolbar=self.move_toolbar)
|
|
48
|
+
self.add_widget('move_done', self.move_done_led, toolbar=self.move_toolbar)
|
|
49
|
+
self.add_widget('abs_green', self.abs_value_sb, toolbar=self.move_toolbar)
|
|
50
|
+
self.add_widget('abs_red', self.abs_value_sb_2, toolbar=self.move_toolbar)
|
|
51
|
+
self.add_action('move_abs', 'Move Abs', 'go_to_1', "Move to the set absolute value",
|
|
52
|
+
toolbar=self.move_toolbar)
|
|
53
|
+
self.add_action('move_abs_2', 'Move Abs', 'go_to_2', "Move to the other set absolute"
|
|
54
|
+
" value",
|
|
55
|
+
toolbar=self.move_toolbar)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
self.add_action('stop', 'Stop', 'stop', "Stop Motion", toolbar=self.move_toolbar)
|
|
59
|
+
|
|
60
|
+
self.add_action('show_settings', 'Show Settings', 'tree', "Show Settings", checkable=True,
|
|
61
|
+
toolbar=self.move_toolbar)
|
|
62
|
+
self.add_action('show_controls', 'Show Controls', 'Add_Step', "Show more controls", checkable=True,
|
|
63
|
+
toolbar=self.move_toolbar)
|
|
64
|
+
self.add_action('show_graph', 'Show Graph', 'graph', "Show Graph", checkable=True,
|
|
65
|
+
toolbar=self.move_toolbar)
|
|
66
|
+
self.add_action('refresh_value', 'Refresh', 'Refresh2', "Refresh Value", checkable=True,
|
|
67
|
+
toolbar=self.move_toolbar)
|
|
68
|
+
self.move_toolbar.addSeparator()
|
|
69
|
+
self.add_action('show_config', 'Show Config', 'Settings', "Show PyMoDAQ Config", checkable=False,
|
|
70
|
+
toolbar=self.move_toolbar)
|
|
71
|
+
self.add_action('quit', 'Quit the module', 'close2', toolbar=self.move_toolbar)
|
|
72
|
+
self.add_action('log', 'Show Log file', 'information2', toolbar=self.move_toolbar)
|
|
73
|
+
self.add_widget('status', self.statusbar, toolbar=self.move_toolbar)
|
|
74
|
+
|
|
75
|
+
def connect_things(self):
|
|
76
|
+
super().connect_things()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def main(init_qt=True):
|
|
80
|
+
from pymodaq_gui.utils.dock import DockArea, Dock
|
|
81
|
+
if init_qt: # used for the test suite
|
|
82
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
83
|
+
|
|
84
|
+
actuators = [f'act{ind}' for ind in range(5)]
|
|
85
|
+
|
|
86
|
+
win = QtWidgets.QMainWindow()
|
|
87
|
+
area = DockArea()
|
|
88
|
+
win.setCentralWidget(area)
|
|
89
|
+
win.resize(1000, 500)
|
|
90
|
+
win.setWindowTitle('extension_name')
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
dock = Dock('Test')
|
|
94
|
+
dock.layout.setSpacing(0)
|
|
95
|
+
dock.layout.setContentsMargins(0,0,0,0)
|
|
96
|
+
area.addDock(dock)
|
|
97
|
+
widget = QtWidgets.QWidget()
|
|
98
|
+
widget.setMaximumHeight(60)
|
|
99
|
+
prog = DAQ_Move_UI_Simple(widget, title="test")
|
|
100
|
+
widget.show()
|
|
101
|
+
|
|
102
|
+
for ind in range(10):
|
|
103
|
+
widget = QtWidgets.QWidget()
|
|
104
|
+
widget.setMaximumHeight(60)
|
|
105
|
+
dock.addWidget(widget)
|
|
106
|
+
prog = DAQ_Move_UI_Simple(widget, title="test")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def print_command_sig(cmd_sig):
|
|
110
|
+
print(cmd_sig)
|
|
111
|
+
if cmd_sig.command == UiToMainMove.INIT:
|
|
112
|
+
prog.enable_move_buttons(True)
|
|
113
|
+
elif cmd_sig.command == UiToMainMove.MOVE_ABS:
|
|
114
|
+
prog.display_value(cmd_sig.attribute)
|
|
115
|
+
|
|
116
|
+
prog.command_sig.connect(print_command_sig)
|
|
117
|
+
prog.actuators = actuators
|
|
118
|
+
|
|
119
|
+
win.show()
|
|
120
|
+
if init_qt:
|
|
121
|
+
sys.exit(app.exec_())
|
|
122
|
+
return prog, widget
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == '__main__':
|
|
126
|
+
main()
|