NeXpy 2.0.0b3__tar.gz → 2.0.0b5__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.
Files changed (117) hide show
  1. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/PKG-INFO +2 -2
  2. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/pyproject.toml +1 -2
  3. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/PKG-INFO +2 -2
  4. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/SOURCES.txt +4 -9
  5. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/requires.txt +1 -1
  6. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/_version.py +2 -2
  7. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/consoleapp.py +24 -33
  8. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/dialogs.py +12 -6
  9. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/fitdialogs.py +13 -28
  10. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/mainwindow.py +122 -89
  11. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/plotview.py +31 -29
  12. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/scripteditor.py +6 -3
  13. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/treeview.py +8 -4
  14. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/utils.py +112 -47
  15. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/widgets.py +4 -4
  16. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/readers/readspec.py +6 -7
  17. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/tests/test_imports.py +0 -7
  18. nexpy-2.0.0b3/src/nexpy/api/frills/__init__.py +0 -0
  19. nexpy-2.0.0b3/src/nexpy/api/frills/fit.py +0 -239
  20. nexpy-2.0.0b3/src/nexpy/api/frills/models/__init__.py +0 -0
  21. nexpy-2.0.0b3/src/nexpy/gui/__init__.py +0 -0
  22. nexpy-2.0.0b3/src/nexpy/readers/__init__.py +0 -0
  23. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/.gitattributes +0 -0
  24. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/.github/dependabot.yaml +0 -0
  25. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/.github/workflows/ci.yml +0 -0
  26. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/.gitignore +0 -0
  27. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/COPYING +0 -0
  28. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/README.md +0 -0
  29. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/README.rst +0 -0
  30. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/conda-recipe/bld.bat +0 -0
  31. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/conda-recipe/build.sh +0 -0
  32. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/conda-recipe/meta.yaml +0 -0
  33. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/Makefile +0 -0
  34. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/make.bat +0 -0
  35. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/_static/__ignore__.txt +0 -0
  36. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/conf.py +0 -0
  37. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/examples.rst +0 -0
  38. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/favicon.ico +0 -0
  39. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/axis-limits-bar.png +0 -0
  40. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/customize-panel.png +0 -0
  41. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/limits-panel.png +0 -0
  42. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/nexpy-fits.png +0 -0
  43. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/nexpy-gui.png +0 -0
  44. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/nexpy-logo.png +0 -0
  45. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/options-tab.png +0 -0
  46. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/projection-panel.png +0 -0
  47. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/projection-tab.png +0 -0
  48. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/scan-panel.png +0 -0
  49. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/signal-tab.png +0 -0
  50. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/simple-plot.png +0 -0
  51. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/skewed-axis.png +0 -0
  52. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/x-tab.png +0 -0
  53. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/y-tab.png +0 -0
  54. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/z-tab.png +0 -0
  55. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/images/z-toolbar.png +0 -0
  56. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/includeme.rst +0 -0
  57. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/index.rst +0 -0
  58. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/pythongui.rst +0 -0
  59. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/pythonshell.rst +0 -0
  60. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/readers.rst +0 -0
  61. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/doc/source/treeapi.rst +0 -0
  62. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/setup.cfg +0 -0
  63. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/dependency_links.txt +0 -0
  64. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/entry_points.txt +0 -0
  65. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/pbr.json +0 -0
  66. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/NeXpy.egg-info/top_level.txt +0 -0
  67. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/__init__.py +0 -0
  68. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/README.rst +0 -0
  69. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/chopper.nxs +0 -0
  70. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/example.nxs +0 -0
  71. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/README.rst +0 -0
  72. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
  73. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
  74. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
  75. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
  76. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
  77. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
  78. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
  79. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/scripts/README.rst +0 -0
  80. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
  81. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/examples/scripts/example.py +0 -0
  82. {nexpy-2.0.0b3/src/nexpy/api → nexpy-2.0.0b5/src/nexpy/gui}/__init__.py +0 -0
  83. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/datadialogs.py +0 -0
  84. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/importdialog.py +0 -0
  85. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/pyqt.py +0 -0
  86. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/NeXpy.png +0 -0
  87. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/NeXpy.svg +0 -0
  88. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/back.png +0 -0
  89. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/backward-icon.png +0 -0
  90. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/customize.png +0 -0
  91. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/equal.png +0 -0
  92. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/export-data.png +0 -0
  93. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/export-figure.png +0 -0
  94. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/filesave.png +0 -0
  95. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/forward-icon.png +0 -0
  96. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/forward.png +0 -0
  97. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/hand.png +0 -0
  98. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/home.png +0 -0
  99. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/link-icon.png +0 -0
  100. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/lock-icon.png +0 -0
  101. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
  102. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/modify-style.png +0 -0
  103. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/move.png +0 -0
  104. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/pause-icon.png +0 -0
  105. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/refresh-icon.png +0 -0
  106. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/unlock-icon.png +0 -0
  107. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
  108. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
  109. {nexpy-2.0.0b3/src/nexpy/api/frills → nexpy-2.0.0b5/src/nexpy}/models/bose.py +0 -0
  110. {nexpy-2.0.0b3/src/nexpy/api/frills → nexpy-2.0.0b5/src/nexpy}/models/critexp.py +0 -0
  111. {nexpy-2.0.0b3/src/nexpy/api/frills → nexpy-2.0.0b5/src/nexpy}/models/op.py +0 -0
  112. {nexpy-2.0.0b3/src/nexpy/api/frills → nexpy-2.0.0b5/src/nexpy}/models/pdfdecay.py +0 -0
  113. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/nexpygui.py +0 -0
  114. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/readers/readnpy.py +0 -0
  115. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/readers/readstack.py +0 -0
  116. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/readers/readtiff.py +0 -0
  117. {nexpy-2.0.0b3 → nexpy-2.0.0b5}/src/nexpy/readers/readtxt.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeXpy
