NeXpy 2.0.0b4__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.0b4 → nexpy-2.0.0b6}/PKG-INFO +1 -1
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/pyproject.toml +0 -1
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/PKG-INFO +1 -1
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/SOURCES.txt +4 -9
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/_version.py +2 -2
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/consoleapp.py +24 -33
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/dialogs.py +72 -46
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/fitdialogs.py +58 -54
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/mainwindow.py +122 -59
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/plotview.py +5 -3
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/scripteditor.py +21 -111
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/utils.py +209 -64
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/widgets.py +267 -3
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/readers/readspec.py +6 -7
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/readers/readtxt.py +2 -3
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/tests/test_imports.py +0 -7
- nexpy-2.0.0b4/src/nexpy/api/frills/__init__.py +0 -0
- nexpy-2.0.0b4/src/nexpy/api/frills/fit.py +0 -239
- nexpy-2.0.0b4/src/nexpy/api/frills/models/__init__.py +0 -0
- nexpy-2.0.0b4/src/nexpy/gui/__init__.py +0 -0
- nexpy-2.0.0b4/src/nexpy/readers/__init__.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/.gitattributes +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/.github/dependabot.yaml +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/.github/workflows/ci.yml +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/.gitignore +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/COPYING +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/README.md +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/README.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/conda-recipe/bld.bat +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/conda-recipe/build.sh +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/conda-recipe/meta.yaml +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/Makefile +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/make.bat +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/_static/__ignore__.txt +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/conf.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/examples.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/favicon.ico +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/axis-limits-bar.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/customize-panel.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/limits-panel.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/nexpy-fits.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/nexpy-gui.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/nexpy-logo.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/options-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/projection-panel.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/projection-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/scan-panel.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/signal-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/simple-plot.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/skewed-axis.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/x-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/y-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/z-tab.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/images/z-toolbar.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/includeme.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/index.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/pythongui.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/pythonshell.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/readers.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/doc/source/treeapi.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/setup.cfg +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/dependency_links.txt +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/entry_points.txt +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/pbr.json +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/requires.txt +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/NeXpy.egg-info/top_level.txt +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/__init__.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/README.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/chopper.nxs +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/example.nxs +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/README.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/README.rst +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/examples/scripts/example.py +0 -0
- {nexpy-2.0.0b4/src/nexpy/api → nexpy-2.0.0b6/src/nexpy/gui}/__init__.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/datadialogs.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/importdialog.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/pyqt.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/NeXpy.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/NeXpy.svg +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/back.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/backward-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/customize.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/equal.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/export-data.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/export-figure.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/filesave.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/forward-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/forward.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/hand.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/home.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/link-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/lock-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/modify-style.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/move.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/pause-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/refresh-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/unlock-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/gui/treeview.py +0 -0
- {nexpy-2.0.0b4/src/nexpy/api/frills → nexpy-2.0.0b6/src/nexpy}/models/bose.py +0 -0
- {nexpy-2.0.0b4/src/nexpy/api/frills → nexpy-2.0.0b6/src/nexpy}/models/critexp.py +0 -0
- {nexpy-2.0.0b4/src/nexpy/api/frills → nexpy-2.0.0b6/src/nexpy}/models/op.py +0 -0
- {nexpy-2.0.0b4/src/nexpy/api/frills → nexpy-2.0.0b6/src/nexpy}/models/pdfdecay.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/nexpygui.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/readers/readnpy.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/readers/readstack.py +0 -0
- {nexpy-2.0.0b4 → nexpy-2.0.0b6}/src/nexpy/readers/readtiff.py +0 -0
|
@@ -48,14 +48,6 @@ src/NeXpy.egg-info/top_level.txt
|
|
|
48
48
|
src/nexpy/__init__.py
|
|
49
49
|
src/nexpy/_version.py
|
|
50
50
|
src/nexpy/nexpygui.py
|
|
51
|
-
src/nexpy/api/__init__.py
|
|
52
|
-
src/nexpy/api/frills/__init__.py
|
|
53
|
-
src/nexpy/api/frills/fit.py
|
|
54
|
-
src/nexpy/api/frills/models/__init__.py
|
|
55
|
-
src/nexpy/api/frills/models/bose.py
|
|
56
|
-
src/nexpy/api/frills/models/critexp.py
|
|
57
|
-
src/nexpy/api/frills/models/op.py
|
|
58
|
-
src/nexpy/api/frills/models/pdfdecay.py
|
|
59
51
|
src/nexpy/examples/README.rst
|
|
60
52
|
src/nexpy/examples/chopper.nxs
|
|
61
53
|
src/nexpy/examples/example.nxs
|
|
@@ -106,7 +98,10 @@ src/nexpy/gui/resources/refresh-icon.png
|
|
|
106
98
|
src/nexpy/gui/resources/unlock-icon.png
|
|
107
99
|
src/nexpy/gui/resources/unlock-red-icon.png
|
|
108
100
|
src/nexpy/gui/resources/zoom_to_rect.png
|
|
109
|
-
src/nexpy/
|
|
101
|
+
src/nexpy/models/bose.py
|
|
102
|
+
src/nexpy/models/critexp.py
|
|
103
|
+
src/nexpy/models/op.py
|
|
104
|
+
src/nexpy/models/pdfdecay.py
|
|
110
105
|
src/nexpy/readers/readnpy.py
|
|
111
106
|
src/nexpy/readers/readspec.py
|
|
112
107
|
src/nexpy/readers/readstack.py
|
|
@@ -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')
|
|
@@ -33,10 +33,7 @@ from .utils import (NXConfigParser, NXGarbageCollector, NXLogger, define_mode,
|
|
|
33
33
|
resource_icon, timestamp_age)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
_tree = None
|
|
37
|
-
_shell = None
|
|
38
36
|
_mainwindow = None
|
|
39
|
-
_nexpy_dir = None
|
|
40
37
|
|
|
41
38
|
|
|
42
39
|
class NXConsoleApp(JupyterQtConsoleApp):
|
|
@@ -58,15 +55,14 @@ class NXConsoleApp(JupyterQtConsoleApp):
|
|
|
58
55
|
else:
|
|
59
56
|
nexpy_dir.mkdir(exist_ok=True)
|
|
60
57
|
for subdirectory in ['backups', 'models', 'plugins', 'readers',
|
|
61
|
-
'
|
|
58
|
+
'scripts']:
|
|
62
59
|
directory = nexpy_dir / subdirectory
|
|
63
60
|
directory.mkdir(exist_ok=True)
|
|
64
|
-
|
|
65
|
-
self.nexpy_dir = _nexpy_dir = nexpy_dir
|
|
61
|
+
self.nexpy_dir = nexpy_dir
|
|
66
62
|
self.backup_dir = self.nexpy_dir / 'backups'
|
|
63
|
+
self.model_dir = self.nexpy_dir / 'models'
|
|
67
64
|
self.plugin_dir = self.nexpy_dir / 'plugins'
|
|
68
65
|
self.reader_dir = self.nexpy_dir / 'readers'
|
|
69
|
-
self.writer_dir = self.nexpy_dir / 'writers'
|
|
70
66
|
self.script_dir = self.nexpy_dir / 'scripts'
|
|
71
67
|
self.scratch_file = self.nexpy_dir / 'w0.nxs'
|
|
72
68
|
if not self.scratch_file.exists():
|
|
@@ -149,31 +145,33 @@ class NXConsoleApp(JupyterQtConsoleApp):
|
|
|
149
145
|
sys.stdout = sys.stderr = NXLogger()
|
|
150
146
|
|
|
151
147
|
def init_plugins(self):
|
|
152
|
-
"""
|
|
148
|
+
"""
|
|
149
|
+
Initialize plugins.
|
|
150
|
+
|
|
151
|
+
This method looks for plugins stored as files in the NeXpy
|
|
152
|
+
directory or registered as entry points, and adds them to the
|
|
153
|
+
list of plugins in the NeXpy settings file. These will be added
|
|
154
|
+
as additional menu items if enabled by the Manage Plugins
|
|
155
|
+
dialog.
|
|
156
|
+
"""
|
|
153
157
|
eps = entry_points()
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
plugin = str(path)
|
|
161
|
-
if plugin not in plugins:
|
|
162
|
-
self.settings.set(plugin_group, plugin, value=None)
|
|
163
|
-
group_name = 'nexpy.' + plugin_group
|
|
164
|
-
for entry in eps.select(group=group_name):
|
|
165
|
-
plugin = entry.module
|
|
158
|
+
plugin = None
|
|
159
|
+
plugins = self.settings.options('plugins')
|
|
160
|
+
for path in self.plugin_dir.iterdir():
|
|
161
|
+
if (path.is_dir() and not (path.name.startswith('_') or
|
|
162
|
+
path.name.startswith('.'))):
|
|
163
|
+
plugin = str(path)
|
|
166
164
|
if plugin not in plugins:
|
|
167
|
-
self.settings.set(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
self.settings.set('plugins', plugin, value=None)
|
|
166
|
+
group_name = 'nexpy.plugins'
|
|
167
|
+
for entry in eps.select(group=group_name):
|
|
168
|
+
plugin = entry.module
|
|
169
|
+
if plugin not in plugins:
|
|
170
|
+
self.settings.set('plugins', plugin, value=None)
|
|
171
171
|
|
|
172
172
|
def init_tree(self):
|
|
173
173
|
"""Initialize the root element of the NeXpy tree view."""
|
|
174
|
-
global _tree
|
|
175
174
|
self.tree = NXtree()
|
|
176
|
-
_tree = self.tree
|
|
177
175
|
|
|
178
176
|
def init_config(self):
|
|
179
177
|
"""Initialize the configuration options for the NeXpy console."""
|
|
@@ -216,8 +214,6 @@ class NXConsoleApp(JupyterQtConsoleApp):
|
|
|
216
214
|
|
|
217
215
|
def init_shell(self, args):
|
|
218
216
|
"""Initialize imports in the shell."""
|
|
219
|
-
global _shell
|
|
220
|
-
_shell = self.window.user_ns
|
|
221
217
|
s = ("import nexusformat.nexus as nx\n"
|
|
222
218
|
"from nexusformat.nexus import NXgroup, NXfield, NXattr, NXlink\n"
|
|
223
219
|
"from nexusformat.nexus import *\n"
|
|
@@ -323,11 +319,6 @@ class NXConsoleApp(JupyterQtConsoleApp):
|
|
|
323
319
|
self.app.exec()
|
|
324
320
|
|
|
325
321
|
|
|
326
|
-
# -----------------------------------------------------------------------------
|
|
327
|
-
# Main entry point
|
|
328
|
-
# -----------------------------------------------------------------------------
|
|
329
|
-
|
|
330
|
-
|
|
331
322
|
def main(args):
|
|
332
323
|
"""
|
|
333
324
|
Main entry point for NeXpy console application.
|
|
@@ -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
|
----------
|
|
@@ -1116,6 +1114,10 @@ class SettingsDialog(NXDialog):
|
|
|
1116
1114
|
self.parameters.add('lockexpiry', cfg['lockexpiry'], 'Lock Expiry (s)')
|
|
1117
1115
|
self.parameters.add('lockdirectory', cfg['lockdirectory'],
|
|
1118
1116
|
'Lock Directory')
|
|
1117
|
+
self.parameters.add('scriptdirectory',
|
|
1118
|
+
self.mainwindow.settings.get('settings',
|
|
1119
|
+
'scriptdirectory'),
|
|
1120
|
+
'Script Directory')
|
|
1119
1121
|
self.parameters.add('definitions', cfg['definitions'],
|
|
1120
1122
|
'NeXus Definitions Directory')
|
|
1121
1123
|
self.parameters.add('recursive', ['True', 'False'], 'File Recursion')
|
|
@@ -1154,6 +1156,8 @@ class SettingsDialog(NXDialog):
|
|
|
1154
1156
|
cfg['lockexpiry'])
|
|
1155
1157
|
self.mainwindow.settings.set('settings', 'lockdirectory',
|
|
1156
1158
|
cfg['lockdirectory'])
|
|
1159
|
+
self.mainwindow.settings.set('settings', 'scriptdirectory',
|
|
1160
|
+
self.parameters['scriptdirectory'].value)
|
|
1157
1161
|
self.mainwindow.settings.set('settings', 'definitions',
|
|
1158
1162
|
cfg['definitions'])
|
|
1159
1163
|
self.mainwindow.settings.set('settings', 'recursive',
|
|
@@ -1876,6 +1880,10 @@ class StyleTab(NXTab):
|
|
|
1876
1880
|
('Tighten Layout', self.tight_layout),
|
|
1877
1881
|
('Reset Layout', self.reset_layout)))
|
|
1878
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
|
+
|
|
1879
1887
|
|
|
1880
1888
|
def label_parameters(self):
|
|
1881
1889
|
"""
|
|
@@ -1965,9 +1973,6 @@ class StyleTab(NXTab):
|
|
|
1965
1973
|
before calling tight_layout, so that the layout can be reset
|
|
1966
1974
|
if needed.
|
|
1967
1975
|
"""
|
|
1968
|
-
pars = self.plotview.figure.subplotpars
|
|
1969
|
-
self.previous_layout = {'left': pars.left, 'right': pars.right,
|
|
1970
|
-
'bottom': pars.bottom, 'top': pars.right}
|
|
1971
1976
|
self.plotview.figure.tight_layout()
|
|
1972
1977
|
self.plotview.draw()
|
|
1973
1978
|
|
|
@@ -1981,20 +1986,14 @@ class StyleTab(NXTab):
|
|
|
1981
1986
|
done by tight_layout is not what you want. The original layout
|
|
1982
1987
|
is restored, and the plot is redrawn.
|
|
1983
1988
|
"""
|
|
1984
|
-
self.plotview.figure.subplots_adjust(**self.
|
|
1989
|
+
self.plotview.figure.subplots_adjust(**self.original_layout)
|
|
1985
1990
|
self.plotview.draw()
|
|
1986
1991
|
|
|
1987
1992
|
def adjust_layout(self):
|
|
1988
1993
|
"""
|
|
1989
1994
|
Call the configure_subplots method of the Options Tab to adjust
|
|
1990
1995
|
the layout of the active plotview.
|
|
1991
|
-
|
|
1992
|
-
The current layout is saved before calling configure_subplots,
|
|
1993
|
-
so that the layout can be reset if needed.
|
|
1994
1996
|
"""
|
|
1995
|
-
pars = self.plotview.figure.subplotpars
|
|
1996
|
-
self.previous_layout = {'left': pars.left, 'right': pars.right,
|
|
1997
|
-
'bottom': pars.bottom, 'top': pars.right}
|
|
1998
1997
|
self.plotview.otab.configure_subplots()
|
|
1999
1998
|
|
|
2000
1999
|
def save_default(self):
|
|
@@ -4109,7 +4108,7 @@ class ValidateTab(NXTab):
|
|
|
4109
4108
|
self.pushbutton['Validate Entry'].setVisible(False)
|
|
4110
4109
|
self.application_box = None
|
|
4111
4110
|
|
|
4112
|
-
self.text_box =
|
|
4111
|
+
self.text_box = NXTextEdit()
|
|
4113
4112
|
self.text_box.setMinimumWidth(800)
|
|
4114
4113
|
self.text_box.setMinimumHeight(600)
|
|
4115
4114
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
@@ -4195,12 +4194,16 @@ class ValidateTab(NXTab):
|
|
|
4195
4194
|
True and the Check Base Class and Inspect Base Class buttons to
|
|
4196
4195
|
False.
|
|
4197
4196
|
"""
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
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)
|
|
4204
4207
|
|
|
4205
4208
|
def check(self):
|
|
4206
4209
|
"""
|
|
@@ -4615,9 +4618,9 @@ class FieldDialog(NXDialog):
|
|
|
4615
4618
|
if dtype == "char":
|
|
4616
4619
|
return value
|
|
4617
4620
|
else:
|
|
4618
|
-
from .consoleapp import _shell
|
|
4619
4621
|
try:
|
|
4620
|
-
return eval(value, {"__builtins__": {}},
|
|
4622
|
+
return eval(value, {"__builtins__": {}},
|
|
4623
|
+
self.mainwindow.user_ns)
|
|
4621
4624
|
except Exception:
|
|
4622
4625
|
return value
|
|
4623
4626
|
else:
|
|
@@ -4791,9 +4794,9 @@ class AttributeDialog(NXDialog):
|
|
|
4791
4794
|
if dtype == "char":
|
|
4792
4795
|
return value
|
|
4793
4796
|
else:
|
|
4794
|
-
from .consoleapp import _shell
|
|
4795
4797
|
try:
|
|
4796
|
-
return eval(value, {"__builtins__": {}},
|
|
4798
|
+
return eval(value, {"__builtins__": {}},
|
|
4799
|
+
self.mainwindow.user_ns)
|
|
4797
4800
|
except Exception:
|
|
4798
4801
|
return value
|
|
4799
4802
|
else:
|
|
@@ -5295,23 +5298,27 @@ class LogDialog(NXDialog):
|
|
|
5295
5298
|
|
|
5296
5299
|
self.log_directory = self.mainwindow.nexpy_dir
|
|
5297
5300
|
|
|
5298
|
-
self.text_box =
|
|
5301
|
+
self.text_box = NXTextEdit()
|
|
5299
5302
|
self.text_box.setMinimumWidth(800)
|
|
5300
5303
|
self.text_box.setMinimumHeight(600)
|
|
5301
5304
|
self.text_box.setFocusPolicy(QtCore.Qt.StrongFocus)
|
|
5302
5305
|
self.text_box.setReadOnly(True)
|
|
5306
|
+
|
|
5307
|
+
self.switch_box = NXCheckBox('Switch Light/Dark Mode',
|
|
5308
|
+
self.switch_mode)
|
|
5303
5309
|
self.file_combo = NXComboBox(self.show_log)
|
|
5304
5310
|
for file_name in self.get_filesindirectory(
|
|
5305
5311
|
'nexpy', extension='.log*', directory=self.log_directory):
|
|
5306
5312
|
self.file_combo.add(file_name.name)
|
|
5307
5313
|
self.file_combo.select('nexpy.log')
|
|
5308
5314
|
self.issue_button = NXPushButton('Open NeXpy Issue', self.open_issue)
|
|
5309
|
-
footer_layout = self.make_layout(self.
|
|
5310
|
-
'stretch',
|
|
5315
|
+
footer_layout = self.make_layout(self.switch_box, 'stretch',
|
|
5311
5316
|
self.file_combo, 'stretch',
|
|
5317
|
+
self.issue_button,
|
|
5312
5318
|
self.close_buttons(close=True),
|
|
5313
5319
|
align='justified')
|
|
5314
|
-
self.set_layout(self.text_box,
|
|
5320
|
+
self.set_layout(self.search_layout(self.text_box, 'Search Log...'),
|
|
5321
|
+
self.text_box, footer_layout)
|
|
5315
5322
|
|
|
5316
5323
|
self.show_log()
|
|
5317
5324
|
|
|
@@ -5338,6 +5345,8 @@ class LogDialog(NXDialog):
|
|
|
5338
5345
|
top of the window stack, and give it focus.
|
|
5339
5346
|
"""
|
|
5340
5347
|
self.format_log()
|
|
5348
|
+
self.text_box.verticalScrollBar().setValue(
|
|
5349
|
+
self.text_box.verticalScrollBar().maximum())
|
|
5341
5350
|
self.setVisible(True)
|
|
5342
5351
|
self.raise_()
|
|
5343
5352
|
self.activateWindow()
|
|
@@ -5352,12 +5361,22 @@ class LogDialog(NXDialog):
|
|
|
5352
5361
|
messages. The window title is also set to the name of the log
|
|
5353
5362
|
file.
|
|
5354
5363
|
"""
|
|
5364
|
+
switch = self.switch_box.isChecked()
|
|
5355
5365
|
with open(self.file_name, 'r') as f:
|
|
5356
|
-
self.text_box.setText(convertHTML(f.read()))
|
|
5357
|
-
self.text_box.verticalScrollBar().setValue(
|
|
5358
|
-
self.text_box.verticalScrollBar().maximum())
|
|
5366
|
+
self.text_box.setText(convertHTML(f.read(), switch=switch))
|
|
5359
5367
|
self.setWindowTitle(f"Log File: {self.file_name}")
|
|
5360
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
|
+
|
|
5361
5380
|
def reject(self):
|
|
5362
5381
|
"""
|
|
5363
5382
|
Close the dialog and remove the reference to it from the main
|
|
@@ -5571,7 +5590,9 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5571
5590
|
try:
|
|
5572
5591
|
self.plugins[plugin] = load_plugin(plugin)
|
|
5573
5592
|
except Exception as error:
|
|
5574
|
-
|
|
5593
|
+
self.plugins[plugin] = {'package': plugin,
|
|
5594
|
+
'menu': 'unavailable',
|
|
5595
|
+
'order': 'Disabled'}
|
|
5575
5596
|
|
|
5576
5597
|
self.grid = QtWidgets.QGridLayout()
|
|
5577
5598
|
self.grid.setSpacing(10)
|
|
@@ -5583,8 +5604,7 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5583
5604
|
self.grid.addWidget(label, 0, column)
|
|
5584
5605
|
self.grid.setColumnMinimumWidth(column, width[column])
|
|
5585
5606
|
column += 1
|
|
5586
|
-
|
|
5587
|
-
self.order_options = list(range(1, len(self.plugins)+1)) +['Disabled']
|
|
5607
|
+
self.order_options = list(range(1, len(self.plugins)+1)) + ['Disabled']
|
|
5588
5608
|
for row, plugin in enumerate(self.plugins):
|
|
5589
5609
|
p = self.plugins[plugin]
|
|
5590
5610
|
self.grid.addWidget(NXLabel(p['package']), row+1, 0)
|
|
@@ -5598,14 +5618,19 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5598
5618
|
|
|
5599
5619
|
def update_plugins(self):
|
|
5600
5620
|
"""
|
|
5601
|
-
Set the order of plugins in the settings from the current dialog
|
|
5602
|
-
layout. Check that the order is unique and sequential,
|
|
5603
|
-
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.
|
|
5604
5624
|
"""
|
|
5605
5625
|
for row, plugin in enumerate(self.plugins):
|
|
5606
5626
|
p = self.plugins[plugin]
|
|
5607
5627
|
order = self.grid.itemAtPosition(row+1, 2).widget().currentText()
|
|
5608
|
-
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
|
|
5609
5634
|
order_set = [int(p['order']) for p in self.plugins.values()
|
|
5610
5635
|
if p['order'] != 'Disabled']
|
|
5611
5636
|
if sorted(order_set) != list(range(1, len(order_set)+1)):
|
|
@@ -5650,6 +5675,7 @@ class ManagePluginsDialog(NXDialog):
|
|
|
5650
5675
|
name, actions = p['menu'], p['actions']
|
|
5651
5676
|
self.mainwindow.add_plugin_menu(
|
|
5652
5677
|
name, actions, before=self.mainwindow.view_menu)
|
|
5678
|
+
self.mainwindow.plugins[plugin] = p
|
|
5653
5679
|
for plugin in self.plugins:
|
|
5654
5680
|
self.settings.set('plugins', plugin,
|
|
5655
5681
|
self.plugins[plugin]['order'])
|