NeXpy 2.0.0b3__tar.gz → 2.0.0b4__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.0b4}/PKG-INFO +2 -2
  2. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/pyproject.toml +1 -1
  3. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/PKG-INFO +2 -2
  4. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/requires.txt +1 -1
  5. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/_version.py +2 -2
  6. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/dialogs.py +1 -2
  7. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/fitdialogs.py +2 -2
  8. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/mainwindow.py +73 -46
  9. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/plotview.py +31 -29
  10. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/treeview.py +8 -4
  11. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/utils.py +15 -9
  12. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/widgets.py +4 -4
  13. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/.gitattributes +0 -0
  14. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/.github/dependabot.yaml +0 -0
  15. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/.github/workflows/ci.yml +0 -0
  16. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/.gitignore +0 -0
  17. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/COPYING +0 -0
  18. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/README.md +0 -0
  19. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/README.rst +0 -0
  20. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/conda-recipe/bld.bat +0 -0
  21. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/conda-recipe/build.sh +0 -0
  22. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/conda-recipe/meta.yaml +0 -0
  23. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/Makefile +0 -0
  24. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/make.bat +0 -0
  25. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/_static/__ignore__.txt +0 -0
  26. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/conf.py +0 -0
  27. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/examples.rst +0 -0
  28. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/favicon.ico +0 -0
  29. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/axis-limits-bar.png +0 -0
  30. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/customize-panel.png +0 -0
  31. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/limits-panel.png +0 -0
  32. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/nexpy-fits.png +0 -0
  33. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/nexpy-gui.png +0 -0
  34. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/nexpy-logo.png +0 -0
  35. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/options-tab.png +0 -0
  36. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/projection-panel.png +0 -0
  37. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/projection-tab.png +0 -0
  38. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/scan-panel.png +0 -0
  39. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/signal-tab.png +0 -0
  40. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/simple-plot.png +0 -0
  41. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/skewed-axis.png +0 -0
  42. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/x-tab.png +0 -0
  43. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/y-tab.png +0 -0
  44. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/z-tab.png +0 -0
  45. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/images/z-toolbar.png +0 -0
  46. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/includeme.rst +0 -0
  47. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/index.rst +0 -0
  48. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/pythongui.rst +0 -0
  49. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/pythonshell.rst +0 -0
  50. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/readers.rst +0 -0
  51. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/doc/source/treeapi.rst +0 -0
  52. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/setup.cfg +0 -0
  53. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/SOURCES.txt +0 -0
  54. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/dependency_links.txt +0 -0
  55. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/entry_points.txt +0 -0
  56. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/pbr.json +0 -0
  57. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/NeXpy.egg-info/top_level.txt +0 -0
  58. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/__init__.py +0 -0
  59. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/__init__.py +0 -0
  60. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/__init__.py +0 -0
  61. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/fit.py +0 -0
  62. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/models/__init__.py +0 -0
  63. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/models/bose.py +0 -0
  64. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/models/critexp.py +0 -0
  65. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/models/op.py +0 -0
  66. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/api/frills/models/pdfdecay.py +0 -0
  67. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/README.rst +0 -0
  68. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/chopper.nxs +0 -0
  69. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/example.nxs +0 -0
  70. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/README.rst +0 -0
  71. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
  72. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
  73. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
  74. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
  75. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
  76. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
  77. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
  78. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/scripts/README.rst +0 -0
  79. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
  80. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/examples/scripts/example.py +0 -0
  81. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/__init__.py +0 -0
  82. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/consoleapp.py +0 -0
  83. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/datadialogs.py +0 -0
  84. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/importdialog.py +0 -0
  85. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/pyqt.py +0 -0
  86. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/NeXpy.png +0 -0
  87. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/NeXpy.svg +0 -0
  88. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/back.png +0 -0
  89. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/backward-icon.png +0 -0
  90. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/customize.png +0 -0
  91. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/equal.png +0 -0
  92. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/export-data.png +0 -0
  93. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/export-figure.png +0 -0
  94. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/filesave.png +0 -0
  95. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/forward-icon.png +0 -0
  96. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/forward.png +0 -0
  97. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/hand.png +0 -0
  98. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/home.png +0 -0
  99. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/link-icon.png +0 -0
  100. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/lock-icon.png +0 -0
  101. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
  102. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/modify-style.png +0 -0
  103. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/move.png +0 -0
  104. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/pause-icon.png +0 -0
  105. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/refresh-icon.png +0 -0
  106. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/unlock-icon.png +0 -0
  107. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
  108. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
  109. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/gui/scripteditor.py +0 -0
  110. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/nexpygui.py +0 -0
  111. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/__init__.py +0 -0
  112. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/readnpy.py +0 -0
  113. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/readspec.py +0 -0
  114. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/readstack.py +0 -0
  115. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/readtiff.py +0 -0
  116. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/src/nexpy/readers/readtxt.py +0 -0
  117. {nexpy-2.0.0b3 → nexpy-2.0.0b4}/tests/test_imports.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.0b4
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",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeXpy
3
- Version: 2.0.0b3
3
+ Version: 2.0.0b4
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
@@ -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.0b4'
21
+ __version_tuple__ = version_tuple = (2, 0, 0, 'b4')
@@ -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
@@ -48,14 +48,14 @@ def get_models():
48
48
  filenames = set()