3
- Version: 2.0.0b3
3
+ Version: 2.0.0b5
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.0b3
91
+ Requires-Dist: nexusformat>=2.0.0b4
92
92
  Requires-Dist: numpy
93
93
  Requires-Dist: packaging
94
94
  Requires-Dist: pillow
@@ -40,7 +40,7 @@ dependencies = [
40
40
  "lmfit",
41
41
  "matplotlib",
42
42
  "mplcursors",
43
- "nexusformat >= 2.0.0b3",
43
+ "nexusformat >= 2.0.0b4",
44
44
  "numpy",
45
45
  "packaging",
46
46
  "pillow",
@@ -71,6 +71,5 @@ nexpy = "nexpy.nexpygui:main"
71
71
  version_file = "src/nexpy/_version.py"
72
72
 
73
73
  [tool.setuptools.package-data]
74
- "nexpy.gui.frills.models" = ["*.py"]
75
74
  "nexpy.gui.resources" = ["*.*"]
76
75
  "nexpy.examples" = ["*.*", "*/*.*", "*/*/*.*", "*/*/*/*.*"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeXpy
3
- Version: 2.0.0b3
3
+ Version: 2.0.0b5
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.0b3
91
+ Requires-Dist: nexusformat>=2.0.0b4
92
92
  Requires-Dist: numpy
93
93
  Requires-Dist: packaging
94
94
  Requires-Dist: pillow
@@ -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/readers/__init__.py
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
@@ -5,7 +5,7 @@ ipython
5
5
  lmfit
6
6
  matplotlib
7
7
  mplcursors
8
- nexusformat>=2.0.0b3
8
+ nexusformat>=2.0.0b4
9
9
  numpy
10
10
  packaging
11
11
  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.0b3'
21
- __version_tuple__ = version_tuple = (2, 0, 0, 'b3')
20
+ __version__ = version = '2.0.0b5'
21
+ __version_tuple__ = version_tuple = (2, 0, 0, 'b5')
@@ -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
- 'writers', 'scripts']:
58
+ 'scripts']:
62
59
  directory = nexpy_dir / subdirectory
