processview 1.5.1__tar.gz → 1.5.3__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.5.1 → processview-1.5.3}/PKG-INFO +1 -1
- processview-1.5.3/doc/conf.py +287 -0
- processview-1.5.3/example/show_processmanagerwindow.py +118 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/sorting.py +1 -1
- processview-1.5.3/processview/gui/processmanager/ObservationTable.py +137 -0
- processview-1.5.3/processview/gui/processmanager/ProcessManager.py +83 -0
- processview-1.5.3/processview/gui/processmanager/ProcessManagerWidget.py +83 -0
- processview-1.5.3/processview/gui/processmanager/ProcessManagerWindow.py +17 -0
- processview-1.5.3/processview/gui/processmanager/_DatasetProcessModel.py +215 -0
- processview-1.5.3/processview/gui/processmanager/_FilterWidget.py +102 -0
- processview-1.5.3/processview/gui/processmanager/_OptionsWidget.py +36 -0
- processview-1.5.3/processview/gui/processmanager/_OrderingWidget.py +38 -0
- processview-1.5.3/processview/gui/processmanager/__init__.py +2 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/processmanager.py +24 -23
- processview-1.5.3/processview/gui/utils/qitem_model_resetter.py +17 -0
- processview-1.5.3/processview/resources/gui/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/version.py +1 -1
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/PKG-INFO +1 -1
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/SOURCES.txt +13 -0
- {processview-1.5.1 → processview-1.5.3}/LICENSE +0 -0
- {processview-1.5.1 → processview-1.5.3}/README.md +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/dataset.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/helpers.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/manager/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/manager/manager.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/manager/test/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/manager/test/test_manager.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/setup.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/superviseprocess.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/core/test/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/DropDownWidget.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/messagebox.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/test/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/gui/test/test_process_manager.py +0 -0
- {processview-1.5.1/processview/resources → processview-1.5.3/processview/gui/utils}/__init__.py +0 -0
- {processview-1.5.1/processview/resources/gui → processview-1.5.3/processview/resources}/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/resources/gui/icons/advancement.png +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/resources/gui/icons/advancement.svg +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/resources/gui/icons/magnifying_glass.png +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/resources/gui/icons/magnifying_glass.svg +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/test/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/utils/__init__.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview/utils/singleton.py +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/dependency_links.txt +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/requires.txt +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/top_level.txt +0 -0
- {processview-1.5.1 → processview-1.5.3}/processview.egg-info/zip-safe +0 -0
- {processview-1.5.1 → processview-1.5.3}/setup.cfg +0 -0
- {processview-1.5.1 → processview-1.5.3}/setup.py +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# Orange3 Example Add-on documentation build configuration file, created by
|
|
5
|
+
# sphinx-quickstart on Fri Aug 21 11:28:31 2015.
|
|
6
|
+
#
|
|
7
|
+
# This file is execfile()d with the current directory set to its
|
|
8
|
+
# containing dir.
|
|
9
|
+
#
|
|
10
|
+
# Note that not all possible configuration values are present in this
|
|
11
|
+
# autogenerated file.
|
|
12
|
+
#
|
|
13
|
+
# All configuration values have a default; values that are commented out
|
|
14
|
+
# serve to show the default.
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
import os
|
|
18
|
+
|
|
19
|
+
# General information about the project.
|
|
20
|
+
project = "processview"
|
|
21
|
+
copyright = "2016-2021, ESRF"
|
|
22
|
+
author = "ESRF"
|
|
23
|
+
|
|
24
|
+
# -- General configuration ------------------------------------------------
|
|
25
|
+
|
|
26
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
|
27
|
+
# needs_sphinx = '1.0'
|
|
28
|
+
|
|
29
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
|
30
|
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
31
|
+
# ones.
|
|
32
|
+
extensions = [
|
|
33
|
+
"sphinx.ext.autodoc",
|
|
34
|
+
"nbsphinx",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
# Add any paths that contain templates here, relative to this directory.
|
|
38
|
+
templates_path = ["templates"]
|
|
39
|
+
|
|
40
|
+
# The suffix(es) of source filenames.
|
|
41
|
+
# You can specify multiple suffix as a list of string:
|
|
42
|
+
source_suffix = [".rst", ".md"]
|
|
43
|
+
|
|
44
|
+
# The encoding of source files.
|
|
45
|
+
# source_encoding = 'utf-8-sig'
|
|
46
|
+
|
|
47
|
+
# The master toctree document.
|
|
48
|
+
master_doc = "index"
|
|
49
|
+
|
|
50
|
+
# The version info for the project you're documenting, acts as replacement for
|
|
51
|
+
# |version| and |release|, also used in various other places throughout the
|
|
52
|
+
# built documents.
|
|
53
|
+
#
|
|
54
|
+
# The short X.Y version.
|
|
55
|
+
version = "1.2"
|
|
56
|
+
# The full version, including alpha/beta/rc tags.
|
|
57
|
+
release = "1.2"
|
|
58
|
+
|
|
59
|
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
60
|
+
# for a list of supported languages.
|
|
61
|
+
#
|
|
62
|
+
# This is also used if you do content translation via gettext catalogs.
|
|
63
|
+
# Usually you set "language" from the command line for these cases.
|
|
64
|
+
language = None
|
|
65
|
+
|
|
66
|
+
# There are two options for replacing |today|: either, you set today to some
|
|
67
|
+
# non-false value, then it is used:
|
|
68
|
+
# today = ''
|
|
69
|
+
# Else, today_fmt is used as the format for a strftime call.
|
|
70
|
+
# today_fmt = '%B %d, %Y'
|
|
71
|
+
|
|
72
|
+
# List of patterns, relative to source directory, that match files and
|
|
73
|
+
# directories to ignore when looking for source files.
|
|
74
|
+
exclude_patterns = ["build", "**.ipynb_checkpoints"]
|
|
75
|
+
|
|
76
|
+
# The reST default role (used for this markup: `text`) to use for all
|
|
77
|
+
# documents.
|
|
78
|
+
# default_role = None
|
|
79
|
+
|
|
80
|
+
# If true, '()' will be appended to :func: etc. cross-reference text.
|
|
81
|
+
# add_function_parentheses = True
|
|
82
|
+
|
|
83
|
+
# If true, the current module name will be prepended to all description
|
|
84
|
+
# unit titles (such as .. function::).
|
|
85
|
+
# add_module_names = True
|
|
86
|
+
|
|
87
|
+
# If true, sectionauthor and moduleauthor directives will be shown in the
|
|
88
|
+
# output. They are ignored by default.
|
|
89
|
+
# show_authors = False
|
|
90
|
+
|
|
91
|
+
# The name of the Pygments (syntax highlighting) style to use.
|
|
92
|
+
pygments_style = "sphinx"
|
|
93
|
+
|
|
94
|
+
# A list of ignored prefixes for module index sorting.
|
|
95
|
+
# modindex_common_prefix = []
|
|
96
|
+
|
|
97
|
+
# If true, keep warnings as "system message" paragraphs in the built documents.
|
|
98
|
+
# keep_warnings = False
|
|
99
|
+
|
|
100
|
+
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
101
|
+
todo_include_todos = False
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# -- Options for HTML output ----------------------------------------------
|
|
105
|
+
|
|
106
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
107
|
+
# a list of builtin themes.
|
|
108
|
+
html_theme = "nature"
|
|
109
|
+
|
|
110
|
+
# Theme options are theme-specific and customize the look and feel of a theme
|
|
111
|
+
# further. For a list of options available for each theme, see the
|
|
112
|
+
# documentation.
|
|
113
|
+
# html_theme_options = {}
|
|
114
|
+
|
|
115
|
+
# Add any paths that contain custom themes here, relative to this directory.
|
|
116
|
+
# html_theme_path = []
|
|
117
|
+
|
|
118
|
+
# The name for this set of Sphinx documents. If None, it defaults to
|
|
119
|
+
# "<project> v<release> documentation".
|
|
120
|
+
# html_title = None
|
|
121
|
+
|
|
122
|
+
# A shorter title for the navigation bar. Default is the same as html_title.
|
|
123
|
+
# html_short_title = None
|
|
124
|
+
|
|
125
|
+
# The name of an image file (relative to this directory) to place at the top
|
|
126
|
+
# of the sidebar.
|
|
127
|
+
html_logo = "img/processview.png"
|
|
128
|
+
|
|
129
|
+
# The name of an image file (within the static path) to use as favicon of the
|
|
130
|
+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
|
131
|
+
# pixels large.
|
|
132
|
+
# html_favicon = None
|
|
133
|
+
|
|
134
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
|
135
|
+
# relative to this directory. They are copied after the builtin static files,
|
|
136
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
137
|
+
# html_static_path = ['static']
|
|
138
|
+
|
|
139
|
+
# Add any extra paths that contain custom files (such as robots.txt or
|
|
140
|
+
# .htaccess) here, relative to this directory. These files are copied
|
|
141
|
+
# directly to the root of the documentation.
|
|
142
|
+
# html_extra_path = []
|
|
143
|
+
|
|
144
|
+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
|
145
|
+
# using the given strftime format.
|
|
146
|
+
# html_last_updated_fmt = '%b %d, %Y'
|
|
147
|
+
|
|
148
|
+
# If true, SmartyPants will be used to convert quotes and dashes to
|
|
149
|
+
# typographically correct entities.
|
|
150
|
+
# html_use_smartypants = True
|
|
151
|
+
|
|
152
|
+
# Custom sidebar templates, maps document names to template names.
|
|
153
|
+
# html_sidebars = {}
|
|
154
|
+
|
|
155
|
+
# Additional templates that should be rendered to pages, maps page names to
|
|
156
|
+
# template names.
|
|
157
|
+
# html_additional_pages = {}
|
|
158
|
+
|
|
159
|
+
# If false, no module index is generated.
|
|
160
|
+
# html_domain_indices = True
|
|
161
|
+
|
|
162
|
+
# If false, no index is generated.
|
|
163
|
+
# html_use_index = True
|
|
164
|
+
|
|
165
|
+
# If true, the index is split into individual pages for each letter.
|
|
166
|
+
# html_split_index = False
|
|
167
|
+
|
|
168
|
+
# If true, links to the reST sources are added to the pages.
|
|
169
|
+
# html_show_sourcelink = True
|
|
170
|
+
|
|
171
|
+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
|
172
|
+
# html_show_sphinx = True
|
|
173
|
+
|
|
174
|
+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
|
175
|
+
# html_show_copyright = True
|
|
176
|
+
|
|
177
|
+
# If true, an OpenSearch description file will be output, and all pages will
|
|
178
|
+
# contain a <link> tag referring to it. The value of this option must be the
|
|
179
|
+
# base URL from which the finished HTML is served.
|
|
180
|
+
# html_use_opensearch = ''
|
|
181
|
+
|
|
182
|
+
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
|
183
|
+
# html_file_suffix = None
|
|
184
|
+
|
|
185
|
+
# Language to be used for generating the HTML full-text search index.
|
|
186
|
+
# Sphinx supports the following languages:
|
|
187
|
+
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
|
|
188
|
+
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
|
|
189
|
+
# html_search_language = 'en'
|
|
190
|
+
|
|
191
|
+
# A dictionary with options for the search language support, empty by default.
|
|
192
|
+
# Now only 'ja' uses this config value
|
|
193
|
+
# html_search_options = {'type': 'default'}
|
|
194
|
+
|
|
195
|
+
# The name of a javascript file (relative to the configuration directory) that
|
|
196
|
+
# implements a search results scorer. If empty, the default will be used.
|
|
197
|
+
# html_search_scorer = 'scorer.js'
|
|
198
|
+
|
|
199
|
+
# Output file base name for HTML help builder.
|
|
200
|
+
htmlhelp_basename = "processview"
|
|
201
|
+
|
|
202
|
+
# -- Options for LaTeX output ---------------------------------------------
|
|
203
|
+
|
|
204
|
+
latex_elements = {
|
|
205
|
+
# The paper size ('letterpaper' or 'a4paper').
|
|
206
|
+
# 'papersize': 'letterpaper',
|
|
207
|
+
# The font size ('10pt', '11pt' or '12pt').
|
|
208
|
+
# 'pointsize': '10pt',
|
|
209
|
+
# Additional stuff for the LaTeX preamble.
|
|
210
|
+
# 'preamble': '',
|
|
211
|
+
# Latex figure (float) alignment
|
|
212
|
+
# 'figure_align': 'htbp',
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
# Grouping the document tree into LaTeX files. List of tuples
|
|
216
|
+
# (source start file, target name, title,
|
|
217
|
+
# author, documentclass [howto, manual, or own class]).
|
|
218
|
+
# latex_documents = [
|
|
219
|
+
# (master_doc, 'Orange3ESRFAdd-on.tex', 'Orange3 ESRF Add-on Documentation',
|
|
220
|
+
# 'Biolab', 'manual'),
|
|
221
|
+
# ]
|
|
222
|
+
|
|
223
|
+
# The name of an image file (relative to this directory) to place at the top of
|
|
224
|
+
# the title page.
|
|
225
|
+
# latex_logo = None
|
|
226
|
+
|
|
227
|
+
# For "manual" documents, if this is true, then toplevel headings are parts,
|
|
228
|
+
# not chapters.
|
|
229
|
+
# latex_use_parts = False
|
|
230
|
+
|
|
231
|
+
# If true, show page references after internal links.
|
|
232
|
+
# latex_show_pagerefs = False
|
|
233
|
+
|
|
234
|
+
# If true, show URL addresses after external links.
|
|
235
|
+
# latex_show_urls = False
|
|
236
|
+
|
|
237
|
+
# Documents to append as an appendix to all manuals.
|
|
238
|
+
# latex_appendices = []
|
|
239
|
+
|
|
240
|
+
# If false, no module index is generated.
|
|
241
|
+
# latex_domain_indices = True
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
# -- Options for manual page output ---------------------------------------
|
|
245
|
+
|
|
246
|
+
# One entry per manual page. List of tuples
|
|
247
|
+
# (source start file, name, description, authors, manual section).
|
|
248
|
+
man_pages = [(master_doc, "processview", [author], 1)]
|
|
249
|
+
|
|
250
|
+
htmlhelp_pages = [(master_doc, "processview", [author], 1)]
|
|
251
|
+
|
|
252
|
+
# If true, show URL addresses after external links.
|
|
253
|
+
# man_show_urls = False
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
# -- Options for Texinfo output -------------------------------------------
|
|
257
|
+
|
|
258
|
+
# Grouping the document tree into Texinfo files. List of tuples
|
|
259
|
+
# (source start file, target name, title, author,
|
|
260
|
+
# dir menu entry, description, category)
|
|
261
|
+
texinfo_documents = [
|
|
262
|
+
(
|
|
263
|
+
master_doc,
|
|
264
|
+
"processview",
|
|
265
|
+
"processview Documentation",
|
|
266
|
+
author,
|
|
267
|
+
"processview",
|
|
268
|
+
"One line description of project.",
|
|
269
|
+
"Miscellaneous",
|
|
270
|
+
)
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
# Documents to append as an appendix to all manuals.
|
|
274
|
+
# texinfo_appendices = []
|
|
275
|
+
|
|
276
|
+
# If false, no module index is generated.
|
|
277
|
+
# texinfo_domain_indices = True
|
|
278
|
+
|
|
279
|
+
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
|
280
|
+
# texinfo_show_urls = 'footnote'
|
|
281
|
+
|
|
282
|
+
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
|
283
|
+
# texinfo_no_detailmenu = False
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
nbsphinx_allow_errors = True
|
|
287
|
+
nbsphinx_timeout = 60
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
import numpy
|
|
5
|
+
import threading
|
|
6
|
+
from silx.gui import qt
|
|
7
|
+
from processview.gui.processmanager import ProcessManagerWindow
|
|
8
|
+
from processview.core.superviseprocess import SuperviseProcess
|
|
9
|
+
from processview.core.dataset import Dataset
|
|
10
|
+
from processview.core.dataset import DatasetIdentifier
|
|
11
|
+
from processview.core.manager import DatasetState
|
|
12
|
+
from processview.gui.processmanager import ProcessManager
|
|
13
|
+
import datetime
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class _DummyDataset(Dataset):
|
|
17
|
+
def __init__(self, name):
|
|
18
|
+
super().__init__()
|
|
19
|
+
self.__name = name
|
|
20
|
+
|
|
21
|
+
def __str__(self) -> str:
|
|
22
|
+
return self.__name
|
|
23
|
+
|
|
24
|
+
def get_identifier(self) -> DatasetIdentifier:
|
|
25
|
+
return _DummyIdentifier(
|
|
26
|
+
self,
|
|
27
|
+
metadata={
|
|
28
|
+
"name": self.__name,
|
|
29
|
+
"creation_time": datetime.datetime.now(),
|
|
30
|
+
"modification_time": datetime.datetime.now(),
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class _DummyIdentifier(DatasetIdentifier):
|
|
36
|
+
def to_str(self):
|
|
37
|
+
return str(self)
|
|
38
|
+
|
|
39
|
+
def __str__(self):
|
|
40
|
+
return self.name()
|
|
41
|
+
|
|
42
|
+
def __eq__(self, other):
|
|
43
|
+
return self.name() == other.name()
|
|
44
|
+
|
|
45
|
+
def __hash__(self):
|
|
46
|
+
return hash(self.name())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
app = qt.QApplication([])
|
|
50
|
+
|
|
51
|
+
window = ProcessManagerWindow(parent=None)
|
|
52
|
+
window.show()
|
|
53
|
+
|
|
54
|
+
p1 = SuperviseProcess(name="process1")
|
|
55
|
+
p2 = SuperviseProcess(name="process2")
|
|
56
|
+
p3 = SuperviseProcess(name="process3")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
manager = ProcessManager()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class RecursiveThread(threading.Thread):
|
|
63
|
+
def __init__(self, execute_each: int):
|
|
64
|
+
self.running = True
|
|
65
|
+
self.execute_each = execute_each
|
|
66
|
+
super().__init__()
|
|
67
|
+
|
|
68
|
+
def run(self):
|
|
69
|
+
"""Method implementing thread loop that updates the plot"""
|
|
70
|
+
while self.running:
|
|
71
|
+
time.sleep(self.execute_each)
|
|
72
|
+
self.process()
|
|
73
|
+
|
|
74
|
+
def process(self):
|
|
75
|
+
raise NotImplementedError()
|
|
76
|
+
|
|
77
|
+
def stop(self):
|
|
78
|
+
"""Stop the update thread"""
|
|
79
|
+
self.running = False
|
|
80
|
+
self.join(2)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class CreateNewDataset(RecursiveThread):
|
|
84
|
+
"""Thread creating a new dataset each n seconds"""
|
|
85
|
+
|
|
86
|
+
def process(self):
|
|
87
|
+
dataset = _DummyDataset(f"scan {numpy.random.randint(0, 999999)}")
|
|
88
|
+
manager.notify_dataset_state(
|
|
89
|
+
dataset=dataset, state=DatasetState.PENDING, process=p1
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class UpdateDataset(RecursiveThread):
|
|
94
|
+
"""Thread that will update randomly one of the existing dataset"""
|
|
95
|
+
|
|
96
|
+
def process(self):
|
|
97
|
+
datasets = manager.get_datasets()
|
|
98
|
+
if len(datasets) == 0:
|
|
99
|
+
return
|
|
100
|
+
dataset_to_update = numpy.random.choice(datasets)
|
|
101
|
+
state = numpy.random.choice(DatasetState)
|
|
102
|
+
process = numpy.random.choice(manager.get_processes())
|
|
103
|
+
manager.notify_dataset_state(
|
|
104
|
+
dataset=dataset_to_update,
|
|
105
|
+
state=state,
|
|
106
|
+
process=process,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
create_new_dataset_thread = CreateNewDataset(execute_each=3)
|
|
111
|
+
create_new_dataset_thread.start()
|
|
112
|
+
update_dataset_thread = UpdateDataset(execute_each=1)
|
|
113
|
+
update_dataset_thread.start()
|
|
114
|
+
|
|
115
|
+
app.exec()
|
|
116
|
+
|
|
117
|
+
create_new_dataset_thread.stop()
|
|
118
|
+
update_dataset_thread.stop()
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from silx.gui import qt
|
|
4
|
+
from processview.gui.messagebox import MessageBox
|
|
5
|
+
from processview.core.manager import ProcessManager as _ProcessManager
|
|
6
|
+
from processview.core.superviseprocess import SuperviseProcess
|
|
7
|
+
from processview.core.dataset import DatasetIdentifier
|
|
8
|
+
|
|
9
|
+
from .ProcessManager import ProcessManager
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ObservationTable(qt.QTableView):
|
|
13
|
+
"""
|
|
14
|
+
Redefinition of QTableView for datasets and processes
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, parent):
|
|
18
|
+
qt.QTableView.__init__(self, parent)
|
|
19
|
+
self.verticalHeader().setSectionsClickable(True)
|
|
20
|
+
|
|
21
|
+
# QMenu for the dataset name
|
|
22
|
+
self.dataset_menu = qt.QMenu()
|
|
23
|
+
self._copyAction = qt.QAction("copy")
|
|
24
|
+
self.dataset_menu.addAction(self._copyAction)
|
|
25
|
+
self._removeAction = qt.QAction("remove")
|
|
26
|
+
self.dataset_menu.addAction(self._removeAction)
|
|
27
|
+
|
|
28
|
+
# QMenu for cell from on dataset and one process
|
|
29
|
+
self.menu_dataset_vs_process = qt.QMenu()
|
|
30
|
+
self._reprocessAction = qt.QAction("reprocess")
|
|
31
|
+
self.menu_dataset_vs_process.addAction(self._reprocessAction)
|
|
32
|
+
self._cancelAction = qt.QAction("cancel")
|
|
33
|
+
self.menu_dataset_vs_process.addAction(self._cancelAction)
|
|
34
|
+
self._infoAction = qt.QAction("info")
|
|
35
|
+
self.menu_dataset_vs_process.addAction(self._infoAction)
|
|
36
|
+
self.menu_dataset_vs_process.addAction(self._removeAction)
|
|
37
|
+
|
|
38
|
+
self._target = (None, None)
|
|
39
|
+
# register target of the last menu (process, DatasetIdentifier)
|
|
40
|
+
|
|
41
|
+
# connect signal / slot
|
|
42
|
+
self._copyAction.triggered.connect(self._requestDatasetIdCopy)
|
|
43
|
+
self._removeAction.triggered.connect(self._requestRemoveDataset)
|
|
44
|
+
self._reprocessAction.triggered.connect(self._requestReprocessing)
|
|
45
|
+
self._infoAction.triggered.connect(self._requestInfo)
|
|
46
|
+
self._cancelAction.triggered.connect(self._requestCancelProcessing)
|
|
47
|
+
|
|
48
|
+
def _processAt(self, x_pos):
|
|
49
|
+
column = self.columnAt(x_pos)
|
|
50
|
+
if column >= 1:
|
|
51
|
+
processes = self.model()._processes
|
|
52
|
+
process_idx = column - 1
|
|
53
|
+
if process_idx < len(processes):
|
|
54
|
+
return processes[list(processes.keys())[process_idx]]
|
|
55
|
+
|
|
56
|
+
def _datasetAt(self, y_pos):
|
|
57
|
+
row = self.rowAt(y_pos)
|
|
58
|
+
if row >= 0:
|
|
59
|
+
datasets = self.model()._sorted_datasets
|
|
60
|
+
if row < len(datasets):
|
|
61
|
+
return datasets[list(datasets.keys())[row]]
|
|
62
|
+
|
|
63
|
+
def contextMenuEvent(self, event):
|
|
64
|
+
row = self.columnAt(event.pos().x())
|
|
65
|
+
dataset = self._datasetAt(event.pos().y())
|
|
66
|
+
if row == 0:
|
|
67
|
+
# handle column column
|
|
68
|
+
self._target = (None, dataset)
|
|
69
|
+
self.dataset_menu.exec(event.globalPos())
|
|
70
|
+
else:
|
|
71
|
+
# handle processes column
|
|
72
|
+
process = self._processAt(event.pos().x())
|
|
73
|
+
if (
|
|
74
|
+
process is not None
|
|
75
|
+
and dataset is not None
|
|
76
|
+
and _ProcessManager().met(process=process, dataset=dataset)
|
|
77
|
+
):
|
|
78
|
+
self._target = (process, dataset)
|
|
79
|
+
self.menu_dataset_vs_process.exec(event.globalPos())
|
|
80
|
+
else:
|
|
81
|
+
self._target = (None, None)
|
|
82
|
+
super().contextMenuEvent(event)
|
|
83
|
+
|
|
84
|
+
def _requestReprocessing(self, *args, **kwargs):
|
|
85
|
+
process, dataset = self._target
|
|
86
|
+
|
|
87
|
+
if process is not None and dataset is not None:
|
|
88
|
+
assert isinstance(process, SuperviseProcess)
|
|
89
|
+
assert isinstance(dataset, DatasetIdentifier)
|
|
90
|
+
process.reprocess(dataset.recreate_dataset())
|
|
91
|
+
|
|
92
|
+
def _requestCancelProcessing(self, *args, **kwargs):
|
|
93
|
+
process, dataset = self._target
|
|
94
|
+
if process is not None and dataset is not None:
|
|
95
|
+
assert isinstance(process, SuperviseProcess)
|
|
96
|
+
assert isinstance(dataset, DatasetIdentifier)
|
|
97
|
+
process.cancel(dataset.recreate_dataset())
|
|
98
|
+
|
|
99
|
+
def _requestDatasetIdCopy(self, *args, **kwargs):
|
|
100
|
+
_, dataset = self._target
|
|
101
|
+
if dataset is not None:
|
|
102
|
+
clipboard = qt.QGuiApplication.clipboard()
|
|
103
|
+
clipboard.setText(dataset.to_str())
|
|
104
|
+
|
|
105
|
+
def _requestRemoveDataset(self, *args, **kwargs):
|
|
106
|
+
def get_dataset_at(row: int):
|
|
107
|
+
datasets = self.model()._sorted_datasets
|
|
108
|
+
return datasets.get(
|
|
109
|
+
list(datasets.keys())[row],
|
|
110
|
+
None,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
datasets = [get_dataset_at(index.row()) for index in self.selectedIndexes()]
|
|
114
|
+
[ProcessManager().remove_dataset(dataset) for dataset in datasets]
|
|
115
|
+
self.model().remove_datasets(datasets)
|
|
116
|
+
|
|
117
|
+
def _requestInfo(self, *args, **kwargs):
|
|
118
|
+
process, dataset = self._target
|
|
119
|
+
if process is not None and dataset is not None:
|
|
120
|
+
infos = ProcessManager().get_dataset_details(
|
|
121
|
+
dataset=dataset, process=process
|
|
122
|
+
)
|
|
123
|
+
if infos in (None, ""):
|
|
124
|
+
infos = "No extra information provided"
|
|
125
|
+
|
|
126
|
+
msg = MessageBox(self)
|
|
127
|
+
msg.setInfos(infos=infos)
|
|
128
|
+
extra_info = "{} processing {}".format(process.name, dataset)
|
|
129
|
+
msg.setWindowTitle(extra_info)
|
|
130
|
+
msg.setWindowModality(qt.Qt.NonModal)
|
|
131
|
+
msg.show()
|
|
132
|
+
|
|
133
|
+
def sizeHintForColumn(self, column):
|
|
134
|
+
if column == 0:
|
|
135
|
+
return 350
|
|
136
|
+
else:
|
|
137
|
+
return super().sizeHintForColumn(column)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from silx.gui import qt
|
|
4
|
+
from processview.core.manager import ProcessManager as _ProcessManager
|
|
5
|
+
from processview.core.superviseprocess import SuperviseProcess
|
|
6
|
+
from processview.utils import docstring
|
|
7
|
+
from processview.core.manager import DatasetState
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProcessManager(qt.QObject):
|
|
11
|
+
sigUpdated = qt.Signal()
|
|
12
|
+
"""Signal emitted when the state of some process / dataset is updated
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
sigNewProcessRegistered = qt.Signal()
|
|
16
|
+
"""Signal emitted when a new process is registered"""
|
|
17
|
+
|
|
18
|
+
sigProcessUnregistered = qt.Signal()
|
|
19
|
+
"""Signal emitted when a process is unregistered"""
|
|
20
|
+
|
|
21
|
+
sigProcessRenamed = qt.Signal(SuperviseProcess)
|
|
22
|
+
"""Emit when the process is renamed"""
|
|
23
|
+
|
|
24
|
+
def __init__(self):
|
|
25
|
+
qt.QObject.__init__(self)
|
|
26
|
+
self.manager = _ProcessManager()
|
|
27
|
+
|
|
28
|
+
# monkey patch manager updated function
|
|
29
|
+
# TODO: add / remove callback would be simpler
|
|
30
|
+
self.manager.add_update_callback(self.updated)
|
|
31
|
+
self.manager.add_new_process_callback(self.processAdded)
|
|
32
|
+
self.manager.add_process_removed_callback(self.processRemoved)
|
|
33
|
+
self.manager.add_process_name_changed_callback(self.processRenamed)
|
|
34
|
+
|
|
35
|
+
def updated(self):
|
|
36
|
+
self.sigUpdated.emit()
|
|
37
|
+
|
|
38
|
+
def processAdded(self):
|
|
39
|
+
self.sigNewProcessRegistered.emit()
|
|
40
|
+
|
|
41
|
+
def processRemoved(self):
|
|
42
|
+
self.sigProcessUnregistered.emit()
|
|
43
|
+
|
|
44
|
+
def processRenamed(self, process):
|
|
45
|
+
self.sigProcessRenamed.emit(process)
|
|
46
|
+
|
|
47
|
+
def destroyed(self, object_):
|
|
48
|
+
self.manager.remove_update_callback(self.updated)
|
|
49
|
+
qt.QObject.destroyed(object_)
|
|
50
|
+
|
|
51
|
+
# expose some of the original ProcessManager API
|
|
52
|
+
@docstring(_ProcessManager)
|
|
53
|
+
def notify_dataset_state(self, dataset, process, state, details=None) -> None:
|
|
54
|
+
self.manager.notify_dataset_state(
|
|
55
|
+
dataset=dataset, process=process, state=state, details=details
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@docstring(_ProcessManager)
|
|
59
|
+
def get_dataset_state(self, dataset, process) -> None | DatasetState:
|
|
60
|
+
return self.manager.get_dataset_state(dataset_id=dataset, process=process)
|
|
61
|
+
|
|
62
|
+
@docstring(_ProcessManager)
|
|
63
|
+
def get_dataset_details(self, dataset, process) -> None | DatasetState:
|
|
64
|
+
return self.manager.get_dataset_details(dataset_id=dataset, process=process)
|
|
65
|
+
|
|
66
|
+
@docstring(_ProcessManager)
|
|
67
|
+
def get_dataset_stream(self, dataset, time_stamp=False) -> tuple:
|
|
68
|
+
return self.manager.get_dataset_stream(dataset=dataset, time_stamp=time_stamp)
|
|
69
|
+
|
|
70
|
+
@docstring(_ProcessManager)
|
|
71
|
+
def get_process_history(self, process, time_stamp=False) -> tuple:
|
|
72
|
+
return self.manager.get_process_history(process=process, time_stamp=time_stamp)
|
|
73
|
+
|
|
74
|
+
@docstring(_ProcessManager)
|
|
75
|
+
def get_processes(self):
|
|
76
|
+
return self.manager.get_processes()
|
|
77
|
+
|
|
78
|
+
@docstring(_ProcessManager)
|
|
79
|
+
def get_datasets(self):
|
|
80
|
+
return self.manager.get_datasets()
|
|
81
|
+
|
|
82
|
+
def remove_dataset(self, *args, **kwargs):
|
|
83
|
+
return self.manager.remove_dataset(*args, **kwargs)
|