49
49
 
50
50
  models_path = package_files('nexpy.api.frills.models')
51
- sys.path.append(models_path)
51
+ sys.path.append(str(models_path))
52
52
  for f in models_path.glob("*.py"):
53
53
  if f.stem != '__init__':
54
54
  filenames.add(f.stem)
55
55
 
56
56
  private_path = Path.home() / '.nexpy' / 'models'
57
57
  if private_path.is_dir():
58
- sys.path.append(private_path)
58
+ sys.path.append(str(private_path))
59
59
  for f in private_path.glob('*.py'):
60
60
  if f.stem != '__init__':
61
61
  filenames.add(f.stem)
@@ -1,5 +1,5 @@
1
1
  # -----------------------------------------------------------------------------
2
- # Copyright (c) 2013-2021, NeXpy Development Team.
2
+ # Copyright (c) 2013-2025, NeXpy Development Team.
3
3
  #
4
4
  # Distributed under the terms of the Modified BSD License.
5
5
  #
@@ -8,8 +8,9 @@
8
8
 
9
9
  """The Qt MainWindow for NeXpy
10
10
 
11
- This is an expanded version on the Jupyter QtConsole with the addition
12
- of a Matplotlib plotting pane and a tree view for displaying NeXus data.
11
+ This contains a tree view to display NeXus data, a Matplotlib canvas to
12
+ plot the data, and a Jupyter console to execute Python commands. The
13
+ namespace of the console includes the NeXus data loaded into the tree.
13
14
  """
14
15
 
15
16
  # -----------------------------------------------------------------------------
@@ -95,12 +96,18 @@ class MainWindow(QtWidgets.QMainWindow):
95
96
 
96
97
  super().__init__()
97
98
  self.resize(1000, 800)
99
+
98
100
  self.app = app
99
101
  self._app = app.app
100
102
  self._app.setStyle("QMacStyle")
101
103
  self.settings = settings
102
104
  self.config = config
105
+
106
+ self.dialogs = []
107
+ self.panels = {}
108
+ self.log_window = None
103
109
  self.copied_node = None
110
+ self._memroot = None
104
111
 
105
112
  self.default_directory = Path.home()
106
113
  self.nexpy_dir = self.app.nexpy_dir
@@ -114,20 +121,10 @@ class MainWindow(QtWidgets.QMainWindow):
114
121
 
115
122
  mainwindow = QtWidgets.QWidget()
116
123
 
117
- rightpane = QtWidgets.QWidget()
124
+ self.mainview = NXPlotView(label="Main", mainwindow=self)
118
125
 
119
- self.dialogs = []
120
- self.panels = {}
121
- self.log_window = None
122
- self._memroot = None
123
-
124
- main_plotview = NXPlotView(label="Main", parent=self)
125
-
126
- self.console = NXRichJupyterWidget(config=self.config,
127
- parent=rightpane)
126
+ self.console = NXRichJupyterWidget(config=self.config)
128
127
  self.console.setMinimumSize(750, 100)
129
- self.console.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
130
- QtWidgets.QSizePolicy.Fixed)
131
128
  self.console._confirm_exit = True
132
129
  self.console.kernel_manager = QtInProcessKernelManager(
133
130
  config=self.config)
@@ -157,9 +154,16 @@ class MainWindow(QtWidgets.QMainWindow):
157
154
  self.shell._last_traceback = stb
158
155
  self.shell._showtraceback = new_stb
159
156
 