63
60
  directory.mkdir(exist_ok=True)
64
- global _nexpy_dir
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
- """Initialize plugins, readers, and writers."""
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
- def initialize_plugin(plugin_group, plugin_dir):
155
- plugin = None
156
- plugins = self.settings.options(plugin_group)
157
- for path in plugin_dir.iterdir():
158
- if (path.is_dir() and not (path.name.startswith('_') or
159
- path.name.startswith('.'))):
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(plugin_group, plugin, value=None)
168
- initialize_plugin('plugins', self.plugin_dir)
169
- initialize_plugin('readers', self.reader_dir)
170
- initialize_plugin('writers', self.writer_dir)
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.
@@ -162,7 +162,7 @@ class DirectoryDialog(NXDialog):
162
162
 
163
163
  class PlotDialog(NXDialog):
164
164
 
165
- def __init__(self, node, parent=None, lines=False):
165
+ def __init__(self, node, lines=False, parent=None):
166
166
 
167
167
  """
168
168
  Initialize the dialog to plot arbitrary NeXus data in 1D or 2D.
@@ -458,7 +458,6 @@ class PlotScalarDialog(NXDialog):
458
458
  The parent window of the dialog, by default None
459
459
  """
460
460
  super().__init__(parent=parent)
461
- self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
462
461
 
463
462
  if isinstance(node, NXfield):
464
463
  self.node = node
@@ -1117,6 +1116,10 @@ class SettingsDialog(NXDialog):
1117
1116
  self.parameters.add('lockexpiry', cfg['lockexpiry'], 'Lock Expiry (s)')
1118
1117
  self.parameters.add('lockdirectory', cfg['lockdirectory'],
1119
1118
  'Lock Directory')
1119
+ self.parameters.add('scriptdirectory',
1120
+ self.mainwindow.settings.get('settings',
1121
+ 'scriptdirectory'),
1122
+ 'Script Directory')
1120
1123
  self.parameters.add('definitions', cfg['definitions'],
1121
1124
  'NeXus Definitions Directory')
1122
1125
  self.parameters.add('recursive', ['True', 'False'], 'File Recursion')
@@ -1155,6 +1158,8 @@ class SettingsDialog(NXDialog):
1155
1158
  cfg['lockexpiry'])
1156
1159
  self.mainwindow.settings.set('settings', 'lockdirectory',
1157
1160
  cfg['lockdirectory'])
1161
+ self.mainwindow.settings.set('settings', 'scriptdirectory',
1162
+ self.parameters['scriptdirectory'].value)
1158
1163
  self.mainwindow.settings.set('settings', 'definitions',
1159
1164
  cfg['definitions'])
