NeXpy 2.0.0b5__tar.gz → 2.0.0b6__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.0b6}/PKG-INFO +1 -1
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/PKG-INFO +1 -1
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/_version.py +2 -2
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/dialogs.py +61 -42
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/fitdialogs.py +45 -26
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/mainwindow.py +72 -15
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/plotview.py +5 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/scripteditor.py +15 -108
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/utils.py +116 -30
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/widgets.py +267 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/readers/readtxt.py +2 -3
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/.gitattributes +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/.github/dependabot.yaml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/.github/workflows/ci.yml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/.gitignore +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/COPYING +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/README.md +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/conda-recipe/bld.bat +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/conda-recipe/build.sh +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/conda-recipe/meta.yaml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/Makefile +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/make.bat +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/_static/__ignore__.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/conf.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/examples.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/favicon.ico +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/axis-limits-bar.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/customize-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/limits-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/nexpy-fits.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/nexpy-gui.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/nexpy-logo.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/options-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/projection-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/projection-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/scan-panel.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/signal-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/simple-plot.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/skewed-axis.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/x-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/y-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/z-tab.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/images/z-toolbar.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/includeme.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/index.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/pythongui.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/pythonshell.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/readers.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/doc/source/treeapi.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/pyproject.toml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/setup.cfg +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/SOURCES.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/dependency_links.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/entry_points.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/pbr.json +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/requires.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/NeXpy.egg-info/top_level.txt +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/chopper.nxs +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/example.nxs +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/README.rst +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/example.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/__init__.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/consoleapp.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/datadialogs.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/importdialog.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/pyqt.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/NeXpy.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/NeXpy.svg +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/back.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/backward-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/customize.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/equal.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/export-data.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/export-figure.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/filesave.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/forward-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/forward.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/hand.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/home.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/link-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/lock-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/modify-style.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/move.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/pause-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/refresh-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/unlock-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/gui/treeview.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/models/bose.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/models/critexp.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/models/op.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/models/pdfdecay.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/nexpygui.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/readers/readnpy.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/readers/readspec.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/readers/readstack.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/src/nexpy/readers/readtiff.py +0 -0
- {nexpy-2.0.0b5 → nexpy-2.0.0b6}/tests/test_imports.py +0 -0
|
@@ -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.0b6'
|
|
21
|
+
__version_tuple__ = version_tuple = (2, 0, 0, 'b6')
|
|
@@ -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):
|
|
@@ -4115,7 +4108,7 @@ class ValidateTab(NXTab):
|
|
|
4115
4108
|
self.pushbutton['Validate Entry'].setVisible(False)
|
|
4116
4109
|
self.application_box = None
|
|
4117
4110
|
|
|
4118
|
-
self.text_box =
|
|
4111
|
+
self.text_box = NXTextEdit()
|
|
4119
4112
|
self.text_box.setMinimumWidth(800)
|
|
4120
4113
|
self.text_box.setMinimumHeight(600)
|
|
4121
4114
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
@@ -4201,12 +4194,16 @@ class ValidateTab(NXTab):
|
|
|
4201
4194
|
True and the Check Base Class and Inspect Base Class buttons to
|
|
4202
4195
|
False.
|
|
4203
4196
|
"""
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4197
|
+
try:
|
|
4198
|
+
self.node.validate(level=self.log_level,
|
|
4199
|
+
application=self.application,
|
|
4200
|
+
definitions=self.definitions)
|
|
4201
|
+
self.show_log()
|
|
4202
|
+
for button in ['Check Base Class', 'Inspect Base Class']:
|
|
4203
|
+
self.pushbutton[button].setChecked(False)
|
|
4204
|
+
except NeXusError as error:
|
|
4205
|
+
report_error("Validating Entry", error)
|
|
4206
|
+
self.pushbutton['Validate Entry'].setChecked(False)
|
|
4210
4207
|
|
|
4211
4208
|
def check(self):
|
|
4212
4209
|
"""
|
|
@@ -5301,23 +5298,27 @@ class LogDialog(NXDialog):
|
|
|
5301
5298
|
|
|
5302
5299
|
self.log_directory = self.mainwindow.nexpy_dir
|
|
5303
5300
|
|
|
5304
|
-
self.text_box =
|
|
5301
|
+
self.text_box = NXTextEdit()
|
|
5305
5302
|
self.text_box.setMinimumWidth(800)
|
|
5306
5303
|
self.text_box.setMinimumHeight(600)
|
|
5307
5304
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
5308
5305
|
self.text_box.setReadOnly(True)
|
|
5306
|
+
|
|
5307
|
+
self.switch_box = NXCheckBox('Switch Light/Dark Mode',
|
|
5308
|
+
self.switch_mode)
|
|
5309
5309
|
self.file_combo = NXComboBox(self.show_log)
|
|
5310
5310
|
for file_name in self.get_filesindirectory(
|
|
5311
5311
|
'nexpy', extension='.log*', directory=self.log_directory):
|
|
5312
5312
|
self.file_combo.add(file_name.name)
|
|
5313
5313
|
self.file_combo.select('nexpy.log')
|
|
5314
5314
|
self.issue_button = NXPushButton('Open NeXpy Issue', self.open_issue)
|
|
5315
|
-
footer_layout = self.make_layout(self.
|
|
5316
|
-
'stretch',
|
|
5315
|
+
footer_layout = self.make_layout(self.switch_box, 'stretch',
|
|
5317
5316
|
self.file_combo, 'stretch',
|
|
5317
|
+
self.issue_button,
|
|
5318
5318
|
self.close_buttons(close=True),
|
|
5319
5319
|
align='justified')
|
|
5320
|
-
self.set_layout(self.text_box,
|
|
5320
|
+
self.set_layout(self.search_layout(self.text_box, 'Search Log...'),
|
|
5321
|
+
self.text_box, footer_layout)
|
|
5321
5322
|
|
|
5322
5323
|
self.show_log()
|
|
5323
5324
|
|
|
@@ -5344,6 +5345,8 @@ class LogDialog(NXDialog):
|
|
|
5344
5345
|
top of the window stack, and give it focus.
|
|
5345
5346
|
"""
|
|
5346
5347
|
self.format_log()
|
|
5348
|
+
self.text_box.verticalScrollBar().setValue(
|
|
5349
|
+
self.text_box.verticalScrollBar().maximum())
|
|
5347
5350
|
self.setVisible(True)
|
|
5348
5351
|
self.raise_()
|
|
5349
5352
|
self.activateWindow()
|
|
@@ -5358,12 +5361,22 @@ class LogDialog(NXDialog):
|
|
|
5358
5361
|
messages. The window title is also set to the name of the log
|
|
5359
5362
|
file.
|
|
5360
5363
|
"""
|
|
5364
|
+
switch = self.switch_box.isChecked()
|
|
5361
5365
|
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())
|
|
5366
|
+
self.text_box.setText(convertHTML(f.read(), switch=switch))
|
|
5365
5367
|
self.setWindowTitle(f"Log File: {self.file_name}")
|
|
5366
5368
|
|
|
5369
|
+
def switch_mode(self):
|
|
5370
|
+
"""
|
|
5371
|
+
Switch the log file between light and dark mode.
|
|
5372
|
+
|
|
5373
|
+
This method is called when the switch box is checked. It
|
|
5374
|
+
formats the log file and shows it in the dialog.
|
|
5375
|
+
"""
|
|
5376
|
+
scroll_position = self.text_box.verticalScrollBar().value()
|
|
5377
|
+
self.format_log()
|
|
5378
|
+
self.text_box.verticalScrollBar().setValue(scroll_position)
|
|
5379
|
+
|
|
5367
5380
|
def reject(self):
|
|
5368
5381
|
"""
|
|
5369
5382
|
Close the dialog and remove the reference to it from the main
|
|
@@ -5577,7 +5590,9 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5577
5590
|
try:
|
|
5578
5591
|
self.plugins[plugin] = load_plugin(plugin)
|
|
5579
5592
|
except Exception as error:
|
|
5580
|
-
|
|
5593
|
+
self.plugins[plugin] = {'package': plugin,
|
|
5594
|
+
'menu': 'unavailable',
|
|
5595
|
+
'order': 'Disabled'}
|
|
5581
5596
|
|
|
5582
5597
|
self.grid = QtWidgets.QGridLayout()
|
|
5583
5598
|
self.grid.setSpacing(10)
|
|
@@ -5589,8 +5604,7 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5589
5604
|
self.grid.addWidget(label, 0, column)
|
|
5590
5605
|
self.grid.setColumnMinimumWidth(column, width[column])
|
|
5591
5606
|
column += 1
|
|
5592
|
-
|
|
5593
|
-
self.order_options = list(range(1, len(self.plugins)+1)) +['Disabled']
|
|
5607
|
+
self.order_options = list(range(1, len(self.plugins)+1)) + ['Disabled']
|
|
5594
5608
|
for row, plugin in enumerate(self.plugins):
|
|
5595
5609
|
p = self.plugins[plugin]
|
|
5596
5610
|
self.grid.addWidget(NXLabel(p['package']), row+1, 0)
|
|
@@ -5604,14 +5618,19 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5604
5618
|
|
|
5605
5619
|
def update_plugins(self):
|
|
5606
5620
|
"""
|
|
5607
|
-
Set the order of plugins in the settings from the current dialog
|
|
5608
|
-
layout. Check that the order is unique and sequential,
|
|
5609
|
-
raise a NeXusError.
|
|
5621
|
+
Set the order of plugins in the settings from the current dialog
|
|
5622
|
+
box layout. Check that the order is unique and sequential,
|
|
5623
|
+
otherwise raise a NeXusError.
|
|
5610
5624
|
"""
|
|
5611
5625
|
for row, plugin in enumerate(self.plugins):
|
|
5612
5626
|
p = self.plugins[plugin]
|
|
5613
5627
|
order = self.grid.itemAtPosition(row+1, 2).widget().currentText()
|
|
5614
|
-
p['
|
|
5628
|
+
if order != 'Disabled' and p['menu'] == 'unavailable':
|
|
5629
|
+
p['order'] = 'Disabled'
|
|
5630
|
+
self.grid.itemAtPosition(row+1, 2).widget().select('Disabled')
|
|
5631
|
+
raise NeXusError(f"Plugin '{p['package']}' is unavailable")
|
|
5632
|
+
else:
|
|
5633
|
+
p['order'] = order
|
|
5615
5634
|
order_set = [int(p['order']) for p in self.plugins.values()
|
|
5616
5635
|
if p['order'] != 'Disabled']
|
|
5617
5636
|
if sorted(order_set) != list(range(1, len(order_set)+1)):
|
|
@@ -306,10 +306,11 @@ class FitTab(NXTab):
|
|
|
306
306
|
align='justified')
|
|
307
307
|
|
|
308
308
|
if self.plotview is None:
|
|
309
|
-
self.
|
|
310
|
-
|
|
311
|
-
self.
|
|
312
|
-
self.
|
|
309
|
+
self.plotview = NXPlotView('Fit')
|
|
310
|
+
self.plotview.plot(self._data, fmt='o', color=color)
|
|
311
|
+
self.data_num = self.plotview.num
|
|
312
|
+
self.data_label = self.plotview.plots[self.plotview.num]['label']
|
|
313
|
+
self.cursor = self.plotview.plots[self.plotview.num]['cursor']
|
|
313
314
|
if self.cursor:
|
|
314
315
|
@self.cursor.connect("add")
|
|
315
316
|
def add_selection(sel):
|
|
@@ -368,7 +369,7 @@ class FitTab(NXTab):
|
|
|
368
369
|
self.choose_model()
|
|
369
370
|
self.set_button_visibility()
|
|
370
371
|
|
|
371
|
-
self.cid = self.
|
|
372
|
+
self.cid = self.plotview.canvas.mpl_connect('button_release_event',
|
|
372
373
|
self.on_button_release)
|
|
373
374
|
self.composite_model = ''
|
|
374
375
|
self.composite_dialog = None
|
|
@@ -379,8 +380,8 @@ class FitTab(NXTab):
|
|
|
379
380
|
self.linestyles = [linestyles[ls] for ls in linestyles
|
|
380
381
|
if ls != 'Solid' and ls != 'None']
|
|
381
382
|
self.linestyle = cycle(self.linestyles)
|
|
382
|
-
self.xlo, self.xhi = self.
|
|
383
|
-
self.ylo, self.yhi = self.
|
|
383
|
+
self.xlo, self.xhi = self.plotview.ax.get_xlim()
|
|
384
|
+
self.ylo, self.yhi = self.plotview.ax.get_ylim()
|
|
384
385
|
|
|
385
386
|
if group:
|
|
386
387
|
self.load_fit(group)
|
|
@@ -392,12 +393,16 @@ class FitTab(NXTab):
|
|
|
392
393
|
def fitview(self):
|
|
393
394
|
"""The plotting window for the fitting data."""
|
|
394
395
|
if self.plotview and self.plotview.label in self.plotviews:
|
|
395
|
-
|
|
396
|
+
return self.plotview
|
|
396
397
|
elif 'Fit' in self.plotviews:
|
|
397
|
-
|
|
398
|
+
self.plotview = self.plotviews['Fit']
|
|
399
|
+
return self.plotview
|
|
398
400
|
else:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
return None
|
|
402
|
+
|
|
403
|
+
@fitview.setter
|
|
404
|
+
def fitview(self, plotview):
|
|
405
|
+
self.plotview = plotview
|
|
401
406
|
|
|
402
407
|
def initialize_data(self, data):
|
|
403
408
|
"""
|
|
@@ -1434,7 +1439,7 @@ class FitTab(NXTab):
|
|
|
1434
1439
|
A tuple of two floats, the minimum and maximum values of the
|
|
1435
1440
|
x-axis.
|
|
1436
1441
|
"""
|
|
1437
|
-
return self.
|
|
1442
|
+
return self.plotview.xtab.get_limits()
|
|
1438
1443
|
|
|
1439
1444
|
@property
|
|
1440
1445
|
def plot_min(self):
|
|
@@ -1457,19 +1462,18 @@ class FitTab(NXTab):
|
|
|
1457
1462
|
linestyles and plot the mask. Finally, raise the plotview to the
|
|
1458
1463
|
top.
|
|
1459
1464
|
"""
|
|
1460
|
-
if self.
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
for label in ['label', 'legend_label']:
|
|
1468
|
-
self.fitview.plots[self.fitview.num][label] = self.data_label
|
|
1469
|
-
self.remove_plots()
|
|
1465
|
+
if self.fitview is None:
|
|
1466
|
+
self.fitview = NXPlotView('Fit')
|
|
1467
|
+
self.fitview.plot(self._data, fmt='o', color=self.color)
|
|
1468
|
+
elif self.fitview.label == 'Fit':
|
|
1469
|
+
self.fitview.plot(self._data,
|
|
1470
|
+
xmin=self.plot_min, xmax=self.plot_max,
|
|
1471
|
+
color=self.color)
|
|
1470
1472
|
else:
|
|
1471
1473
|
self.fitview.plots[self.data_num]['plot'].set_color(self.color)
|
|
1472
|
-
|
|
1474
|
+
for label in ['label', 'legend_label']:
|
|
1475
|
+
self.fitview.plots[self.fitview.num][label] = self.data_label
|
|
1476
|
+
self.remove_plots()
|
|
1473
1477
|
self.linestyle = cycle(self.linestyles)
|
|
1474
1478
|
self.plot_mask()
|
|
1475
1479
|
self.fitview.raise_()
|
|
@@ -1484,6 +1488,8 @@ class FitTab(NXTab):
|
|
|
1484
1488
|
linestyles and plot the mask. Finally, raise the plotview to the
|
|
1485
1489
|
top.
|
|
1486
1490
|
"""
|
|
1491
|
+
if self.fitview is None:
|
|
1492
|
+
self.plot_data()
|
|
1487
1493
|
mask_data = self.signal_mask()
|
|
1488
1494
|
if mask_data:
|
|
1489
1495
|
if self.mask_num in self.fitview.plots:
|
|
@@ -1521,7 +1527,7 @@ class FitTab(NXTab):
|
|
|
1521
1527
|
dashed line. The model is plotted with a legend label that
|
|
1522
1528
|
includes the name of the tab and the name of the model.
|
|
1523
1529
|
"""
|
|
1524
|
-
if
|
|
1530
|
+
if self.fitview is None:
|
|
1525
1531
|
self.plot_data()
|
|
1526
1532
|
model_name = self.plot_combo.currentText()
|
|
1527
1533
|
if model is False:
|
|
@@ -1798,6 +1804,8 @@ class FitTab(NXTab):
|
|
|
1798
1804
|
progress, draw a rectangle with the zoom extent and make the
|
|
1799
1805
|
mask button visible. In either case, the plot window is redrawn.
|
|
1800
1806
|
"""
|
|
1807
|
+
if self.fitview is None:
|
|
1808
|
+
return
|
|
1801
1809
|
self.fitview.otab.release_zoom(event)
|
|
1802
1810
|
if event.button == 1:
|
|
1803
1811
|
self.remove_rectangle()
|
|
@@ -1818,6 +1826,8 @@ class FitTab(NXTab):
|
|
|
1818
1826
|
coordinates of the rectangle to the zoom extent and makes the
|
|
1819
1827
|
mask button visible. The plot window is then redrawn.
|
|
1820
1828
|
"""
|
|
1829
|
+
if self.fitview is None:
|
|
1830
|
+
return
|
|
1821
1831
|
x, dx = self.xlo, self.xhi-self.xlo
|
|
1822
1832
|
y, dy = self.ylo, self.yhi-self.ylo
|
|
1823
1833
|
if self.rectangle:
|
|
@@ -1838,6 +1848,8 @@ class FitTab(NXTab):
|
|
|
1838
1848
|
plot window. It removes any rectangle that was drawn and
|
|
1839
1849
|
redraws the plot window.
|
|
1840
1850
|
"""
|
|
1851
|
+
if self.fitview is None:
|
|
1852
|
+
return
|
|
1841
1853
|
if self.rectangle:
|
|
1842
1854
|
self.rectangle.remove()
|
|
1843
1855
|
self.rectangle = None
|
|
@@ -1851,6 +1863,8 @@ class FitTab(NXTab):
|
|
|
1851
1863
|
It removes the mask plot from the plot window and redraws the
|
|
1852
1864
|
plot window.
|
|
1853
1865
|
"""
|
|
1866
|
+
if self.fitview is None:
|
|
1867
|
+
return
|
|
1854
1868
|
if self.mask_num in self.fitview.plots:
|
|
1855
1869
|
self.fitview.plots[self.mask_num]['plot'].remove()
|
|
1856
1870
|
del self.fitview.plots[self.mask_num]
|
|
@@ -1865,6 +1879,8 @@ class FitTab(NXTab):
|
|
|
1865
1879
|
It removes any additional plots from the plot window and
|
|
1866
1880
|
redraws the plot window.
|
|
1867
1881
|
"""
|
|
1882
|
+
if self.fitview is None:
|
|
1883
|
+
return
|
|
1868
1884
|
for num in [n for n in self.plot_nums if n in self.fitview.plots]:
|
|
1869
1885
|
self.fitview.plots[num]['plot'].remove()
|
|
1870
1886
|
del self.fitview.plots[num]
|
|
@@ -1882,6 +1898,8 @@ class FitTab(NXTab):
|
|
|
1882
1898
|
when the 'Apply' button is clicked. The plot window is then
|
|
1883
1899
|
redrawn.
|
|
1884
1900
|
"""
|
|
1901
|
+
if self.fitview is None:
|
|
1902
|
+
return
|
|
1885
1903
|
self.remove_plots()
|
|
1886
1904
|
if self.model is not None:
|
|
1887
1905
|
self.fitview.plot(self.get_model(), fmt='-', color=self.color,
|
|
@@ -1894,10 +1912,11 @@ class FitTab(NXTab):
|
|
|
1894
1912
|
This method is called when the window is closed. It disconnects any
|
|
1895
1913
|
signal connections and removes any masks and plots from the plot window.
|
|
1896
1914
|
"""
|
|
1915
|
+
if self.fitview is None:
|
|
1916
|
+
return
|
|
1897
1917
|
self.fitview.canvas.mpl_disconnect(self.cid)
|
|
1898
1918
|
self.remove_masks()
|
|
1899
|
-
|
|
1900
|
-
self.remove_plots()
|
|
1919
|
+
self.remove_plots()
|
|
1901
1920
|
|
|
1902
1921
|
|
|
1903
1922
|
class CompositeDialog(NXDialog):
|
|
@@ -790,23 +790,37 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
790
790
|
|
|
791
791
|
self.window_menu.addSeparator()
|
|
792
792
|
|
|
793
|
-
self.
|
|
793
|
+
self.equalize_action = QtWidgets.QAction(
|
|
794
794
|
"Equalize Plot Sizes", self, shortcut=QtGui.QKeySequence(
|
|
795
795
|
"Ctrl+Shift+E"),
|
|
796
|
-
triggered=self.
|
|
797
|
-
self.add_menu_action(self.window_menu, self.
|
|
796
|
+
triggered=self.equalize_plots)
|
|
797
|
+
self.add_menu_action(self.window_menu, self.equalize_action)
|
|
798
|
+
|
|
799
|
+
self.window_menu.addSeparator()
|
|
800
|
+
|
|
801
|
+
self.cascade_action = QtWidgets.QAction(
|
|
802
|
+
"Cascade Plots", self, shortcut=QtGui.QKeySequence(
|
|
803
|
+
"Ctrl+Shift+Alt+C"),
|
|
804
|
+
triggered=self.cascade_plots)
|
|
805
|
+
self.add_menu_action(self.window_menu, self.cascade_action)
|
|
806
|
+
|
|
807
|
+
self.tile_action = QtWidgets.QAction(
|
|
808
|
+
"Tile Plots", self, shortcut=QtGui.QKeySequence(
|
|
809
|
+
"Ctrl+Shift+Alt+T"),
|
|
810
|
+
triggered=self.tile_plots)
|
|
811
|
+
self.add_menu_action(self.window_menu, self.tile_action)
|
|
798
812
|
|
|
799
813
|
self.window_menu.addSeparator()
|
|
800
814
|
|
|
801
815
|
self.active_action = {}
|
|
802
816
|
|
|
803
|
-
self.active_action[
|
|
804
|
-
'Main', self, shortcut=QtGui.QKeySequence("Ctrl+
|
|
805
|
-
triggered=lambda: self.make_active(
|
|
817
|
+
self.active_action[0] = QtWidgets.QAction(
|
|
818
|
+
'Main', self, shortcut=QtGui.QKeySequence("Ctrl+0"),
|
|
819
|
+
triggered=lambda: self.make_active(0),
|
|
806
820
|
checkable=True)
|
|
807
|
-
self.add_menu_action(self.window_menu, self.active_action[
|
|
808
|
-
self.active_action[
|
|
809
|
-
self.previous_active =
|
|
821
|
+
self.add_menu_action(self.window_menu, self.active_action[0])
|
|
822
|
+
self.active_action[0].setChecked(True)
|
|
823
|
+
self.previous_active = 0
|
|
810
824
|
|
|
811
825
|
self.window_separator = self.window_menu.addSeparator()
|
|
812
826
|
|
|
@@ -1055,13 +1069,12 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1055
1069
|
self, 'Choose Directory', directory)
|
|
1056
1070
|
if directory is None or not Path(directory).exists():
|
|
1057
1071
|
return
|
|
1058
|
-
tree_files = [
|
|
1059
|
-
for root in self.tree]
|
|
1072
|
+
tree_files = [self.tree[root].nxfilename for root in self.tree]
|
|
1060
1073
|
nxfiles = sorted([f.name for f in Path(directory).iterdir()
|
|
1061
1074
|
if (f.suffix.lower() in
|
|
1062
1075
|
('.nxs', '.nx5', '.h5', 'hdf5', 'hdf',
|
|
1063
1076
|
'.cxi', 'nxspe') and
|
|
1064
|
-
f not in tree_files and
|
|
1077
|
+
str(f) not in tree_files and
|
|
1065
1078
|
not f.is_symlink())],
|
|
1066
1079
|
key=natural_sort)
|
|
1067
1080
|
if len(nxfiles) == 0:
|
|
@@ -1237,8 +1250,14 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1237
1250
|
node = self.treeview.get_node()
|
|
1238
1251
|
name = node.nxname
|
|
1239
1252
|
if isinstance(node, NXroot):
|
|
1240
|
-
if
|
|
1241
|
-
|
|
1253
|
+
if node.nxfilename is None:
|
|
1254
|
+
warning = (f"This will delete '{name}' and cannot be "
|
|
1255
|
+
"undone. Save it to a file if you want to keep "
|
|
1256
|
+
"the data for future use.")
|
|
1257
|
+
else:
|
|
1258
|
+
warning = "This will remove it from the tree"
|
|
1259
|
+
if confirm_action(f"Are you sure you want to remove '{name}'?",
|
|
1260
|
+
information=warning):
|
|
1242
1261
|
del self.tree[name]
|
|
1243
1262
|
self.settings.remove_option('session', node.nxfilename)
|
|
1244
1263
|
self.settings.save()
|
|
@@ -2186,7 +2205,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
2186
2205
|
except Exception:
|
|
2187
2206
|
pass
|
|
2188
2207
|
|
|
2189
|
-
def
|
|
2208
|
+
def equalize_plots(self):
|
|
2190
2209
|
"""
|
|
2191
2210
|
Resize all plot windows except the main window and the currently
|
|
2192
2211
|
active window to the size of the currently active window.
|
|
@@ -2200,6 +2219,44 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
2200
2219
|
if (label != 'Main' and label != self.plotview.label)]:
|
|
2201
2220
|
self.plotviews[label].resize(self.plotview.size())
|
|
2202
2221
|
|
|
2222
|
+
def cascade_plots(self):
|
|
2223
|
+
"""Cascade plot windows across the available screen."""
|
|
2224
|
+
pvs = [self.plotviews[pv] for pv in self.plotviews]
|
|
2225
|
+
if len(pvs) <= 1:
|
|
2226
|
+
return
|
|
2227
|
+
available_geometry = self.app.app.primaryScreen().availableGeometry()
|
|
2228
|
+
last_left = available_geometry.right() - pvs[-1].width()
|
|
2229
|
+
last_top = available_geometry.bottom() - pvs[-1].height()
|
|
2230
|
+
offset_x = int((last_left - available_geometry.left()) / (len(pvs)-1))
|
|
2231
|
+
offset_y = int((last_top - available_geometry.top()) / (len(pvs)-1))
|
|
2232
|
+
left, top = available_geometry.left(), available_geometry.top()
|
|
2233
|
+
self.move(left, top)
|
|
2234
|
+
for pv in pvs[1:]:
|
|
2235
|
+
left += offset_x
|
|
2236
|
+
top += offset_y
|
|
2237
|
+
pv.move(left, top)
|
|
2238
|
+
pv.make_active()
|
|
2239
|
+
|
|
2240
|
+
def tile_plots(self):
|
|
2241
|
+
"""Tile plot windows across the available screen."""
|
|
2242
|
+
pvs = [self.plotviews[pv] for pv in self.plotviews if pv != 'Main']
|
|
2243
|
+
if len(pvs) <= 1:
|
|
2244
|
+
return
|
|
2245
|
+
available_geometry = self.app.app.primaryScreen().availableGeometry()
|
|
2246
|
+
left, top = available_geometry.left(), available_geometry.top()
|
|
2247
|
+
self.move(left, top)
|
|
2248
|
+
left += self.treeview.minimumWidth()
|
|
2249
|
+
pvs[0].move(left, top)
|
|
2250
|
+
for pv in pvs[1:]:
|
|
2251
|
+
left += pv.canvas.width()
|
|
2252
|
+
if left + pv.canvas.width() > available_geometry.right():
|
|
2253
|
+
left = available_geometry.left() + self.treeview.minimumWidth()
|
|
2254
|
+
top += pv.canvas.height()
|
|
2255
|
+
if top + pv.canvas.height() > available_geometry.bottom():
|
|
2256
|
+
top = available_geometry.top()
|
|
2257
|
+
pv.move(left, top)
|
|
2258
|
+
pv.make_active()
|
|
2259
|
+
|
|
2203
2260
|
def update_active(self, number):
|
|
2204
2261
|
"""
|
|
2205
2262
|
Update the active window in 'Window' menu.
|
|
@@ -141,7 +141,9 @@ def new_figure_manager(label=None, *args, **kwargs):
|
|
|
141
141
|
"""
|
|
142
142
|
if label is None:
|
|
143
143
|
label = ''
|
|
144
|
-
if label
|
|
144
|
+
if label == 'Main':
|
|
145
|
+
num = 0
|
|
146
|
+
elif label:
|
|
145
147
|
nums = [plotviews[p].number for p in plotviews
|
|
146
148
|
if plotviews[p].number > 100]
|
|
147
149
|
if nums:
|
|
@@ -618,8 +620,8 @@ class NXPlotView(QtWidgets.QDialog):
|
|
|
618
620
|
"""
|
|
619
621
|
Restore original signal connections.
|
|
620
622
|
|
|
621
|
-
This assumes a previous call to the deactivate function, which
|
|
622
|
-
current value of _active_mode.
|
|
623
|
+
This assumes a previous call to the deactivate function, which
|
|
624
|
+
sets the current value of _active_mode.
|
|
623
625
|
"""
|
|
624
626
|
if self._active_mode == 'zoom rect':
|
|
625
627
|
self.otab.zoom()
|