157
+ self.tree = tree
158
+ self.treeview = NXTreeView(self.tree, mainwindow=self)
159
+ self.treeview.setMinimumWidth(200)
160
+ self.treeview.setMaximumWidth(400)
161
+
162
+ rightpane = QtWidgets.QWidget()
163
+
160
164
  right_splitter = QtWidgets.QSplitter(rightpane)
161
165
  right_splitter.setOrientation(QtCore.Qt.Vertical)
162
- right_splitter.addWidget(main_plotview)
166
+ right_splitter.addWidget(self.mainview)
163
167
  right_splitter.addWidget(self.console)
164
168
 
165
169
  rightlayout = QtWidgets.QVBoxLayout()
@@ -167,18 +171,6 @@ class MainWindow(QtWidgets.QMainWindow):
167
171
  rightlayout.setContentsMargins(0, 0, 0, 0)
168
172
  rightpane.setLayout(rightlayout)
169
173
 
170
- self.tree = tree
171
- self.treeview = NXTreeView(self.tree, parent=self)
172
- self.treeview.setMinimumWidth(200)
173
- self.treeview.setMaximumWidth(400)
174
- self.treeview.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
175
- QtWidgets.QSizePolicy.Expanding)
176
- self.user_ns['plotview'] = self.plotview
177
- self.user_ns['plotviews'] = self.plotviews = self.plotview.plotviews
178
- self.user_ns['treeview'] = self.treeview
179
- self.user_ns['nxtree'] = self.user_ns['_tree'] = self.tree
180
- self.user_ns['mainwindow'] = self
181
-
182
174
  left_splitter = QtWidgets.QSplitter(mainwindow)
183
175
  left_splitter.setOrientation(QtCore.Qt.Horizontal)
184
176
  left_splitter.addWidget(self.treeview)
@@ -191,6 +183,12 @@ class MainWindow(QtWidgets.QMainWindow):
191
183
 
192
184
  self.setCentralWidget(mainwindow)
193
185
 
186
+ self.user_ns['plotview'] = self.plotview
187
+ self.user_ns['plotviews'] = self.plotviews = self.plotview.plotviews
188
+ self.user_ns['treeview'] = self.treeview
189
+ self.user_ns['nxtree'] = self.user_ns['_tree'] = self.tree
190
+ self.user_ns['mainwindow'] = self
191
+
194
192
  self.nxclasses = get_base_classes()
195
193
 
196
194
  self.init_menu_bar()
@@ -859,6 +857,30 @@ class MainWindow(QtWidgets.QMainWindow):
859
857
 
860
858
  self.help_menu.addSeparator()
861
859
 
860
+ self.nexpyReleaseAct = QtWidgets.QAction(
861
+ "Open NeXpy Release Notes", self,
862
+ triggered=self._open_nexpy_release_notes)
863
+ self.add_menu_action(self.help_menu, self.nexpyReleaseAct)
864
+
865
+ self.nexpyIssuesAct = QtWidgets.QAction(
866
+ "Open NeXpy Issues", self,
867
+ triggered=self._open_nexpy_issues)
868
+ self.add_menu_action(self.help_menu, self.nexpyIssuesAct)
869
+
870
+ self.help_menu.addSeparator()
871
+
872
+ self.nexusformatReleaseAct = QtWidgets.QAction(
873
+ "Open NeXus API Release Notes", self,
874
+ triggered=self._open_nexusformat_release_notes)
875
+ self.add_menu_action(self.help_menu, self.nexusformatReleaseAct)
876
+
877
+ self.nexusformatIssuesAct = QtWidgets.QAction(
878
+ "Open NeXus API Issues", self,
879
+ triggered=self._open_nexusformat_issues)
880
+ self.add_menu_action(self.help_menu, self.nexusformatIssuesAct)
881
+
882
+ self.help_menu.addSeparator()
883
+
862
884
  self.ipythonHelpAct = QtWidgets.QAction(
863
885
  "Open iPython Help Online", self,
864
886
  triggered=self._open_ipython_online_help)
@@ -1519,7 +1541,7 @@ class MainWindow(QtWidgets.QMainWindow):
1519
1541
  except (KeyError, NeXusError):
1520
1542
  pass
1521
1543
  elif node.is_plottable():
1522
- dialog = PlotDialog(node, parent=self, lines=True)
1544
+ dialog = PlotDialog(node, lines=True, parent=self)
1523
1545
  dialog.show()
1524
1546
  else:
