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,256 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created the 03/10/2022
|
|
4
|
+
|
|
5
|
+
@author: Sebastien Weber
|
|
6
|
+
"""
|
|
7
|
+
from easydict import EasyDict as edict
|
|
8
|
+
|
|
9
|
+
from qtpy import QtCore
|
|
10
|
+
from qtpy.QtCore import Signal, QObject
|
|
11
|
+
from pymodaq.utils.gui_utils import CustomApp
|
|
12
|
+
from pymodaq.utils.daq_utils import ThreadCommand, get_plugins, find_dict_in_list_from_key_val
|
|
13
|
+
from pymodaq.utils.config import Config
|
|
14
|
+
from pymodaq.utils.parameter import Parameter
|
|
15
|
+
from pymodaq.utils.enums import BaseEnum, enum_checker
|
|
16
|
+
from pymodaq.utils.plotting.data_viewers.viewer import ViewersEnum
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DAQTypesEnum(BaseEnum):
|
|
20
|
+
"""enum relating a given DAQType and a viewer type
|
|
21
|
+
See Also
|
|
22
|
+
--------
|
|
23
|
+
pymodaq.utils.plotting.data_viewers.viewer.ViewersEnum
|
|
24
|
+
"""
|
|
25
|
+
DAQ0D = 'Viewer0D'
|
|
26
|
+
DAQ1D = 'Viewer1D'
|
|
27
|
+
DAQ2D = 'Viewer2D'
|
|
28
|
+
DAQND = 'ViewerND'
|
|
29
|
+
|
|
30
|
+
def to_data_type(self):
|
|
31
|
+
return ViewersEnum[self.value].value
|
|
32
|
+
|
|
33
|
+
def to_viewer_type(self):
|
|
34
|
+
return self.value
|
|
35
|
+
|
|
36
|
+
def to_daq_type(self):
|
|
37
|
+
return self.name
|
|
38
|
+
|
|
39
|
+
def increase_dim(self, ndim: int):
|
|
40
|
+
dim = self.get_dim()
|
|
41
|
+
if dim != 'N':
|
|
42
|
+
dim_as_int = int(dim) + ndim
|
|
43
|
+
if dim_as_int > 2:
|
|
44
|
+
dim = 'N'
|
|
45
|
+
else:
|
|
46
|
+
dim = str(dim_as_int)
|
|
47
|
+
else:
|
|
48
|
+
dim = 'N'
|
|
49
|
+
return DAQTypesEnum(f'Viewer{dim}D')
|
|
50
|
+
|
|
51
|
+
def get_dim(self):
|
|
52
|
+
return self.value.split('Viewer')[1].split('D')[0]
|
|
53
|
+
|
|
54
|
+
DAQ_TYPES = DAQTypesEnum
|
|
55
|
+
|
|
56
|
+
DET_TYPES = {'DAQ0D': get_plugins('daq_0Dviewer'),
|
|
57
|
+
'DAQ1D': get_plugins('daq_1Dviewer'),
|
|
58
|
+
'DAQ2D': get_plugins('daq_2Dviewer'),
|
|
59
|
+
'DAQND': get_plugins('daq_NDviewer'),}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
config = Config()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ViewerError(Exception):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_viewer_plugins(daq_type, det_name):
|
|
70
|
+
parent_module = find_dict_in_list_from_key_val(DET_TYPES[daq_type], 'name', det_name)
|
|
71
|
+
match_name = daq_type.lower()
|
|
72
|
+
match_name = f'{match_name[0:3]}_{match_name[3:].upper()}viewer_'
|
|
73
|
+
obj = getattr(getattr(parent_module['module'], match_name + det_name),
|
|
74
|
+
f'{match_name[0:7].upper()}{match_name[7:]}{det_name}')
|
|
75
|
+
params = getattr(obj, 'params')
|
|
76
|
+
det_params = Parameter.create(name='Det Settings', type='group', children=params)
|
|
77
|
+
return det_params, obj
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ControlModule(QObject):
|
|
81
|
+
"""Abstract Base class common to both DAQ_Move and DAQ_Viewer control modules
|
|
82
|
+
|
|
83
|
+
Attributes
|
|
84
|
+
----------
|
|
85
|
+
init_signal : Signal[bool]
|
|
86
|
+
This signal is emitted when the chosen hardware is correctly initialized
|
|
87
|
+
command_hardware : Signal[ThreadCommand]
|
|
88
|
+
This signal is used to communicate with the instrument plugin within a separate thread
|
|
89
|
+
command_tcpip : Signal[ThreadCommand]
|
|
90
|
+
This signal is used to communicate through the TCP/IP Network
|
|
91
|
+
quit_signal : Signal[]
|
|
92
|
+
This signal is emitted when the user requested to stop the module
|
|
93
|
+
"""
|
|
94
|
+
init_signal = Signal(bool)
|
|
95
|
+
command_hardware = Signal(ThreadCommand)
|
|
96
|
+
_command_tcpip = Signal(ThreadCommand)
|
|
97
|
+
quit_signal = Signal()
|
|
98
|
+
_update_settings_signal = Signal(edict)
|
|
99
|
+
status_sig = Signal(str)
|
|
100
|
+
|
|
101
|
+
def __init__(self):
|
|
102
|
+
super().__init__()
|
|
103
|
+
self._title = ""
|
|
104
|
+
|
|
105
|
+
# the hardware controller instance set after initialization and to be used by other modules if they share the
|
|
106
|
+
# same controller
|
|
107
|
+
self.controller = None
|
|
108
|
+
self._initialized_state = False
|
|
109
|
+
self._send_to_tcpip = False
|
|
110
|
+
self._tcpclient_thread = None
|
|
111
|
+
self._hardware_thread = None
|
|
112
|
+
self.module_and_data_saver = None
|
|
113
|
+
|
|
114
|
+
def __repr__(self):
|
|
115
|
+
return f'{self.__class__.__name__}: {self.title}'
|
|
116
|
+
|
|
117
|
+
@property
|
|
118
|
+
def module_type(self):
|
|
119
|
+
"""str: Get the module type, either DAQ_Move or DAQ_viewer"""
|
|
120
|
+
return type(self).__name__
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def initialized_state(self):
|
|
124
|
+
"""bool: Check if the module is initialized"""
|
|
125
|
+
return self._initialized_state
|
|
126
|
+
|
|
127
|
+
@property
|
|
128
|
+
def title(self):
|
|
129
|
+
"""str: get the title of the module"""
|
|
130
|
+
return self._title
|
|
131
|
+
|
|
132
|
+
def grab(self):
|
|
133
|
+
"""Programmatic entry to grab data from detectors or current value from actuator"""
|
|
134
|
+
raise NotImplementedError
|
|
135
|
+
|
|
136
|
+
def stop_grab(self):
|
|
137
|
+
"""Programmatic entry to stop data grabbing from detectors or current value polling from actuator"""
|
|
138
|
+
raise NotImplementedError
|
|
139
|
+
|
|
140
|
+
def quit_fun(self):
|
|
141
|
+
"""Programmatic entry to quit the controle module"""
|
|
142
|
+
raise NotImplementedError
|
|
143
|
+
|
|
144
|
+
def init_hardware(self, do_init=True):
|
|
145
|
+
"""Programmatic entry to initialize/deinitialize the control module
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
do_init : bool
|
|
150
|
+
if True initialize the selected hardware else deinitialize it
|
|
151
|
+
|
|
152
|
+
See Also
|
|
153
|
+
--------
|
|
154
|
+
:meth:`init_hardware_ui`
|
|
155
|
+
"""
|
|
156
|
+
raise NotImplementedError
|
|
157
|
+
|
|
158
|
+
def init_hardware_ui(self, do_init=True):
|
|
159
|
+
"""Programmatic entry to simulate a click on the user interface init button
|
|
160
|
+
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
do_init : bool
|
|
164
|
+
if True initialize the selected hardware else deinitialize it
|
|
165
|
+
|
|
166
|
+
Notes
|
|
167
|
+
-----
|
|
168
|
+
This method should be preferred to :meth:`init_hardware`
|
|
169
|
+
"""
|
|
170
|
+
raise NotImplementedError
|
|
171
|
+
|
|
172
|
+
def show_log(self):
|
|
173
|
+
"""Open the log file in the default text editor"""
|
|
174
|
+
import webbrowser
|
|
175
|
+
webbrowser.open(self.logger.parent.handlers[0].baseFilename)
|
|
176
|
+
|
|
177
|
+
def update_status(self, txt, log=True):
|
|
178
|
+
"""Display a message in the ui status bar and eventually log the message
|
|
179
|
+
|
|
180
|
+
Parameters
|
|
181
|
+
----------
|
|
182
|
+
txt : str
|
|
183
|
+
message to display
|
|
184
|
+
log : bool
|
|
185
|
+
if True, log the message in the logger
|
|
186
|
+
"""
|
|
187
|
+
if self.ui is not None:
|
|
188
|
+
self.ui.display_status(txt)
|
|
189
|
+
self.status_sig.emit(txt)
|
|
190
|
+
if log:
|
|
191
|
+
self.logger.info(txt)
|
|
192
|
+
|
|
193
|
+
def manage_ui_actions(self, action_name: str, attribute: str, value):
|
|
194
|
+
"""Method to manage actions for the UI (if any).
|
|
195
|
+
|
|
196
|
+
Will try to apply the given value to the given attribute of the corresponding action
|
|
197
|
+
|
|
198
|
+
Parameters
|
|
199
|
+
----------
|
|
200
|
+
action_name: str
|
|
201
|
+
attribute: method signature or attribute
|
|
202
|
+
value: object
|
|
203
|
+
actual type and value depend on the triggered attribute
|
|
204
|
+
|
|
205
|
+
Examples
|
|
206
|
+
--------
|
|
207
|
+
>>>manage_ui_actions('quit', 'setEnabled', False)
|
|
208
|
+
# will disable the quit action (button) on the UI
|
|
209
|
+
"""
|
|
210
|
+
if self.ui is not None:
|
|
211
|
+
if self.ui.has_action(action_name):
|
|
212
|
+
action = self.ui.get_action(action_name)
|
|
213
|
+
if hasattr(action, attribute):
|
|
214
|
+
attr = getattr(action, attribute)
|
|
215
|
+
if callable(attr):
|
|
216
|
+
attr(value)
|
|
217
|
+
else:
|
|
218
|
+
attr = value
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class ControlModuleUI(CustomApp):
|
|
222
|
+
""" Base Class for ControlModules UIs
|
|
223
|
+
|
|
224
|
+
Attributes
|
|
225
|
+
----------
|
|
226
|
+
command_sig: Signal[Threadcommand]
|
|
227
|
+
This signal is emitted whenever some actions done by the user has to be
|
|
228
|
+
applied on the main module. Possible commands are:
|
|
229
|
+
See specific implementation
|
|
230
|
+
|
|
231
|
+
See Also
|
|
232
|
+
--------
|
|
233
|
+
:class:`daq_move_ui.DAQ_Move_UI`, :class:`daq_viewer_ui.DAQ_Viewer_UI`
|
|
234
|
+
"""
|
|
235
|
+
command_sig = QtCore.Signal(ThreadCommand)
|
|
236
|
+
|
|
237
|
+
def __init__(self, parent):
|
|
238
|
+
super().__init__(parent)
|
|
239
|
+
|
|
240
|
+
def display_status(self, txt, wait_time=config('general', 'message_status_persistence')):
|
|
241
|
+
if self.statusbar is not None:
|
|
242
|
+
self.statusbar.showMessage(txt, wait_time)
|
|
243
|
+
|
|
244
|
+
def do_init(self, do_init=True):
|
|
245
|
+
"""Programmatically press the Init button
|
|
246
|
+
API entry
|
|
247
|
+
Parameters
|
|
248
|
+
----------
|
|
249
|
+
do_init: bool
|
|
250
|
+
will fire the Init button depending on the argument value and the button check state
|
|
251
|
+
"""
|
|
252
|
+
raise NotImplementedError
|
|
253
|
+
|
|
254
|
+
def send_init(self):
|
|
255
|
+
"""Shoudl be implemented to send to the main app the fact that someone pressed init"""
|
|
256
|
+
raise NotImplementedError
|