1160
1165
  self.mainwindow.settings.set('settings', 'recursive',
@@ -4616,9 +4621,9 @@ class FieldDialog(NXDialog):
4616
4621
  if dtype == "char":
4617
4622
  return value
4618
4623
  else:
4619
- from .consoleapp import _shell
4620
4624
  try:
4621
- return eval(value, {"__builtins__": {}}, _shell)
4625
+ return eval(value, {"__builtins__": {}},
4626
+ self.mainwindow.user_ns)
4622
4627
  except Exception:
4623
4628
  return value
4624
4629
  else:
@@ -4792,9 +4797,9 @@ class AttributeDialog(NXDialog):
4792
4797
  if dtype == "char":
4793
4798
  return value
4794
4799
  else:
4795
- from .consoleapp import _shell
4796
4800
  try:
4797
- return eval(value, {"__builtins__": {}}, _shell)
4801
+ return eval(value, {"__builtins__": {}},
4802
+ self.mainwindow.user_ns)
4798
4803
  except Exception:
4799
4804
  return value
4800
4805
  else:
@@ -5651,6 +5656,7 @@ class ManagePluginsDialog(NXDialog):
5651
5656
  name, actions = p['menu'], p['actions']
5652
5657
  self.mainwindow.add_plugin_menu(
5653
5658
  name, actions, before=self.mainwindow.view_menu)
5659
+ self.mainwindow.plugins[plugin] = p
5654
5660
  for plugin in self.plugins:
5655
5661
  self.settings.set('plugins', plugin,
5656
5662
  self.plugins[plugin]['order'])
@@ -7,11 +7,8 @@
7
7
  # -----------------------------------------------------------------------------
8
8
  import inspect
9
9
  import re
10
- import sys
11
10
  import types
12
- from importlib import import_module
13
11
  from itertools import cycle
14
- from pathlib import Path
15
12
 
16
13
  import numpy as np
17
14
  from lmfit import Model, Parameters
@@ -21,7 +18,7 @@ from nexusformat.nexus import (NeXusError, NXdata, NXentry, NXfield, NXnote,
21
18
 
22
19
  from .plotview import NXPlotView, linestyles
23
20
  from .pyqt import QtCore, QtWidgets
24
- from .utils import display_message, format_float, package_files, report_error
21
+ from .utils import display_message, format_float, load_models, report_error
25
22
  from .widgets import (NXCheckBox, NXColorBox, NXComboBox, NXDialog, NXLabel,
26
23
  NXLineEdit, NXMessageBox, NXPanel, NXPushButton,
27
24
  NXrectangle, NXScrollArea, NXTab)
@@ -33,10 +30,11 @@ def get_models():
33
30
 
34
31
  This function returns a dictionary of LMFIT models, including those
35
32
  defined in the LMFIT package and those defined in the
36
- ``nexpy.api.frills.models`` package. Additional models can also be
37
- defined in the ``~/.nexpy/models`` directory for use by NeXpy. The
38
- models are returned as a dictionary where the keys are the names of
39
- the models and the values are the classes defining the models.
33
+ ``nexpy.models`` package. Additional models can also be defined in
34
+ the ``~/.nexpy/models`` directory or in another installed package,
35
+ which declares the entry point ``nexpy.models``. The models are
36
+ returned as a dictionary where the keys are the names of the models
37
+ and the values are the classes defining the models.
40
38
  """
41
39
  from lmfit.models import lmfit_models
42
40
  models = lmfit_models
@@ -45,28 +43,15 @@ def get_models():
45
43
  if 'Gaussian-2D' in models:
46
44
  del models['Gaussian-2D']
47
45
 
48
- filenames = set()
46
+ nexpy_models = load_models()
49
47
 
50
- models_path = package_files('nexpy.api.frills.models')
51
- sys.path.append(models_path)
52
- for f in models_path.glob("*.py"):
53
- if f.stem != '__init__':
54
- filenames.add(f.stem)
55
-
56
- private_path = Path.home() / '.nexpy' / 'models'
57
- if private_path.is_dir():
58
- sys.path.append(private_path)
59
- for f in private_path.glob('*.py'):
60
- if f.stem != '__init__':
61
- filenames.add(f.stem)
62
-
63
- for name in sorted(filenames):
48
+ for model in nexpy_models:
64
49
  try:
65
- module = import_module(name)
66
- models.update(dict((n.strip('Model'), m)
67
- for n, m in inspect.getmembers(module,
68
- inspect.isclass)
69
- if issubclass(m, Model) and n != 'Model'))
50
+ models.update(
51
+ dict((n.strip('Model'), m)
52
+ for n, m in inspect.getmembers(nexpy_models[model],
53
+ inspect.isclass)
54
+ if issubclass(m, Model) and n != 'Model'))
70
55
  except ImportError:
71
56
  pass
72
57