1525
1547
  raise NeXusError("Data not plottable")
@@ -2140,7 +2162,7 @@ class MainWindow(QtWidgets.QMainWindow):
2140
2162
 
2141
2163
  def new_plot_window(self):
2142
2164
  """Create a new plot window"""
2143
- return NXPlotView(parent=self)
2165
+ return NXPlotView()
2144
2166
 
2145
2167
  def close_window(self):
2146
2168
  """
@@ -2469,7 +2491,7 @@ class MainWindow(QtWidgets.QMainWindow):
2469
2491
  webbrowser.open(url, new=1, autoraise=True)
2470
2492
 
2471
2493
  def _open_nexusformat_online_notebook(self):
2472
- """Open the Nexusformat online notebook in a web browser."""
2494
+ """Open the nexusformat online notebook in a web browser."""
2473
2495
  url = (
2474
2496
  "https://colab.research.google.com/github/nexpy/nexusformat/blob/"
2475
2497
  "master/src/nexusformat/notebooks/nexusformat.ipynb")
@@ -2480,6 +2502,26 @@ class MainWindow(QtWidgets.QMainWindow):
2480
2502
  url = "http://download.nexusformat.org/doc/html/classes/base_classes/"
2481
2503
  webbrowser.open(url, new=1, autoraise=True)
2482
2504
 
2505
+ def _open_nexpy_release_notes(self):
2506
+ """Open NeXpy release notes in a web browser."""
2507
+ url = "https://github.com/nexpy/nexpy/releases"
2508
+ webbrowser.open(url, new=1, autoraise=True)
2509
+
2510
+ def _open_nexpy_issues(self):
2511
+ """Open NeXpy issues in a web browser."""
2512
+ url = "https://github.com/nexpy/nexpy/issues"
2513
+ webbrowser.open(url, new=1, autoraise=True)
2514
+
2515
+ def _open_nexusformat_release_notes(self):
2516
+ """Open nexusformat release notes in a web browser."""
2517
+ url = "https://github.com/nexpy/nexusformat/releases"
2518
+ webbrowser.open(url, new=1, autoraise=True)
2519
+
2520
+ def _open_nexusformat_issues(self):
2521
+ """Open nexusformat issues in a web browser."""
2522
+ url = "https://github.com/nexpy/nexusformat/issues"
2523
+ webbrowser.open(url, new=1, autoraise=True)
2524
+
2483
2525
  def _open_ipython_online_help(self):
2484
2526
  """Open the IPython online help in a web browser."""
2485
2527
  url = "https://ipython.readthedocs.io/en/stable/"
@@ -2650,20 +2692,6 @@ class MainWindow(QtWidgets.QMainWindow):
2650
2692
  except Exception:
2651
2693
  pass
2652
2694
 
2653
- def close_widgets(self):
2654
- """
2655
- Close all open dialog windows, including plot windows
2656
- other than the main window.
2657
- """
2658
- windows = self.dialogs
2659
- windows += [self.plotviews[pv]
2660
- for pv in self.plotviews if pv != 'Main']
2661
- for window in windows:
2662
- try:
2663
- window.close()
2664
- except Exception:
2665
- pass
2666
-
2667
2695
  def closeEvent(self, event):
2668
2696
  """Customize the close event to confirm request to quit."""
2669
2697
  if confirm_action("Are you sure you want to quit NeXpy?",
@@ -2671,7 +2699,6 @@ class MainWindow(QtWidgets.QMainWindow):
2671
2699
  self.console.kernel_client.stop_channels()
2672
2700
  self.console.kernel_manager.shutdown_kernel()
2673
2701
  self.close_files()
2674
- self.close_widgets()
2675
2702
  logging.info('NeXpy closed\n'+80*'-')
2676
2703
  self._app.quit()
2677
2704
  return event.accept()
@@ -62,10 +62,10 @@ from nexusformat.nexus import NeXusError, NXdata, NXfield
62
62
  from .dialogs import (CustomizeDialog, ExportDialog, LimitDialog,
63
63
  ProjectionDialog, ScanDialog, StyleDialog)
64
64
  from .utils import (boundaries, centers, display_message, divgray_map,
65
- find_nearest, fix_projection, get_color, in_dark_mode,
66
- iterable, keep_data, load_image, parula_map, report_error,
67
- report_exception, resource_file, resource_icon,
68
- rotate_data, rotate_point, xtec_map)
65
+ find_nearest, fix_projection, get_color, get_mainwindow,
66
+ in_dark_mode, iterable, keep_data, load_image, parula_map,
67
+ report_error, report_exception, resource_file,
68
+ resource_icon, rotate_data, rotate_point, xtec_map)
69
69
  from .widgets import (NXCheckBox, NXcircle, NXComboBox, NXDoubleSpinBox,
70
70
  NXellipse, NXLabel, NXline, NXLineEdit, NXpolygon,
71
71
  NXPushButton, NXrectangle, NXSlider, NXSpinBox,
@@ -192,13 +192,6 @@ def get_plotview():
192
192
  class NXCanvas(FigureCanvas):
193
193
  """Subclass of Matplotlib's FigureCanvas."""
