NeXpy 2.0.0b5__tar.gz → 2.0.0b7__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.
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/PKG-INFO +2 -2
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/pyproject.toml +1 -1
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/PKG-INFO +2 -2
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/requires.txt +1 -1
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/_version.py +2 -2
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/dialogs.py +331 -61
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/fitdialogs.py +45 -26
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/mainwindow.py +109 -16
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/plotview.py +5 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/scripteditor.py +15 -108
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/treeview.py +21 -1
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/utils.py +116 -36
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/widgets.py +267 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/readers/readtxt.py +2 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/.gitattributes +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/.github/dependabot.yaml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/.github/workflows/ci.yml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/.gitignore +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/COPYING +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/README.md +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/conda-recipe/bld.bat +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/conda-recipe/build.sh +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/conda-recipe/meta.yaml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/Makefile +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/make.bat +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/_static/__ignore__.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/conf.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/examples.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/favicon.ico +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/axis-limits-bar.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/customize-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/limits-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/nexpy-fits.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/nexpy-gui.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/nexpy-logo.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/options-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/projection-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/projection-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/scan-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/signal-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/simple-plot.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/skewed-axis.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/x-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/y-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/z-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/images/z-toolbar.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/includeme.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/index.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/pythongui.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/pythonshell.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/readers.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/doc/source/treeapi.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/setup.cfg +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/SOURCES.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/dependency_links.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/entry_points.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/pbr.json +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/NeXpy.egg-info/top_level.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/chopper.nxs +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/example.nxs +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/scripts/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/examples/scripts/example.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/consoleapp.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/datadialogs.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/importdialog.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/pyqt.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/NeXpy.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/NeXpy.svg +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/back.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/backward-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/customize.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/equal.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/export-data.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/export-figure.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/filesave.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/forward-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/forward.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/hand.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/home.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/link-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/lock-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/modify-style.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/move.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/pause-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/refresh-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/unlock-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/models/bose.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/models/critexp.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/models/op.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/models/pdfdecay.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/nexpygui.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/readers/readnpy.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/readers/readspec.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/readers/readstack.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/src/nexpy/readers/readtiff.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b7}/tests/test_imports.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: NeXpy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b7
|
|
4
4
|
Summary: Python GUI to analyze NeXus data
|
|
5
5
|
Author-email: Raymond Osborn <rayosborn@mac.com>
|
|
6
6
|
License: Licensing Terms for NeXpy
|
|
@@ -88,7 +88,7 @@ Requires-Dist: ipython
|
|
|
88
88
|
Requires-Dist: lmfit
|
|
89
89
|
Requires-Dist: matplotlib
|
|
90
90
|
Requires-Dist: mplcursors
|
|
91
|
-
Requires-Dist: nexusformat>=2.0.
|
|
91
|
+
Requires-Dist: nexusformat>=2.0.0b6
|
|
92
92
|
Requires-Dist: numpy
|
|
93
93
|
Requires-Dist: packaging
|
|
94
94
|
Requires-Dist: pillow
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: NeXpy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b7
|
|
4
4
|
Summary: Python GUI to analyze NeXus data
|
|
5
5
|
Author-email: Raymond Osborn <rayosborn@mac.com>
|
|
6
6
|
License: Licensing Terms for NeXpy
|
|
@@ -88,7 +88,7 @@ Requires-Dist: ipython
|
|
|
88
88
|
Requires-Dist: lmfit
|
|
89
89
|
Requires-Dist: matplotlib
|
|
90
90
|
Requires-Dist: mplcursors
|
|
91
|
-
Requires-Dist: nexusformat>=2.0.
|
|
91
|
+
Requires-Dist: nexusformat>=2.0.0b6
|
|
92
92
|
Requires-Dist: numpy
|
|
93
93
|
Requires-Dist: packaging
|
|
94
94
|
Requires-Dist: pillow
|
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '2.0.
|
|
21
|
-
__version_tuple__ = version_tuple = (2, 0, 0, '
|
|
20
|
+
__version__ = version = '2.0.0b7'
|
|
21
|
+
__version_tuple__ = version_tuple = (2, 0, 0, 'b7')
|
|
@@ -51,9 +51,11 @@ class NewDialog(NXDialog):
|
|
|
51
51
|
self.names = GridParameters()
|
|
52
52
|
self.names.add('root', self.tree.get_new_name(), 'Workspace', None)
|
|
53
53
|
self.names.add('entry', 'entry', 'Entry', True)
|
|
54
|
+
self.save_box = NXCheckBox("Save File", checked=False)
|
|
54
55
|
|
|
55
56
|
self.set_layout(self.names.grid(header=None),
|
|
56
|
-
self.
|
|
57
|
+
self.make_layout(self.save_box,
|
|
58
|
+
self.close_buttons(save=True)))
|
|
57
59
|
|
|
58
60
|
def accept(self):
|
|
59
61
|
"""
|
|
@@ -72,15 +74,11 @@ class NewDialog(NXDialog):
|
|
|
72
74
|
else:
|
|
73
75
|
self.tree[root] = NXroot()
|
|
74
76
|
self.treeview.select_node(self.tree[root])
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
self.tree[root].save(fname, 'w')
|
|
77
|
+
if self.save_box.isChecked():
|
|
78
|
+
self.treeview.select_node(self.tree[root])
|
|
79
|
+
self.mainwindow.save_file()
|
|
79
80
|
self.treeview.update()
|
|
80
81
|
logging.info(f"New workspace '{root}' created")
|
|
81
|
-
self.mainwindow.settings.set('backups', fname)
|
|
82
|
-
self.mainwindow.settings.set('session', fname)
|
|
83
|
-
self.mainwindow.settings.save()
|
|
84
82
|
super().accept()
|
|
85
83
|
|
|
86
84
|
|
|
@@ -764,9 +762,9 @@ class ExportDialog(NXDialog):
|
|
|
764
762
|
|
|
765
763
|
The dialog is initialized with two tabs, the first for exporting
|
|
766
764
|
to a NeXus file and the second for exporting to a text file. The
|
|
767
|
-
NeXus tab allows the entry name and data name to be set. The
|
|
768
|
-
tab allows the delimiter, title, headers, errors and fields
|
|
769
|
-
set.
|
|
765
|
+
NeXus tab allows the entry name and data name to be set. The
|
|
766
|
+
text tab allows the delimiter, title, headers, errors and fields
|
|
767
|
+
to be set.
|
|
770
768
|
|
|
771
769
|
Parameters
|
|
772
770
|
----------
|
|
@@ -1882,6 +1880,10 @@ class StyleTab(NXTab):
|
|
|
1882
1880
|
('Tighten Layout', self.tight_layout),
|
|
1883
1881
|
('Reset Layout', self.reset_layout)))
|
|
1884
1882
|
self.set_title('Plot Style')
|
|
1883
|
+
pars = self.plotview.figure.subplotpars
|
|
1884
|
+
self.original_layout = {'left': pars.left, 'right': pars.right,
|
|
1885
|
+
'bottom': pars.bottom, 'top': pars.right}
|
|
1886
|
+
|
|
1885
1887
|
|
|
1886
1888
|
def label_parameters(self):
|
|
1887
1889
|
"""
|
|
@@ -1971,9 +1973,6 @@ class StyleTab(NXTab):
|
|
|
1971
1973
|
before calling tight_layout, so that the layout can be reset
|
|
1972
1974
|
if needed.
|
|
1973
1975
|
"""
|
|
1974
|
-
pars = self.plotview.figure.subplotpars
|
|
1975
|
-
self.previous_layout = {'left': pars.left, 'right': pars.right,
|
|
1976
|
-
'bottom': pars.bottom, 'top': pars.right}
|
|
1977
1976
|
self.plotview.figure.tight_layout()
|
|
1978
1977
|
self.plotview.draw()
|
|
1979
1978
|
|
|
@@ -1987,20 +1986,14 @@ class StyleTab(NXTab):
|
|
|
1987
1986
|
done by tight_layout is not what you want. The original layout
|
|
1988
1987
|
is restored, and the plot is redrawn.
|
|
1989
1988
|
"""
|
|
1990
|
-
self.plotview.figure.subplots_adjust(**self.
|
|
1989
|
+
self.plotview.figure.subplots_adjust(**self.original_layout)
|
|
1991
1990
|
self.plotview.draw()
|
|
1992
1991
|
|
|
1993
1992
|
def adjust_layout(self):
|
|
1994
1993
|
"""
|
|
1995
1994
|
Call the configure_subplots method of the Options Tab to adjust
|
|
1996
1995
|
the layout of the active plotview.
|
|
1997
|
-
|
|
1998
|
-
The current layout is saved before calling configure_subplots,
|
|
1999
|
-
so that the layout can be reset if needed.
|
|
2000
1996
|
"""
|
|
2001
|
-
pars = self.plotview.figure.subplotpars
|
|
2002
|
-
self.previous_layout = {'left': pars.left, 'right': pars.right,
|
|
2003
|
-
'bottom': pars.bottom, 'top': pars.right}
|
|
2004
1997
|
self.plotview.otab.configure_subplots()
|
|
2005
1998
|
|
|
2006
1999
|
def save_default(self):
|
|
@@ -2621,12 +2614,12 @@ class ProjectionTab(NXTab):
|
|
|
2621
2614
|
|
|
2622
2615
|
def get_rectangle(self):
|
|
2623
2616
|
"""
|
|
2624
|
-
Return the coordinates of the
|
|
2617
|
+
Return the coordinates of the projection limits rectangle.
|
|
2625
2618
|
|
|
2626
|
-
The coordinates are returned as a list of four tuples, each
|
|
2627
|
-
containing the x and y coordinates of a vertex of the
|
|
2628
|
-
If the plot is skewed, the coordinates are
|
|
2629
|
-
skewed coordinates.
|
|
2619
|
+
The coordinates are returned as a list of four tuples, each
|
|
2620
|
+
tuple containing the x and y coordinates of a vertex of the
|
|
2621
|
+
rectangle. If the plot is skewed, the coordinates are
|
|
2622
|
+
transformed to the skewed coordinates.
|
|
2630
2623
|
"""
|
|
2631
2624
|
xp = self.plotview.xaxis.dim
|
|
2632
2625
|
yp = self.plotview.yaxis.dim
|
|
@@ -3385,26 +3378,72 @@ class ScanTab(NXTab):
|
|
|
3385
3378
|
"""
|
|
3386
3379
|
super().__init__(label, parent=parent)
|
|
3387
3380
|
|
|
3381
|
+
grid = QtWidgets.QGridLayout()
|
|
3382
|
+
grid.setSpacing(10)
|
|
3383
|
+
headers = ['Axis', 'Minimum', 'Maximum']
|
|
3384
|
+
width = [50, 100, 100]
|
|
3385
|
+
column = 0
|
|
3386
|
+
for header in headers:
|
|
3387
|
+
label = NXLabel(header, bold=True, align='center')
|
|
3388
|
+
grid.addWidget(label, 0, column)
|
|
3389
|
+
grid.setColumnMinimumWidth(column, width[column])
|
|
3390
|
+
column += 1
|
|
3391
|
+
row = 0
|
|
3392
|
+
self.minbox = {}
|
|
3393
|
+
self.maxbox = {}
|
|
3394
|
+
for axis in range(self.plotview.ndim):
|
|
3395
|
+
row += 1
|
|
3396
|
+
self.minbox[axis] = NXSpinBox(self.set_limits)
|
|
3397
|
+
self.maxbox[axis] = NXSpinBox(self.set_limits)
|
|
3398
|
+
grid.addWidget(self.label(self.plotview.axis[axis].name), row, 0)
|
|
3399
|
+
grid.addWidget(self.minbox[axis], row, 1)
|
|
3400
|
+
grid.addWidget(self.maxbox[axis], row, 2)
|
|
3401
|
+
|
|
3388
3402
|
self.set_layout(
|
|
3403
|
+
grid, self.checkboxes(("hide", "Hide Limits", False)),
|
|
3389
3404
|
self.textboxes(('Scan', '')),
|
|
3390
3405
|
self.action_buttons(('Select Scan', self.select_scan),
|
|
3391
3406
|
('Select Files', self.select_files)),
|
|
3392
3407
|
self.action_buttons(('Plot', self.plot_scan),
|
|
3393
3408
|
('Copy', self.copy_scan),
|
|
3394
3409
|
('Save', self.save_scan)))
|
|
3410
|
+
self.checkbox["hide"].stateChanged.connect(self.hide_rectangle)
|
|
3395
3411
|
self.file_box = None
|
|
3396
3412
|
self.scan_files = None
|
|
3397
3413
|
self.scan_values = None
|
|
3398
3414
|
self.scan_data = None
|
|
3415
|
+
self.scan_root = None
|
|
3399
3416
|
self.files = None
|
|
3417
|
+
self.initialize()
|
|
3418
|
+
self._rectangle = None
|
|
3419
|
+
|
|
3420
|
+
def initialize(self):
|
|
3421
|
+
"""
|
|
3422
|
+
Initialize the projection limits and copy widgets.
|
|
3423
|
+
|
|
3424
|
+
This function is called when the dialog is first created and
|
|
3425
|
+
after the data has been changed. It sets the minimum and maximum
|
|
3426
|
+
limits to the centers of the data and sets the current limits to
|
|
3427
|
+
the current limits of the plot. The copy widgets are also
|
|
3428
|
+
updated to reflect the current state of the other tabs.
|
|
3429
|
+
"""
|
|
3430
|
+
for axis in range(self.plotview.ndim):
|
|
3431
|
+
self.minbox[axis].data = self.maxbox[axis].data = \
|
|
3432
|
+
self.plotview.axis[axis].centers
|
|
3433
|
+
self.minbox[axis].setMaximum(self.minbox[axis].data.size-1)
|
|
3434
|
+
self.maxbox[axis].setMaximum(self.maxbox[axis].data.size-1)
|
|
3435
|
+
self.block_signals(True)
|
|
3436
|
+
self.minbox[axis].setValue(self.plotview.axis[axis].lo)
|
|
3437
|
+
self.maxbox[axis].setValue(self.plotview.axis[axis].hi)
|
|
3438
|
+
self.block_signals(False)
|
|
3400
3439
|
|
|
3401
3440
|
def select_scan(self):
|
|
3402
3441
|
"""
|
|
3403
3442
|
Set the scan axis of the dialog to the currently selected node.
|
|
3404
3443
|
|
|
3405
3444
|
The currently selected node must be a scalar NXfield. If the
|
|
3406
|
-
selected node is not a scalar NXfield, a NeXusError is raised
|
|
3407
|
-
reported.
|
|
3445
|
+
selected node is not a scalar NXfield, a NeXusError is raised
|
|
3446
|
+
and reported.
|
|
3408
3447
|
"""
|
|
3409
3448
|
scan_axis = self.treeview.node
|
|
3410
3449
|
if not isinstance(scan_axis, NXfield):
|
|
@@ -3418,13 +3457,14 @@ class ScanTab(NXTab):
|
|
|
3418
3457
|
"""
|
|
3419
3458
|
Create a dialog to select files to plot.
|
|
3420
3459
|
|
|
3421
|
-
The dialog will show a list of files with checkboxes. The list
|
|
3422
|
-
files is determined by the data_path argument passed to the
|
|
3460
|
+
The dialog will show a list of files with checkboxes. The list
|
|
3461
|
+
of files is determined by the data_path argument passed to the
|
|
3423
3462
|
constructor. The list of files is filtered to only include files
|
|
3424
|
-
that have a scan axis with the scan_path argument. If no
|
|
3425
|
-
argument is provided, all files are included. The
|
|
3426
|
-
allows the user to select a prefix for the files.
|
|
3427
|
-
files are returned as a list of (file name, scan
|
|
3463
|
+
that have a scan axis with the scan_path argument. If no
|
|
3464
|
+
scan_path argument is provided, all files are included. The
|
|
3465
|
+
dialog also allows the user to select a prefix for the files.
|
|
3466
|
+
The selected files are returned as a list of (file name, scan
|
|
3467
|
+
value) tuples.
|
|
3428
3468
|
"""
|
|
3429
3469
|
if self.file_box in self.mainwindow.dialogs:
|
|
3430
3470
|
try:
|
|
@@ -3503,6 +3543,58 @@ class ScanTab(NXTab):
|
|
|
3503
3543
|
else:
|
|
3504
3544
|
self.files[f].value = ''
|
|
3505
3545
|
|
|
3546
|
+
def get_axes(self):
|
|
3547
|
+
"""Return a list of NXfields containing the data axes."""
|
|
3548
|
+
return self.plotview.xtab.get_axes()
|
|
3549
|
+
|
|
3550
|
+
def set_limits(self):
|
|
3551
|
+
"""Plot the limits rectangle when the axis limits change."""
|
|
3552
|
+
self.scan_data = None
|
|
3553
|
+
self.draw_rectangle()
|
|
3554
|
+
|
|
3555
|
+
def get_limits(self, axis=None):
|
|
3556
|
+
"""
|
|
3557
|
+
Return the limits of the plot for the given axis.
|
|
3558
|
+
|
|
3559
|
+
Parameters
|
|
3560
|
+
----------
|
|
3561
|
+
axis : int or None
|
|
3562
|
+
The axis for which to return the limits. If None, return the
|
|
3563
|
+
limits for all axes.
|
|
3564
|
+
|
|
3565
|
+
Returns
|
|
3566
|
+
-------
|
|
3567
|
+
limits : list of tuples of int
|
|
3568
|
+
The limits of the plot for the given axis or axes. Each
|
|
3569
|
+
tuple is a pair of start and stop indices.
|
|
3570
|
+
"""
|
|
3571
|
+
def get_indices(minbox, maxbox):
|
|
3572
|
+
start, stop = minbox.index, maxbox.index+1
|
|
3573
|
+
if minbox.reversed:
|
|
3574
|
+
start, stop = len(maxbox.data)-stop, len(minbox.data)-start
|
|
3575
|
+
return start, stop
|
|
3576
|
+
if axis:
|
|
3577
|
+
return get_indices(self.minbox[axis], self.maxbox[axis])
|
|
3578
|
+
else:
|
|
3579
|
+
return [get_indices(self.minbox[axis], self.maxbox[axis])
|
|
3580
|
+
for axis in range(self.plotview.ndim)]
|
|
3581
|
+
|
|
3582
|
+
def get_slice(self):
|
|
3583
|
+
"""
|
|
3584
|
+
Return a tuple of slice objects for the axes of the data.
|
|
3585
|
+
|
|
3586
|
+
The slice objects are generated from the limits boxes. The
|
|
3587
|
+
start and stop indices of each slice are the start and stop
|
|
3588
|
+
values of the corresponding limits box, respectively.
|
|
3589
|
+
|
|
3590
|
+
Returns
|
|
3591
|
+
-------
|
|
3592
|
+
slice : tuple of slice objects
|
|
3593
|
+
A tuple of slice objects for the axes of the data.
|
|
3594
|
+
"""
|
|
3595
|
+
idx = self.get_limits()
|
|
3596
|
+
return tuple(slice(start, stop) for (start, stop) in idx)
|
|
3597
|
+
|
|
3506
3598
|
@property
|
|
3507
3599
|
def data_path(self):
|
|
3508
3600
|
"""Return the path to the data to be plotted."""
|
|
@@ -3544,10 +3636,23 @@ class ScanTab(NXTab):
|
|
|
3544
3636
|
for f in self.files if self.files[f].vary]
|
|
3545
3637
|
self.scan_values = [self.files[f].value for f in self.files
|
|
3546
3638
|
if self.files[f].vary]
|
|
3547
|
-
self.
|
|
3548
|
-
self.scan_path)
|
|
3639
|
+
self.create_scan_data()
|
|
3549
3640
|
except Exception:
|
|
3550
|
-
|
|
3641
|
+
report_error("Choosing Scan Files", "Files not selected")
|
|
3642
|
+
|
|
3643
|
+
def create_scan_data(self):
|
|
3644
|
+
"""Create the consolidated scan data."""
|
|
3645
|
+
self.scan_data = nxconsolidate(self.scan_files, self.data_path,
|
|
3646
|
+
self.scan_path, idx=self.get_slice())
|
|
3647
|
+
try:
|
|
3648
|
+
if Path(self.scan_root.nxfilename).exists():
|
|
3649
|
+
Path(self.scan_root.nxfilename).unlink()
|
|
3650
|
+
except Exception:
|
|
3651
|
+
pass
|
|
3652
|
+
import tempfile
|
|
3653
|
+
with nxload(tempfile.mkstemp(suffix='.nxs')[1], mode='w') as root:
|
|
3654
|
+
root['data'] = self.scan_data
|
|
3655
|
+
self.scan_root = root
|
|
3551
3656
|
|
|
3552
3657
|
def plot_scan(self):
|
|
3553
3658
|
"""
|
|
@@ -3561,6 +3666,8 @@ class ScanTab(NXTab):
|
|
|
3561
3666
|
NeXusError
|
|
3562
3667
|
If the data cannot be plotted.
|
|
3563
3668
|
"""
|
|
3669
|
+
if self.scan_data is None:
|
|
3670
|
+
self.create_scan_data()
|
|
3564
3671
|
try:
|
|
3565
3672
|
self.scanview.plot(self.scan_data)
|
|
3566
3673
|
self.scanview.make_active()
|
|
@@ -3580,6 +3687,8 @@ class ScanTab(NXTab):
|
|
|
3580
3687
|
NeXusError
|
|
3581
3688
|
If the data cannot be copied.
|
|
3582
3689
|
"""
|
|
3690
|
+
if self.scan_data is None:
|
|
3691
|
+
self.create_scan_data()
|
|
3583
3692
|
try:
|
|
3584
3693
|
self.mainwindow.copied_node = self.mainwindow.copy_node(
|
|
3585
3694
|
self.scan_data)
|
|
@@ -3598,6 +3707,8 @@ class ScanTab(NXTab):
|
|
|
3598
3707
|
NeXusError
|
|
3599
3708
|
If the data cannot be saved.
|
|
3600
3709
|
"""
|
|
3710
|
+
if self.scan_data is None:
|
|
3711
|
+
self.create_scan_data()
|
|
3601
3712
|
try:
|
|
3602
3713
|
keep_data(self.scan_data)
|
|
3603
3714
|
except NeXusError as error:
|
|
@@ -3612,6 +3723,116 @@ class ScanTab(NXTab):
|
|
|
3612
3723
|
from .plotview import NXPlotView
|
|
3613
3724
|
return NXPlotView('Scan')
|
|
3614
3725
|
|
|
3726
|
+
def block_signals(self, block=True):
|
|
3727
|
+
"""
|
|
3728
|
+
Block signals from the limits boxes.
|
|
3729
|
+
|
|
3730
|
+
Parameters
|
|
3731
|
+
----------
|
|
3732
|
+
block : bool
|
|
3733
|
+
True to block signals, False to unblock signals
|
|
3734
|
+
"""
|
|
3735
|
+
for axis in range(self.plotview.ndim):
|
|
3736
|
+
self.minbox[axis].blockSignals(block)
|
|
3737
|
+
self.maxbox[axis].blockSignals(block)
|
|
3738
|
+
|
|
3739
|
+
@property
|
|
3740
|
+
def rectangle(self):
|
|
3741
|
+
"""The rectangle defining the projection limits."""
|
|
3742
|
+
if self._rectangle not in self.plotview.ax.patches:
|
|
3743
|
+
self._rectangle = NXpolygon(self.get_rectangle(), closed=True,
|
|
3744
|
+
plotview=self.plotview).shape
|
|
3745
|
+
self._rectangle.set_edgecolor(self.plotview._gridcolor)
|
|
3746
|
+
self._rectangle.set_facecolor('none')
|
|
3747
|
+
self._rectangle.set_linestyle('dashed')
|
|
3748
|
+
self._rectangle.set_linewidth(2)
|
|
3749
|
+
return self._rectangle
|
|
3750
|
+
|
|
3751
|
+
def get_rectangle(self):
|
|
3752
|
+
"""
|
|
3753
|
+
Return the coordinates of the rectangle.
|
|
3754
|
+
|
|
3755
|
+
The coordinates are returned as a list of four tuples, each
|
|
3756
|
+
tuple containing the x and y coordinates of a vertex of the
|
|
3757
|
+
rectangle. If the plot is skewed, the coordinates are
|
|
3758
|
+
transformed to the skewed coordinates.
|
|
3759
|
+
"""
|
|
3760
|
+
xp = self.plotview.xaxis.dim
|
|
3761
|
+
yp = self.plotview.yaxis.dim
|
|
3762
|
+
x0 = self.minbox[xp].minBoundaryValue(self.minbox[xp].index)
|
|
3763
|
+
x1 = self.maxbox[xp].maxBoundaryValue(self.maxbox[xp].index)
|
|
3764
|
+
y0 = self.minbox[yp].minBoundaryValue(self.minbox[yp].index)
|
|
3765
|
+
y1 = self.maxbox[yp].maxBoundaryValue(self.maxbox[yp].index)
|
|
3766
|
+
xy = [(x0, y0), (x0, y1), (x1, y1), (x1, y0)]
|
|
3767
|
+
if self.plotview.skew is not None:
|
|
3768
|
+
return [self.plotview.transform(_x, _y) for _x, _y in xy]
|
|
3769
|
+
else:
|
|
3770
|
+
return xy
|
|
3771
|
+
|
|
3772
|
+
def draw_rectangle(self):
|
|
3773
|
+
"""
|
|
3774
|
+
Redraw the rectangle in the plot based on the current limits.
|
|
3775
|
+
|
|
3776
|
+
Notes
|
|
3777
|
+
-----
|
|
3778
|
+
The coordinates of the rectangle are obtained from the limits of
|
|
3779
|
+
the x and y axes. If the plot is skewed, the coordinates are
|
|
3780
|
+
transformed to the skewed coordinates.
|
|
3781
|
+
"""
|
|
3782
|
+
self.rectangle.set_xy(self.get_rectangle())
|
|
3783
|
+
self.plotview.draw()
|
|
3784
|
+
|
|
3785
|
+
def rectangle_visible(self):
|
|
3786
|
+
"""
|
|
3787
|
+
Return True if the rectangle defining the projection limits
|
|
3788
|
+
should be visible.
|
|
3789
|
+
|
|
3790
|
+
The rectangle is visible unless the 'Hide Limits' checkbox is
|
|
3791
|
+
checked.
|
|
3792
|
+
"""
|
|
3793
|
+
return not self.checkbox["hide"].isChecked()
|
|
3794
|
+
|
|
3795
|
+
def hide_rectangle(self):
|
|
3796
|
+
"""
|
|
3797
|
+
Hide or show the rectangle defining the projection limits based
|
|
3798
|
+
on the 'Hide Limits' checkbox.
|
|
3799
|
+
|
|
3800
|
+
If the checkbox is checked, hide the rectangle. Otherwise, show
|
|
3801
|
+
it.
|
|
3802
|
+
"""
|
|
3803
|
+
if self.checkbox["hide"].isChecked():
|
|
3804
|
+
self.rectangle.set_visible(False)
|
|
3805
|
+
else:
|
|
3806
|
+
self.rectangle.set_visible(True)
|
|
3807
|
+
self.plotview.draw()
|
|
3808
|
+
|
|
3809
|
+
def update(self):
|
|
3810
|
+
"""
|
|
3811
|
+
Update the limits boxes and the rectangle in the plot based on
|
|
3812
|
+
the current limits of the axes.
|
|
3813
|
+
|
|
3814
|
+
Notes
|
|
3815
|
+
-----
|
|
3816
|
+
If the limits of the x or y axes have changed, the limits boxes
|
|
3817
|
+
are updated to reflect the new limits. The rectangle is then
|
|
3818
|
+
redrawn based on the updated limits.
|
|
3819
|
+
"""
|
|
3820
|
+
self.block_signals(True)
|
|
3821
|
+
for axis in range(self.plotview.ndim):
|
|
3822
|
+
lo, hi = self.plotview.axis[axis].get_limits()
|
|
3823
|
+
minbox, maxbox = self.minbox[axis], self.maxbox[axis]
|
|
3824
|
+
ilo, ihi = minbox.indexFromValue(lo), maxbox.indexFromValue(hi)
|
|
3825
|
+
if (self.plotview.axis[axis] is self.plotview.xaxis or
|
|
3826
|
+
self.plotview.axis[axis] is self.plotview.yaxis):
|
|
3827
|
+
ilo = ilo + 1
|
|
3828
|
+
ihi = max(ilo, ihi-1)
|
|
3829
|
+
if lo > minbox.value():
|
|
3830
|
+
minbox.setValue(minbox.valueFromIndex(ilo))
|
|
3831
|
+
if hi < maxbox.value():
|
|
3832
|
+
maxbox.setValue(maxbox.valueFromIndex(ihi))
|
|
3833
|
+
self.block_signals(False)
|
|
3834
|
+
self.draw_rectangle()
|
|
3835
|
+
|
|
3615
3836
|
def close(self):
|
|
3616
3837
|
"""
|
|
3617
3838
|
Close the dialog.
|
|
@@ -3619,10 +3840,21 @@ class ScanTab(NXTab):
|
|
|
3619
3840
|
This will close the dialog and remove it from the list of
|
|
3620
3841
|
dialogs. It will also close the file dialog if it is open.
|
|
3621
3842
|
"""
|
|
3843
|
+
try:
|
|
3844
|
+
if Path(self.scan_root.nxfilename).exists():
|
|
3845
|
+
Path(self.scan_root.nxfilename).unlink()
|
|
3846
|
+
except Exception:
|
|
3847
|
+
pass
|
|
3622
3848
|
try:
|
|
3623
3849
|
self.file_box.close()
|
|
3624
3850
|
except Exception:
|
|
3625
3851
|
pass
|
|
3852
|
+
try:
|
|
3853
|
+
if self._rectangle:
|
|
3854
|
+
self._rectangle.remove()
|
|
3855
|
+
self.plotview.draw()
|
|
3856
|
+
except Exception:
|
|
3857
|
+
pass
|
|
3626
3858
|
super().close()
|
|
3627
3859
|
|
|
3628
3860
|
|
|
@@ -4115,7 +4347,7 @@ class ValidateTab(NXTab):
|
|
|
4115
4347
|
self.pushbutton['Validate Entry'].setVisible(False)
|
|
4116
4348
|
self.application_box = None
|
|
4117
4349
|
|
|
4118
|
-
self.text_box =
|
|
4350
|
+
self.text_box = NXTextEdit()
|
|
4119
4351
|
self.text_box.setMinimumWidth(800)
|
|
4120
4352
|
self.text_box.setMinimumHeight(600)
|
|
4121
4353
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
@@ -4201,12 +4433,16 @@ class ValidateTab(NXTab):
|
|
|
4201
4433
|
True and the Check Base Class and Inspect Base Class buttons to
|
|
4202
4434
|
False.
|
|
4203
4435
|
"""
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4436
|
+
try:
|
|
4437
|
+
self.node.validate(level=self.log_level,
|
|
4438
|
+
application=self.application,
|
|
4439
|
+
definitions=self.definitions)
|
|
4440
|
+
self.show_log()
|
|
4441
|
+
for button in ['Check Base Class', 'Inspect Base Class']:
|
|
4442
|
+
self.pushbutton[button].setChecked(False)
|
|
4443
|
+
except NeXusError as error:
|
|
4444
|
+
report_error("Validating Entry", error)
|
|
4445
|
+
self.pushbutton['Validate Entry'].setChecked(False)
|
|
4210
4446
|
|
|
4211
4447
|
def check(self):
|
|
4212
4448
|
"""
|
|
@@ -5301,23 +5537,27 @@ class LogDialog(NXDialog):
|
|
|
5301
5537
|
|
|
5302
5538
|
self.log_directory = self.mainwindow.nexpy_dir
|
|
5303
5539
|
|
|
5304
|
-
self.text_box =
|
|
5540
|
+
self.text_box = NXTextEdit()
|
|
5305
5541
|
self.text_box.setMinimumWidth(800)
|
|
5306
5542
|
self.text_box.setMinimumHeight(600)
|
|
5307
5543
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
5308
5544
|
self.text_box.setReadOnly(True)
|
|
5545
|
+
|
|
5546
|
+
self.switch_box = NXCheckBox('Switch Light/Dark Mode',
|
|
5547
|
+
self.switch_mode)
|
|
5309
5548
|
self.file_combo = NXComboBox(self.show_log)
|
|
5310
5549
|
for file_name in self.get_filesindirectory(
|
|
5311
5550
|
'nexpy', extension='.log*', directory=self.log_directory):
|
|
5312
5551
|
self.file_combo.add(file_name.name)
|
|
5313
5552
|
self.file_combo.select('nexpy.log')
|
|
5314
5553
|
self.issue_button = NXPushButton('Open NeXpy Issue', self.open_issue)
|
|
5315
|
-
footer_layout = self.make_layout(self.
|
|
5316
|
-
'stretch',
|
|
5554
|
+
footer_layout = self.make_layout(self.switch_box, 'stretch',
|
|
5317
5555
|
self.file_combo, 'stretch',
|
|
5556
|
+
self.issue_button,
|
|
5318
5557
|
self.close_buttons(close=True),
|
|
5319
5558
|
align='justified')
|
|
5320
|
-
self.set_layout(self.text_box,
|
|
5559
|
+
self.set_layout(self.search_layout(self.text_box, 'Search Log...'),
|
|
5560
|
+
self.text_box, footer_layout)
|
|
5321
5561
|
|
|
5322
5562
|
self.show_log()
|
|
5323
5563
|
|
|
@@ -5344,6 +5584,8 @@ class LogDialog(NXDialog):
|
|
|
5344
5584
|
top of the window stack, and give it focus.
|
|
5345
5585
|
"""
|
|
5346
5586
|
self.format_log()
|
|
5587
|
+
self.text_box.verticalScrollBar().setValue(
|
|
5588
|
+
self.text_box.verticalScrollBar().maximum())
|
|
5347
5589
|
self.setVisible(True)
|
|
5348
5590
|
self.raise_()
|
|
5349
5591
|
self.activateWindow()
|
|
@@ -5358,12 +5600,22 @@ class LogDialog(NXDialog):
|
|
|
5358
5600
|
messages. The window title is also set to the name of the log
|
|
5359
5601
|
file.
|
|
5360
5602
|
"""
|
|
5603
|
+
switch = self.switch_box.isChecked()
|
|
5361
5604
|
with open(self.file_name, 'r') as f:
|
|
5362
|
-
self.text_box.setText(convertHTML(f.read()))
|
|
5363
|
-
self.text_box.verticalScrollBar().setValue(
|
|
5364
|
-
self.text_box.verticalScrollBar().maximum())
|
|
5605
|
+
self.text_box.setText(convertHTML(f.read(), switch=switch))
|
|
5365
5606
|
self.setWindowTitle(f"Log File: {self.file_name}")
|
|
5366
5607
|
|
|
5608
|
+
def switch_mode(self):
|
|
5609
|
+
"""
|
|
5610
|
+
Switch the log file between light and dark mode.
|
|
5611
|
+
|
|
5612
|
+
This method is called when the switch box is checked. It
|
|
5613
|
+
formats the log file and shows it in the dialog.
|
|
5614
|
+
"""
|
|
5615
|
+
scroll_position = self.text_box.verticalScrollBar().value()
|
|
5616
|
+
self.format_log()
|
|
5617
|
+
self.text_box.verticalScrollBar().setValue(scroll_position)
|
|
5618
|
+
|
|
5367
5619
|
def reject(self):
|
|
5368
5620
|
"""
|
|
5369
5621
|
Close the dialog and remove the reference to it from the main
|
|
@@ -5576,8 +5828,11 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5576
5828
|
if p not in self.plugins]:
|
|
5577
5829
|
try:
|
|
5578
5830
|
self.plugins[plugin] = load_plugin(plugin)
|
|
5579
|
-
except Exception
|
|
5580
|
-
|
|
5831
|
+
except Exception:
|
|
5832
|
+
self.plugins[plugin] = {'package': plugin,
|
|
5833
|
+
'menu': 'unavailable',
|
|
5834
|
+
'actions': [],
|
|
5835
|
+
'order': 'Disabled'}
|
|
5581
5836
|
|
|
5582
5837
|
self.grid = QtWidgets.QGridLayout()
|
|
5583
5838
|
self.grid.setSpacing(10)
|
|
@@ -5589,8 +5844,7 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5589
5844
|
self.grid.addWidget(label, 0, column)
|
|
5590
5845
|
self.grid.setColumnMinimumWidth(column, width[column])
|
|
5591
5846
|
column += 1
|
|
5592
|
-
|
|
5593
|
-
self.order_options = list(range(1, len(self.plugins)+1)) +['Disabled']
|
|
5847
|
+
self.order_options = list(range(1, len(self.plugins)+1)) + ['Disabled']
|
|
5594
5848
|
for row, plugin in enumerate(self.plugins):
|
|
5595
5849
|
p = self.plugins[plugin]
|
|
5596
5850
|
self.grid.addWidget(NXLabel(p['package']), row+1, 0)
|
|
@@ -5604,14 +5858,30 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5604
5858
|
|
|
5605
5859
|
def update_plugins(self):
|
|
5606
5860
|
"""
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5861
|
+
Update the plugin order.
|
|
5862
|
+
|
|
5863
|
+
The order of the plugins is updated by reading the values from
|
|
5864
|
+
the grid of widgets. The order is checked to ensure that it is
|
|
5865
|
+
unique and sequential, and an error is raised if it is not. If a
|
|
5866
|
+
plugin is unavailable, the order is set to 'Disabled' and the
|
|
5867
|
+
selection is reset.
|
|
5610
5868
|
"""
|
|
5611
5869
|
for row, plugin in enumerate(self.plugins):
|
|
5612
|
-
|
|
5613
|
-
order =
|
|
5614
|
-
|
|
5870
|
+
order_combo = self.grid.itemAtPosition(row+1, 2).widget()
|
|
5871
|
+
order = order_combo.selected
|
|
5872
|
+
if order == 'Disabled':
|
|
5873
|
+
self.plugins[plugin]['order'] = 'Disabled'
|
|
5874
|
+
else:
|
|
5875
|
+
if self.plugins[plugin]['menu'] == 'unavailable':
|
|
5876
|
+
try:
|
|
5877
|
+
self.plugins[plugin] = load_plugin(plugin)
|
|
5878
|
+
except Exception as error:
|
|
5879
|
+
self.plugins[plugin]['order'] = 'Disabled'
|
|
5880
|
+
order_combo.select('Disabled')
|
|
5881
|
+
raise NeXusError(
|
|
5882
|
+
f"Plugin '{plugin}' could not be loaded\n{error}")
|
|
5883
|
+
else:
|
|
5884
|
+
self.plugins[plugin]['order'] = order
|
|
5615
5885
|
order_set = [int(p['order']) for p in self.plugins.values()
|
|
5616
5886
|
if p['order'] != 'Disabled']
|
|
5617
5887
|
if sorted(order_set) != list(range(1, len(order_set)+1)):
|