processview 1.4.3__tar.gz → 1.5.0__tar.gz
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.
- {processview-1.4.3 → processview-1.5.0}/PKG-INFO +1 -1
- {processview-1.4.3 → processview-1.5.0}/processview/core/manager/manager.py +34 -41
- {processview-1.4.3 → processview-1.5.0}/processview/gui/processmanager.py +18 -37
- {processview-1.4.3 → processview-1.5.0}/processview/gui/test/test_process_manager.py +1 -1
- {processview-1.4.3 → processview-1.5.0}/processview/version.py +2 -2
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/PKG-INFO +1 -1
- {processview-1.4.3 → processview-1.5.0}/LICENSE +0 -0
- {processview-1.4.3 → processview-1.5.0}/README.md +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/dataset.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/helpers.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/manager/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/manager/test/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/manager/test/test_manager.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/setup.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/sorting.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/superviseprocess.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/core/test/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/gui/DropDownWidget.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/gui/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/gui/icons.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/gui/messagebox.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/gui/test/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/resources/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/advancement.png +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/advancement.svg +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/magnifying_glass.png +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/magnifying_glass.svg +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/test/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/utils/__init__.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview/utils/singleton.py +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/SOURCES.txt +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/dependency_links.txt +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/requires.txt +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/top_level.txt +0 -0
- {processview-1.4.3 → processview-1.5.0}/processview.egg-info/zip-safe +0 -0
- {processview-1.4.3 → processview-1.5.0}/setup.cfg +0 -0
- {processview-1.4.3 → processview-1.5.0}/setup.py +0 -0
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
# /*##########################################################################
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
|
|
5
|
-
#
|
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
# in the Software without restriction, including without limitation the rights
|
|
9
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
# furnished to do so, subject to the following conditions:
|
|
12
|
-
#
|
|
13
|
-
# The above copyright notice and this permission notice shall be included in
|
|
14
|
-
# all copies or substantial portions of the Software.
|
|
15
|
-
#
|
|
16
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
# THE SOFTWARE.
|
|
23
|
-
#
|
|
24
|
-
# ###########################################################################*/
|
|
25
|
-
|
|
26
|
-
__authors__ = ["H. Payno"]
|
|
27
|
-
__license__ = "MIT"
|
|
28
|
-
__date__ = "03/11/2020"
|
|
29
|
-
|
|
1
|
+
from __future__ import annotations
|
|
30
2
|
|
|
31
3
|
from processview.utils.singleton import singleton
|
|
32
4
|
from processview.core.dataset import Dataset
|
|
@@ -62,7 +34,7 @@ class ProcessManager:
|
|
|
62
34
|
|
|
63
35
|
def __init__(self):
|
|
64
36
|
self._processes = {}
|
|
65
|
-
self._dataset_process_states = {}
|
|
37
|
+
self._dataset_process_states: dict[int, dict[str, tuple]] = {}
|
|
66
38
|
"""key is processID, Value is a tuple of
|
|
67
39
|
(dataset state, details)"""
|
|
68
40
|
self._processID = 0
|
|
@@ -72,6 +44,8 @@ class ProcessManager:
|
|
|
72
44
|
"""list of callback to trigger when a process is added"""
|
|
73
45
|
self._processRemovedCallback = set()
|
|
74
46
|
"""list of callback to trigger when a process is removed"""
|
|
47
|
+
self._process_renamed_callback = set()
|
|
48
|
+
"""list of callback to trigger when a process is renamed"""
|
|
75
49
|
self.lock = threading.Lock()
|
|
76
50
|
|
|
77
51
|
def met(self, process, dataset) -> bool:
|
|
@@ -85,6 +59,13 @@ class ProcessManager:
|
|
|
85
59
|
if process.process_id in self._dataset_process_states:
|
|
86
60
|
return dataset_id in self._dataset_process_states[process.process_id]
|
|
87
61
|
|
|
62
|
+
def process_renamed(self, process):
|
|
63
|
+
"""
|
|
64
|
+
the process name only matter for the GUI side
|
|
65
|
+
"""
|
|
66
|
+
for callback in self._process_renamed_callback:
|
|
67
|
+
callback(process)
|
|
68
|
+
|
|
88
69
|
def register(self, process) -> int:
|
|
89
70
|
"""
|
|
90
71
|
Register a process to the manager
|
|
@@ -154,7 +135,6 @@ class ProcessManager:
|
|
|
154
135
|
"""
|
|
155
136
|
|
|
156
137
|
:return: tuple of processes currently registered
|
|
157
|
-
:rtype: tuple
|
|
158
138
|
"""
|
|
159
139
|
processes = []
|
|
160
140
|
for _, p in self._processes.items():
|
|
@@ -182,10 +162,15 @@ class ProcessManager:
|
|
|
182
162
|
"""
|
|
183
163
|
dataset_id = self._find_dataset_id(dataset)
|
|
184
164
|
for process_id in self._dataset_process_states:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
165
|
+
self._dataset_process_states[process_id].pop(dataset_id, None)
|
|
166
|
+
|
|
167
|
+
def notify_dataset_state(
|
|
168
|
+
self,
|
|
169
|
+
dataset: Dataset | DatasetIdentifier,
|
|
170
|
+
process,
|
|
171
|
+
state: DatasetState,
|
|
172
|
+
details=None,
|
|
173
|
+
) -> None:
|
|
189
174
|
"""
|
|
190
175
|
Update dataset state
|
|
191
176
|
|
|
@@ -209,7 +194,14 @@ class ProcessManager:
|
|
|
209
194
|
self._dataset_process_states[process.process_id] = OrderedDict()
|
|
210
195
|
if details is None:
|
|
211
196
|
details = ""
|
|
212
|
-
|
|
197
|
+
if isinstance(dataset, Dataset):
|
|
198
|
+
dataset_id = dataset.get_identifier()
|
|
199
|
+
else:
|
|
200
|
+
dataset_id = dataset
|
|
201
|
+
if not isinstance(dataset_id, DatasetIdentifier):
|
|
202
|
+
raise TypeError(
|
|
203
|
+
f"dataset should be an instance of {Dataset} or {DatasetIdentifier}. Got {type(dataset)}"
|
|
204
|
+
)
|
|
213
205
|
# as we store the identifier and not a string anymore we might need to remove another instanciation
|
|
214
206
|
process_states = self._dataset_process_states[process.process_id]
|
|
215
207
|
to_remove = set()
|
|
@@ -253,7 +245,6 @@ class ProcessManager:
|
|
|
253
245
|
:param Dataset dataset_id:
|
|
254
246
|
:param BaseProcess process:
|
|
255
247
|
:return: DatasetState relative to provided process if know
|
|
256
|
-
:rtype: Union[None, DatasetState]
|
|
257
248
|
"""
|
|
258
249
|
dataset_id = self._find_dataset_id(dataset_id)
|
|
259
250
|
process = self._find_process(process)
|
|
@@ -273,7 +264,6 @@ class ProcessManager:
|
|
|
273
264
|
:param Dataset dataset_id:
|
|
274
265
|
:param BaseProcess process:
|
|
275
266
|
:return: DatasetState relative to provided process if know
|
|
276
|
-
:rtype: Union[None, DatasetState]
|
|
277
267
|
"""
|
|
278
268
|
dataset_id = self._find_dataset_id(dataset_id)
|
|
279
269
|
process = self._find_process(process)
|
|
@@ -287,14 +277,15 @@ class ProcessManager:
|
|
|
287
277
|
return self._dataset_process_states[process.process_id][dataset_id][1]
|
|
288
278
|
return None
|
|
289
279
|
|
|
290
|
-
def get_dataset_stream(
|
|
280
|
+
def get_dataset_stream(
|
|
281
|
+
self, dataset, time_stamp=False
|
|
282
|
+
) -> tuple[int, DatasetState, list]:
|
|
291
283
|
"""
|
|
292
284
|
|
|
293
285
|
:param Dataset dataset: dataset the stream is focus on
|
|
294
286
|
:param bool time_stamp: if True then return timestamp in the list of
|
|
295
287
|
elements
|
|
296
288
|
:return: stream of (process ID, DatasetState) for a given dataset
|
|
297
|
-
:rtype: tuple of (process ID, DatasetState, [timestamp])
|
|
298
289
|
"""
|
|
299
290
|
stream = []
|
|
300
291
|
for process_id, dataset_states in self._dataset_process_states.items():
|
|
@@ -316,7 +307,6 @@ class ProcessManager:
|
|
|
316
307
|
:param bool time_stamp: if True then return timestamp in the list of
|
|
317
308
|
elements
|
|
318
309
|
:return: tuple of (DatasetIdentifier, state, [timestamp])
|
|
319
|
-
:rtype: tuple
|
|
320
310
|
"""
|
|
321
311
|
history = []
|
|
322
312
|
if process.process_id in self._dataset_process_states:
|
|
@@ -370,6 +360,9 @@ class ProcessManager:
|
|
|
370
360
|
if callback in self._processRemovedCallback:
|
|
371
361
|
self._processRemovedCallback.remove(callback)
|
|
372
362
|
|
|
363
|
+
def add_process_name_changed_callback(self, callback):
|
|
364
|
+
self._process_renamed_callback.add(callback)
|
|
365
|
+
|
|
373
366
|
def clear(self):
|
|
374
367
|
"""
|
|
375
368
|
clear registered processes and dataset states
|
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
# /*##########################################################################
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
|
|
5
|
-
#
|
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
# in the Software without restriction, including without limitation the rights
|
|
9
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
# furnished to do so, subject to the following conditions:
|
|
12
|
-
#
|
|
13
|
-
# The above copyright notice and this permission notice shall be included in
|
|
14
|
-
# all copies or substantial portions of the Software.
|
|
15
|
-
#
|
|
16
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
# THE SOFTWARE.
|
|
23
|
-
#
|
|
24
|
-
# ###########################################################################*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
__authors__ = ["H. Payno"]
|
|
28
|
-
__license__ = "MIT"
|
|
29
|
-
__date__ = "03/11/2020"
|
|
30
|
-
|
|
1
|
+
from __future__ import annotations
|
|
31
2
|
|
|
32
3
|
import fnmatch
|
|
33
4
|
from collections import OrderedDict
|
|
@@ -83,8 +54,8 @@ class ObservationTable(qt.QTableView):
|
|
|
83
54
|
self.dataset_menu = qt.QMenu()
|
|
84
55
|
self._copyAction = qt.QAction("copy")
|
|
85
56
|
self.dataset_menu.addAction(self._copyAction)
|
|
86
|
-
self.
|
|
87
|
-
self.dataset_menu.addAction(self.
|
|
57
|
+
self._removeAction = qt.QAction("remove")
|
|
58
|
+
self.dataset_menu.addAction(self._removeAction)
|
|
88
59
|
|
|
89
60
|
# QMenu for cell from on dataset and one process
|
|
90
61
|
self.menu_dataset_vs_process = qt.QMenu()
|
|
@@ -94,14 +65,14 @@ class ObservationTable(qt.QTableView):
|
|
|
94
65
|
self.menu_dataset_vs_process.addAction(self._cancelAction)
|
|
95
66
|
self._infoAction = qt.QAction("info")
|
|
96
67
|
self.menu_dataset_vs_process.addAction(self._infoAction)
|
|
97
|
-
self.menu_dataset_vs_process.addAction(self.
|
|
68
|
+
self.menu_dataset_vs_process.addAction(self._removeAction)
|
|
98
69
|
|
|
99
70
|
self._target = (None, None)
|
|
100
71
|
# register target of the last menu (process, DatasetIdentifier)
|
|
101
72
|
|
|
102
73
|
# connect signal / slot
|
|
103
74
|
self._copyAction.triggered.connect(self._requestDatasetIdCopy)
|
|
104
|
-
self.
|
|
75
|
+
self._removeAction.triggered.connect(self._requestRemoveDataset)
|
|
105
76
|
self._reprocessAction.triggered.connect(self._requestReprocessing)
|
|
106
77
|
self._infoAction.triggered.connect(self._requestInfo)
|
|
107
78
|
self._cancelAction.triggered.connect(self._requestCancelProcessing)
|
|
@@ -163,7 +134,7 @@ class ObservationTable(qt.QTableView):
|
|
|
163
134
|
clipboard = qt.QGuiApplication.clipboard()
|
|
164
135
|
clipboard.setText(dataset.to_str())
|
|
165
136
|
|
|
166
|
-
def
|
|
137
|
+
def _requestRemoveDataset(self, *args, **kwargs):
|
|
167
138
|
def get_dataset_at(row: int):
|
|
168
139
|
datasets = self.model()._sorted_datasets
|
|
169
140
|
return datasets.get(
|
|
@@ -244,6 +215,7 @@ class ProcessManagerWidget(qt.QWidget):
|
|
|
244
215
|
self._optionsWidget._orderingWidget.sigSortTypeChanged.connect(
|
|
245
216
|
self.observationTable.model()._setSorting
|
|
246
217
|
)
|
|
218
|
+
self._manager.sigProcessRenamed.connect(self._renameProcess)
|
|
247
219
|
# update to fit existing processes / datasets
|
|
248
220
|
self._updateProcesses()
|
|
249
221
|
self._updateDatasetStates()
|
|
@@ -254,6 +226,11 @@ class ProcessManagerWidget(qt.QWidget):
|
|
|
254
226
|
def _updateProcesses(self):
|
|
255
227
|
self.observationTable.model().setProcesses(self._manager.get_processes())
|
|
256
228
|
|
|
229
|
+
def _renameProcess(self, process: SuperviseProcess):
|
|
230
|
+
self.observationTable.model().headerDataChanged.emit(
|
|
231
|
+
qt.Qt.Horizontal, 0, len(self._manager.get_processes())
|
|
232
|
+
)
|
|
233
|
+
|
|
257
234
|
def _filterUpdated(self):
|
|
258
235
|
self.observationTable.model().process_patterns = (
|
|
259
236
|
self._dropDownOptionsWidget.getProcessPatterns()
|
|
@@ -628,6 +605,9 @@ class ProcessManager(qt.QObject):
|
|
|
628
605
|
sigProcessUnregistered = qt.Signal()
|
|
629
606
|
"""Signal emitted when a process is unregistered"""
|
|
630
607
|
|
|
608
|
+
sigProcessRenamed = qt.Signal(SuperviseProcess)
|
|
609
|
+
"""Emit when the process is renamed"""
|
|
610
|
+
|
|
631
611
|
def __init__(self):
|
|
632
612
|
qt.QObject.__init__(self)
|
|
633
613
|
self.manager = _ProcessManager()
|
|
@@ -637,6 +617,7 @@ class ProcessManager(qt.QObject):
|
|
|
637
617
|
self.manager.add_update_callback(self.updated)
|
|
638
618
|
self.manager.add_new_process_callback(self.processAdded)
|
|
639
619
|
self.manager.add_process_removed_callback(self.processRemoved)
|
|
620
|
+
self.manager.add_process_name_changed_callback(self.processRenamed)
|
|
640
621
|
|
|
641
622
|
def updated(self):
|
|
642
623
|
self.sigUpdated.emit()
|
|
@@ -647,8 +628,8 @@ class ProcessManager(qt.QObject):
|
|
|
647
628
|
def processRemoved(self):
|
|
648
629
|
self.sigProcessUnregistered.emit()
|
|
649
630
|
|
|
650
|
-
def
|
|
651
|
-
self.
|
|
631
|
+
def processRenamed(self, process):
|
|
632
|
+
self.sigProcessRenamed.emit(process)
|
|
652
633
|
|
|
653
634
|
def destroyed(self, object_):
|
|
654
635
|
self.manager.remove_update_callback(self.updated)
|
|
@@ -92,7 +92,7 @@ class TestProcessManager(TestCaseQt):
|
|
|
92
92
|
)
|
|
93
93
|
|
|
94
94
|
window._centralWidget.observationTable.selectAll()
|
|
95
|
-
window._centralWidget.observationTable.
|
|
95
|
+
window._centralWidget.observationTable._requestRemoveDataset()
|
|
96
96
|
self.qapp.processEvents()
|
|
97
97
|
assert len(manager.manager._dataset_process_states[p1.process_id]) == 0
|
|
98
98
|
manager.notify_dataset_state(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/magnifying_glass.png
RENAMED
|
File without changes
|
{processview-1.4.3 → processview-1.5.0}/processview/resources/gui/icons/magnifying_glass.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|