194
194
 
195
- def __init__(self, figure):
196
-
197
- FigureCanvas.__init__(self, figure)
198
-
199
- self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
200
- QtWidgets.QSizePolicy.MinimumExpanding)
201
-
202
195
  def get_default_filename(self):
203
196
  """Return a string suitable for use as a default filename."""
204
197
  basename = (self.manager.get_window_title().replace('NeXpy: ', '')
@@ -316,7 +309,7 @@ class NXPlotView(QtWidgets.QDialog):
316
309
  y-axis, and 2 for the x-axis.
317
310
  """
318
311
 
319
- def __init__(self, label=None, parent=None):
312
+ def __init__(self, label=None, mainwindow=None, parent=None):
320
313
 
321
314
  """
322
315
  Initialize the NXPlotView window.
@@ -328,21 +321,22 @@ class NXPlotView(QtWidgets.QDialog):
328
321
  used as the key to select an instance in the 'dialogs' dictionary.
329
322
  If a label is not given, the window will be labeled as
330
323
  "Figure 1", "Figure 2", etc.
324
+ mainwindow : QMainWindow, optional
325
+ The main window of the application, by default None
331
326
  parent : QWidget, optional
332
327
  The parent window of the dialog, by default None
333
328
  """
334
- if parent is not None:
335
- self.mainwindow = parent
329
+
330
+
331
+ if mainwindow:
332
+ self.mainwindow = mainwindow
336
333
  else:
337
- from .consoleapp import _mainwindow
338
- self.mainwindow = _mainwindow
334
+ self.mainwindow = get_mainwindow()
339
335
  parent = self.mainwindow
340
336
 
341
- super().__init__(parent)
337
+ super().__init__(parent=parent)
342
338
 
343
339
  self.setMinimumSize(750, 550)
344
- self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
345
- QtWidgets.QSizePolicy.MinimumExpanding)
346
340
  self.setFocusPolicy(QtCore.Qt.ClickFocus)
347
341
 
348
342
  if label in plotviews:
@@ -382,7 +376,7 @@ class NXPlotView(QtWidgets.QDialog):
382
376
  self.ytab = NXPlotTab('y', plotview=self)
383
377
  self.ztab = NXPlotTab('z', zaxis=True, plotview=self)
384
378
  self.ptab = NXProjectionTab(plotview=self)
385
- self.otab = NXNavigationToolbar(self.canvas, self.tab_widget)
379
+ self.otab = NXNavigationToolbar(self.canvas)
386
380
  self.figuremanager.toolbar = self.otab
387
381
  self.tab_widget.addTab(self.xtab, 'x')
388
382
  self.tab_widget.addTab(self.ytab, 'y')
@@ -672,8 +666,8 @@ class NXPlotView(QtWidgets.QDialog):
672
666
  self.canvas._update_screen(self.screen)
673
667
  except Exception:
674
668
  pass
675
- self.canvas.activateWindow()
676
- self.canvas.setFocus()
669
+ self.activateWindow()
670
+ self.setFocus()
677
671
  self.update_active()
678
672
 
679
673
  def update_active(self):
@@ -1470,6 +1464,8 @@ class NXPlotView(QtWidgets.QDialog):
1470
1464
  """
1471
1465
  if self.colorbar:
1472
1466
  if Version(mpl.__version__) >= Version('3.1.0'):
1467
+ self.set_data_norm()
1468
+ self.image.set_norm(self.norm)
1473
1469
  self.colorbar.update_normal(self.image)
1474
1470
  else:
1475
1471
  self.colorbar.set_norm(self.norm)
@@ -3016,7 +3012,6 @@ class NXPlotView(QtWidgets.QDialog):
3016
3012
  def closeEvent(self, event):
3017
3013
  """Close this widget and mark it for deletion."""
3018
3014
  self.close_view()
3019
- self.deleteLater()
3020
3015
  event.accept()
3021
3016
 
3022
3017
  def close(self):
@@ -3986,7 +3981,7 @@ class NXPlotTab(QtWidgets.QWidget):
3986
3981
  _pause_icon = resource_icon('pause-icon.png')
3987
3982
  _forward_icon = resource_icon('forward-icon.png')
3988
3983
  _refresh_icon = resource_icon('refresh-icon.png')
3989
- self.toolbar = QtWidgets.QToolBar(parent=self)
3984
+ self.toolbar = QtWidgets.QToolBar()
3990
3985
  self.toolbar.setIconSize(QtCore.QSize(16, 16))
3991
3986
  self.add_action(_refresh_icon, self.plotview.replot_data, "Replot",
3992
3987
  checkable=False)
@@ -4378,7 +4373,7 @@ class NXNavigationToolbar(NavigationToolbar2QT, QtWidgets.QToolBar):
4378
4373
  ('Add', 'Add plot data to tree', 'hand', 'add_data')
4379
4374
  )
4380
4375
 
4381
- def __init__(self, canvas, parent=None, coordinates=True):
4376
+ def __init__(self, canvas, coordinates=True):
4382
4377
  """
4383
4378
  Initialize the navigation toolbar.
4384
4379
 
@@ -4392,11 +4387,11 @@ class NXNavigationToolbar(NavigationToolbar2QT, QtWidgets.QToolBar):
4392
4387
  Whether to display the coordinates of the mouse position, by
4393
4388
  default True
4394
4389
  """
4395
- QtWidgets.QToolBar.__init__(self, parent=parent)
4390
+ QtWidgets.QToolBar.__init__(self)
4396
4391
  self.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
4397
4392
 
4398
4393
  self.coordinates = coordinates
4399
- self._actions = {} # mapping of toolitem method names to QActions.
4394
+ self._actions = {}
4400
4395
  self._subplot_dialog = None
4401
4396
 
4402
4397
  for text, tooltip_text, image_file, callback in self.toolitems:
@@ -4521,8 +4516,11 @@ class NXNavigationToolbar(NavigationToolbar2QT, QtWidgets.QToolBar):
4521
4516
  def release_zoom(self, event):
4522
4517
  """The release mouse button callback in zoom mode."""
4523
4518
  if event.button == 1:
4524
- super().release_zoom(event)
4525
- self._update_release()
4519
+ try:
4520
+ super().release_zoom(event)
4521
+ self._update_release()
4522
+ except ValueError:
4523
+ self.release(event)
4526
4524
  elif event.button == 3:
4527
4525
  self.plotview.zoom = None
4528
4526
  if not event.inaxes:
@@ -4612,6 +4610,10 @@ class NXNavigationToolbar(NavigationToolbar2QT, QtWidgets.QToolBar):
4612
4610
  self.plotview.ytab.set_sliders(ymin, ymax)
4613
4611
  self.plotview.ytab.block_signals(False)
4614
4612
  if self.plotview.image:
4613
+ if isinstance(self.plotview.image.norm, LogNorm):
4614
+ self.plotview.vtab.log = True
4615
+ else:
4616
+ self.plotview.vtab.log = False
4615
4617
  self.plotview.update_colorbar()
4616
4618
  self.plotview.update_panels()
4617
4619
 
@@ -94,7 +94,9 @@ class NXtree(NXgroup):
94
94
  for row in range(self._item.rowCount()):
95
95
  for item in self._item.child(row).walk():
96
96
  self.sync_children(item)
97
- self._view.dataChanged(self._item.index(), self._item.index())
97
+ index = self._item.index()
98
+ if index.isValid():
99
+ self._view.dataChanged(index, index)
98
100
  self._view.update()
99
101
  self._view.status_message(self._view.node)
100
102
 
@@ -427,7 +429,7 @@ class NXTreeItem(QtGui.QStandardItem):
427
429
 
428
430
  class NXTreeView(QtWidgets.QTreeView):
429
431
 
430
- def __init__(self, tree, parent=None):
432
+ def __init__(self, tree, mainwindow):
431
433
  """
432
434
  Initialize a NeXus tree view.
433
435
 
@@ -435,13 +437,15 @@ class NXTreeView(QtWidgets.QTreeView):
435
437
  ----------
436
438
  tree : NXtree
437
439
  The root of the tree.
440
+ mainwindow : NXMainWindow
441
+ The main window of the application.
438
442
  parent : QWidget, optional
439
443
  The parent of the view.
440
444
  """
441
- super().__init__(parent=parent)
445
+ super().__init__()
442
446
 
443
447
  self.tree = tree
444
- self.mainwindow = parent
448
+ self.mainwindow = mainwindow
445
449
  self._model = QtGui.QStandardItemModel()
446
450
  self.proxymodel = NXSortModel(self)
447
451
  self.proxymodel.setSourceModel(self._model)
@@ -165,6 +165,12 @@ def run_pythonw(script_path):
165
165
  warnings.warn(msg)
166
166
 
167
167
 
168
+ def get_mainwindow():
169
+ """Return the NeXpy main window"""
170
+ from .consoleapp import _mainwindow
171
+ return _mainwindow
172
+
173
+
168
174
  def is_file_locked(filename, wait=5, expiry=None):
169
175
  """
170
176
  Check if a file is locked.
@@ -891,8 +897,8 @@ def in_dark_mode():
891
897
  True if the application is in dark mode, False otherwise.
892
898
  """
893
899
  try:
894
- from .consoleapp import _mainwindow
895
- app = _mainwindow.app.app
900
+ mainwindow = get_mainwindow()
901
+ app = mainwindow.app.app
896
902
  return (app.palette().window().color().value() <
897
903
  app.palette().windowText().color().value())
898
904
  except Exception:
@@ -910,22 +916,22 @@ def define_mode():
910
916
  This function is typically called when the application is first
911
917
  launched or when the user changes the display mode from the menu.
912
918
  """
913
- from .consoleapp import _mainwindow
919
+ mainwindow = get_mainwindow()
914
920
  if in_dark_mode():
915
- _mainwindow.console.set_default_style('linux')
916
- _mainwindow.statusBar().setPalette(_mainwindow.app.app.palette())
921
+ mainwindow.console.set_default_style('linux')
922
+ mainwindow.statusBar().setPalette(mainwindow.app.app.palette())
917
923
  else:
918
- _mainwindow.console.set_default_style()
919
- _mainwindow.statusBar().setPalette(_mainwindow.app.app.palette())
924
+ mainwindow.console.set_default_style()
925
+ mainwindow.statusBar().setPalette(mainwindow.app.app.palette())
920
926
 
921
- for dialog in _mainwindow.dialogs:
927
+ for dialog in mainwindow.dialogs:
922
928
  if dialog.windowTitle() == 'Script Editor':
923
929
  for tab in [dialog.tabs[t] for t in dialog.tabs]:
924
930
  tab.define_style()
925
931
  elif dialog.windowTitle().startswith('Log File'):
926
932
  dialog.format_log()
927
933
 
928
- for plotview in _mainwindow.plotviews.values():
934
+ for plotview in mainwindow.plotviews.values():
929
935
  if in_dark_mode():
930
936
  plotview.otab.setStyleSheet('color: white')
931
937
  else:
@@ -19,7 +19,8 @@ from nexusformat.nexus import NeXusError, NXfield, NXroot
19
19
 
20
20
  from .pyqt import QtCore, QtGui, QtWidgets, getOpenFileName
21
21
  from .utils import (boundaries, confirm_action, display_message, find_nearest,
22
- format_float, get_color, natural_sort, report_error)
22
+ format_float, get_color, get_mainwindow, natural_sort,
23
+ report_error)
23
24
 
24
25
  warnings.filterwarnings("ignore", category=DeprecationWarning)
25
26
 
@@ -1136,13 +1137,12 @@ class NXDialog(QtWidgets.QDialog, NXWidget):
1136
1137
  -----
1137
1138
  If parent is None, the parent will be set to the main window.
1138
1139
  """
1139
- from .consoleapp import _mainwindow
1140
- self.mainwindow = _mainwindow
1140
+ self.mainwindow = get_mainwindow()
1141
1141
  if parent is None:
1142
1142
  parent = self.mainwindow
1143
1143
  QtWidgets.QDialog.__init__(self, parent=parent)
1144
1144
  self.set_attributes()
1145
- self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
1145
+ self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
1146
1146
  self.setSizeGripEnabled(True)
1147
1147
  self.mainwindow.dialogs.append(self)
1148
1148
  if not default:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes