NeXpy 2.0.0b1__tar.gz → 2.0.0b2__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.0b1 → nexpy-2.0.0b2}/PKG-INFO +3 -5
  2. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/conda-recipe/meta.yaml +0 -3
  3. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/pyproject.toml +2 -5
  4. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/PKG-INFO +3 -5
  5. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/SOURCES.txt +1 -0
  6. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/requires.txt +2 -4
  7. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/_version.py +2 -2
  8. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +3 -2
  9. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +3 -2
  10. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/consoleapp.py +91 -125
  11. nexpy-2.0.0b2/src/nexpy/gui/datadialogs.py +17 -0
  12. nexpy-2.0.0b1/src/nexpy/gui/datadialogs.py → nexpy-2.0.0b2/src/nexpy/gui/dialogs.py +1993 -1302
  13. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/fitdialogs.py +781 -41
  14. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/importdialog.py +24 -9
  15. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/mainwindow.py +467 -26
  16. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/plotview.py +617 -107
  17. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/pyqt.py +3 -0
  18. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/scripteditor.py +135 -7
  19. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/treeview.py +327 -4
  20. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/utils.py +176 -51
  21. nexpy-2.0.0b2/src/nexpy/gui/widgets.py +4267 -0
  22. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/nexpygui.py +2 -2
  23. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/tests/test_imports.py +1 -1
  24. nexpy-2.0.0b1/src/nexpy/gui/widgets.py +0 -1445
  25. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/.gitattributes +0 -0
  26. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/.github/dependabot.yaml +0 -0
  27. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/.github/workflows/ci.yml +0 -0
  28. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/.gitignore +0 -0
  29. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/COPYING +0 -0
  30. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/README.md +0 -0
  31. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/README.rst +0 -0
  32. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/conda-recipe/bld.bat +0 -0
  33. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/conda-recipe/build.sh +0 -0
  34. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/Makefile +0 -0
  35. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/make.bat +0 -0
  36. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/_static/__ignore__.txt +0 -0
  37. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/conf.py +0 -0
  38. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/examples.rst +0 -0
  39. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/favicon.ico +0 -0
  40. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/axis-limits-bar.png +0 -0
  41. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/customize-panel.png +0 -0
  42. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/limits-panel.png +0 -0
  43. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/nexpy-fits.png +0 -0
  44. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/nexpy-gui.png +0 -0
  45. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/nexpy-logo.png +0 -0
  46. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/options-tab.png +0 -0
  47. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/projection-panel.png +0 -0
  48. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/projection-tab.png +0 -0
  49. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/scan-panel.png +0 -0
  50. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/signal-tab.png +0 -0
  51. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/simple-plot.png +0 -0
  52. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/skewed-axis.png +0 -0
  53. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/x-tab.png +0 -0
  54. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/y-tab.png +0 -0
  55. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/z-tab.png +0 -0
  56. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/images/z-toolbar.png +0 -0
  57. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/includeme.rst +0 -0
  58. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/index.rst +0 -0
  59. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/pythongui.rst +0 -0
  60. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/pythonshell.rst +0 -0
  61. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/readers.rst +0 -0
  62. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/doc/source/treeapi.rst +0 -0
  63. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/setup.cfg +0 -0
  64. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/dependency_links.txt +0 -0
  65. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/entry_points.txt +0 -0
  66. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/pbr.json +0 -0
  67. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/NeXpy.egg-info/top_level.txt +0 -0
  68. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/__init__.py +0 -0
  69. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/__init__.py +0 -0
  70. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/__init__.py +0 -0
  71. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/fit.py +0 -0
  72. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/models/__init__.py +0 -0
  73. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/models/bose.py +0 -0
  74. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/models/critexp.py +0 -0
  75. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/models/op.py +0 -0
  76. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/api/frills/models/pdfdecay.py +0 -0
  77. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/README.rst +0 -0
  78. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/chopper.nxs +0 -0
  79. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/example.nxs +0 -0
  80. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/README.rst +0 -0
  81. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
  82. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
  83. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
  84. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
  85. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
  86. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/scripts/README.rst +0 -0
  87. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
  88. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/examples/scripts/example.py +0 -0
  89. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/__init__.py +0 -0
  90. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/NeXpy.png +0 -0
  91. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/NeXpy.svg +0 -0
  92. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/back.png +0 -0
  93. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/backward-icon.png +0 -0
  94. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/customize.png +0 -0
  95. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/equal.png +0 -0
  96. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/export-data.png +0 -0
  97. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/export-figure.png +0 -0
  98. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/filesave.png +0 -0
  99. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/forward-icon.png +0 -0
  100. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/forward.png +0 -0
  101. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/hand.png +0 -0
  102. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/home.png +0 -0
  103. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/link-icon.png +0 -0
  104. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/lock-icon.png +0 -0
  105. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
  106. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/modify-style.png +0 -0
  107. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/move.png +0 -0
  108. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/pause-icon.png +0 -0
  109. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/refresh-icon.png +0 -0
  110. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/unlock-icon.png +0 -0
  111. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
  112. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
  113. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/readers/__init__.py +0 -0
  114. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/readers/readspec.py +0 -0
  115. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/readers/readstack.py +0 -0
  116. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/src/nexpy/readers/readtiff.py +0 -0
  117. {nexpy-2.0.0b1 → nexpy-2.0.0b2}/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.0b1
3
+ Version: 2.0.0b2
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
@@ -85,8 +85,6 @@ Requires-Dist: ansi2html
85
85
  Requires-Dist: fabio
86
86
  Requires-Dist: h5py
87
87
  Requires-Dist: ipython
88
- Requires-Dist: jupyter_client
89
- Requires-Dist: jupyter_core
90
88
  Requires-Dist: lmfit
91
89
  Requires-Dist: matplotlib
92
90
  Requires-Dist: mplcursors
@@ -99,8 +97,8 @@ Requires-Dist: pylatexenc
99
97
  Requires-Dist: qtconsole
100
98
  Requires-Dist: qtpy
101
99
  Requires-Dist: scipy
102
- Requires-Dist: traitlets
103
- Requires-Dist: importlib_resources; python_version <= "3.9"
100
+ Requires-Dist: importlib_metadata; python_version < "3.10"
101
+ Requires-Dist: importlib_resources; python_version < "3.10"
104
102
  Provides-Extra: testing
105
103
  Requires-Dist: pytest; extra == "testing"
106
104
  Provides-Extra: spec
@@ -24,8 +24,6 @@ requirements:
24
24
  - fabio
25
25
  - h5py
26
26
  - ipython
27
- - jupyter_client
28
- - jupyter_core
29
27
  - lmfit
30
28
  - matplotlib
31
29
  - mplcursors
@@ -38,7 +36,6 @@ requirements:
38
36
  - qtconsole
39
37
  - qtpy
40
38
  - scipy
41
- - traitlets
42
39
 
43
40
  test:
44
41
  imports:
@@ -37,8 +37,6 @@ dependencies = [
37
37
  "fabio",
38
38
  "h5py",
39
39
  "ipython",
40
- "jupyter_client",
41
- "jupyter_core",
42
40
  "lmfit",
43
41
  "matplotlib",
44
42
  "mplcursors",
@@ -51,8 +49,8 @@ dependencies = [
51
49
  "qtconsole",
52
50
  "qtpy",
53
51
  "scipy",
54
- "traitlets",
55
- "importlib_resources; python_version <= '3.9'"
52
+ "importlib_metadata; python_version < '3.10'",
53
+ "importlib_resources; python_version < '3.10'"
56
54
  ]
57
55
 
58
56
  [project.optional-dependencies]
@@ -75,5 +73,4 @@ version_file = "src/nexpy/_version.py"
75
73
  [tool.setuptools.package-data]
76
74
  "nexpy.gui.frills.models" = ["*.py"]
77
75
  "nexpy.gui.resources" = ["*.*"]
78
- "nexpy.definitions" = ["*/*.xml"]
79
76
  "nexpy.examples" = ["*.*", "*/*.*", "*/*/*.*", "*/*/*/*.*"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeXpy
3
- Version: 2.0.0b1
3
+ Version: 2.0.0b2
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
@@ -85,8 +85,6 @@ Requires-Dist: ansi2html
85
85
  Requires-Dist: fabio
86
86
  Requires-Dist: h5py
87
87
  Requires-Dist: ipython
88
- Requires-Dist: jupyter_client
89
- Requires-Dist: jupyter_core
90
88
  Requires-Dist: lmfit
91
89
  Requires-Dist: matplotlib
92
90
  Requires-Dist: mplcursors
@@ -99,8 +97,8 @@ Requires-Dist: pylatexenc
99
97
  Requires-Dist: qtconsole
100
98
  Requires-Dist: qtpy
101
99
  Requires-Dist: scipy
102
- Requires-Dist: traitlets
103
- Requires-Dist: importlib_resources; python_version <= "3.9"
100
+ Requires-Dist: importlib_metadata; python_version < "3.10"
101
+ Requires-Dist: importlib_resources; python_version < "3.10"
104
102
  Provides-Extra: testing
105
103
  Requires-Dist: pytest; extra == "testing"
106
104
  Provides-Extra: spec
@@ -73,6 +73,7 @@ src/nexpy/examples/scripts/example.py
73
73
  src/nexpy/gui/__init__.py
74
74
  src/nexpy/gui/consoleapp.py
75
75
  src/nexpy/gui/datadialogs.py
76
+ src/nexpy/gui/dialogs.py
76
77
  src/nexpy/gui/fitdialogs.py
77
78
  src/nexpy/gui/importdialog.py
78
79
  src/nexpy/gui/mainwindow.py
@@ -2,8 +2,6 @@ ansi2html
2
2
  fabio
3
3
  h5py
4
4
  ipython
5
- jupyter_client
6
- jupyter_core
7
5
  lmfit
8
6
  matplotlib
9
7
  mplcursors
@@ -16,9 +14,9 @@ pylatexenc
16
14
  qtconsole
17
15
  qtpy
18
16
  scipy
19
- traitlets
20
17
 
21
- [:python_version <= "3.9"]
18
+ [:python_version < "3.10"]
19
+ importlib_metadata
22
20
  importlib_resources
23
21
 
24
22
  [spec]
@@ -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.0b1'
21
- __version_tuple__ = version_tuple = (2, 0, 0, 'b1')
20
+ __version__ = version = '2.0.0b2'
21
+ __version_tuple__ = version_tuple = (2, 0, 0, 'b2')
@@ -1,9 +1,10 @@
1
1
  import numpy as np
2
- from nexpy.gui.datadialogs import GridParameters, NXDialog
3
- from nexpy.gui.utils import report_error
4
2
  from nexusformat.nexus import NeXusError, NXdata, NXfield
5
3
  from nexusformat.nexus.tree import centers
6
4
 
5
+ from nexpy.gui.utils import report_error
6
+ from nexpy.gui.widgets import GridParameters, NXDialog
7
+
7
8
 
8
9
  def show_dialog():
9
10
  try:
@@ -1,8 +1,9 @@
1
1
  import numpy as np
2
- from nexpy.gui.datadialogs import GridParameters, NXDialog
3
- from nexpy.gui.utils import report_error
4
2
  from nexusformat.nexus import NeXusError
5
3
 
4
+ from nexpy.gui.utils import report_error
5
+ from nexpy.gui.widgets import GridParameters, NXDialog
6
+
6
7
 
7
8
  def show_dialog():
8
9
  try:
@@ -17,125 +17,40 @@ import shutil
17
17
  import signal
18
18
  import sys
19
19
  import tempfile
20
- from importlib.metadata import entry_points
21
20
  from pathlib import Path
22
21
 
23
22
  from IPython import __version__ as ipython_version
24
- from jupyter_client.consoleapp import JupyterConsoleApp, app_aliases, app_flags
25
- from jupyter_core.application import JupyterApp, base_aliases, base_flags
26
23
  from matplotlib import __version__ as mpl_version
27
24
  from nexusformat.nexus import NXroot, nxclasses, nxversion
28
- from qtconsole import __version__
29
- from qtconsole.jupyter_widget import JupyterWidget
30
- from qtconsole.rich_jupyter_widget import RichJupyterWidget
31
- from traitlets import Any, CBool, Dict, Unicode
32
- from traitlets.config.application import boolean_flag, catch_config_error
25
+ from qtconsole.qtconsoleapp import JupyterQtConsoleApp
33
26
 
34
27
  from .. import __version__ as nexpy_version
35
28
  from .mainwindow import MainWindow
36
29
  from .pyqt import QtCore, QtGui, QtVersion, QtWidgets
37
30
  from .treeview import NXtree
38
31
  from .utils import (NXConfigParser, NXGarbageCollector, NXLogger, define_mode,
39
- initialize_settings, report_exception, resource_icon,
40
- timestamp_age)
32
+ entry_points, initialize_settings, report_exception,
33
+ resource_icon, timestamp_age)
41
34
 
42
- # -----------------------------------------------------------------------------
43
- # Globals
44
- # -----------------------------------------------------------------------------
45
35
 
46
36
  _tree = None
47
37
  _shell = None
48
38
  _mainwindow = None
49
39
  _nexpy_dir = None
50
- _examples = """
51
- nexpy # start the GUI application
52
- """
53
-
54
- # -----------------------------------------------------------------------------
55
- # Aliases and Flags
56
- # -----------------------------------------------------------------------------
57
-
58
- flags = dict(base_flags)
59
- qt_flags = {'plain': ({'NXConsoleApp': {'plain': True}},
60
- "Disable rich text support.")}
61
- qt_flags.update(boolean_flag(
62
- 'banner', 'NXConsoleApp.display_banner',
63
- "Display a banner upon starting the QtConsole.",
64
- "Don't display a banner upon starting the QtConsole."
65
- ))
66
- qt_flags.update(app_flags)
67
- flags.update(qt_flags)
68
-
69
- aliases = dict(base_aliases)
70
- qt_aliases = dict(style='JupyterWidget.syntax_style',
71
- stylesheet='NXConsoleApp.stylesheet',
72
- editor='JupyterWidget.editor',
73
- paging='ConsoleWidget.paging')
74
- qt_aliases.update(app_aliases)
75
- qt_aliases.update({'gui-completion': 'ConsoleWidget.gui_completion'})
76
- aliases.update(qt_aliases)
77
-
78
- qt_aliases = set(qt_aliases)
79
- qt_flags = set(qt_flags)
80
-
81
- # -----------------------------------------------------------------------------
82
- # NXConsoleApp
83
- # -----------------------------------------------------------------------------
84
-
85
-
86
- class NXConsoleApp(JupyterApp, JupyterConsoleApp):
87
- name = 'nexpy-console'
88
- version = __version__
89
- description = """
90
- The NeXpy Console.
91
-
92
- This launches a Console-style application using Qt.
93
-
94
- The console is embedded in a GUI that contains a tree view of
95
- all NXroot groups and a matplotlib plotting pane. It also has all
96
- the added benefits of a Jupyter Qt Console with multiline editing,
97
- autocompletion, tooltips, command line histories and the ability to
98
- save your session as HTML or print the output.
99
-
100
- """
101
- examples = _examples
102
40
 
103
- classes = [JupyterWidget] + JupyterConsoleApp.classes
104
- flags = Dict(flags)
105
- aliases = Dict(aliases)
106
- frontend_flags = Any(qt_flags)
107
- frontend_aliases = Any(qt_aliases)
108
41
 
109
- stylesheet = Unicode('', config=True,
110
- help="path to a custom CSS stylesheet")
111
-
112
- hide_menubar = CBool(
113
- False, config=True,
114
- help="Start the console window with the menu bar hidden.")
115
-
116
- plain = CBool(False, config=True,
117
- help="Use a plaintext widget instead of rich text.")
118
-
119
- display_banner = CBool(
120
- True, config=True,
121
- help="Whether to display a banner upon starting the QtConsole.")
122
-
123
- def _plain_changed(self, name, old, new):
124
- kind = 'plain' if new else 'rich'
125
- self.config.ConsoleWidget.kind = kind
126
- if new:
127
- self.widget_factory = JupyterWidget
128
- else:
129
- self.widget_factory = RichJupyterWidget
130
-
131
- widget_factory = Any(RichJupyterWidget)
132
-
133
- def parse_command_line(self, argv=None):
134
- super().parse_command_line(argv)
135
- self.build_kernel_argv(argv)
42
+ class NXConsoleApp(JupyterQtConsoleApp):
136
43
 
137
44
  def init_dir(self):
138
- """Initialize NeXpy home directory"""
45
+ """
46
+ Initialize the NeXpy directory.
47
+
48
+ This method creates the NeXpy directory tree and scratch file if
49
+ they do not already exist. The NeXpy directory is created in the
50
+ user's home directory as ~/.nexpy. If the user does not have
51
+ write access to the home directory, a temporary directory is
52
+ created instead.
53
+ """
139
54
  nexpy_dir = Path.home() / '.nexpy'
140
55
  if not nexpy_dir.exists():
141
56
  if not os.access(Path.home(), os.W_OK):
@@ -158,7 +73,13 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
158
73
  NXroot().save(self.scratch_file)
159
74
 
160
75
  def init_settings(self):
161
- """Initialize access to the NeXpy settings file."""
76
+ """
77
+ Initialize NeXpy settings.
78
+
79
+ This method initializes the NeXpy settings file located at
80
+ ~/.nexpy/settings.ini. If the file does not exist, it is
81
+ created. Any backups that are older than 5 days are removed.
82
+ """
162
83
  self.settings_file = self.nexpy_dir / 'settings.ini'
163
84
  self.settings = NXConfigParser(self.settings_file)
164
85
  initialize_settings(self.settings)
@@ -185,7 +106,14 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
185
106
  self.settings.save()
186
107
 
187
108
  def init_log(self):
188
- """Initialize the NeXpy logger."""
109
+ """
110
+ Initialize the NeXpy log file.
111
+
112
+ The log file is named 'nexpy.log' and is located in the NeXpy
113
+ home directory. The log file is rotated every 50KB. The log
114
+ level is set to 'INFO' unless the environment variable NEXPY_LOG
115
+ is set to 'DEBUG', 'INFO', 'WARNING', 'ERROR', or 'CRITICAL'.
116
+ """
189
117
  log_file = self.nexpy_dir / 'nexpy.log'
190
118
  handler = logging.handlers.RotatingFileHandler(log_file,
191
119
  maxBytes=50000,
@@ -221,7 +149,8 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
221
149
  sys.stdout = sys.stderr = NXLogger()
222
150
 
223
151
  def init_plugins(self):
224
- """Initialize the NeXpy plugins."""
152
+ """Initialize plugins, readers, and writers."""
153
+ eps = entry_points()
225
154
  def initialize_plugin(plugin_group, plugin_dir):
226
155
  plugin = None
227
156
  plugins = self.settings.options(plugin_group)
@@ -231,7 +160,8 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
231
160
  plugin = str(path)
232
161
  if plugin not in plugins:
233
162
  self.settings.set(plugin_group, plugin, value=None)
234
- for entry in entry_points(group='nexpy.'+plugin_group):
163
+ group_name = 'nexpy.' + plugin_group
164
+ for entry in eps.select(group=group_name):
235
165
  plugin = entry.module
236
166
  if plugin not in plugins:
237
167
  self.settings.set(plugin_group, plugin, value=None)
@@ -240,17 +170,27 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
240
170
  initialize_plugin('writers', self.writer_dir)
241
171
 
242
172
  def init_tree(self):
243
- """Initialize the NeXus tree used in the tree view."""
173
+ """Initialize the root element of the NeXpy tree view."""
244
174
  global _tree
245
175
  self.tree = NXtree()
246
176
  _tree = self.tree
247
177
 
248
178
  def init_config(self):
179
+ """Initialize the configuration options for the NeXpy console."""
249
180
  self.config.ConsoleWidget.input_sep = ''
250
181
  self.config.Completer.use_jedi = False
182
+ self.config.InteractiveShell.enable_tip = False
251
183
 
252
184
  def init_gui(self):
253
- """Initialize the GUI."""
185
+ """
186
+ Initialize the NeXpy graphical user interface.
187
+
188
+ This creates a QApplication instance if it does not exist, sets
189
+ the application name to 'nexpy', and sets the exception hook to
190
+ report exceptions in the log file. A MainWindow is created,
191
+ along with a garbage collector to periodically collect any NeXus
192
+ objects that are no longer referenced.
193
+ """
254
194
  self.app = QtWidgets.QApplication.instance()
255
195
  if self.app is None:
256
196
  self.app = QtWidgets.QApplication(['nexpy'])
@@ -318,29 +258,45 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
318
258
  if args.restore:
319
259
  self.window.restore_session()
320
260
 
321
- def init_colors(self):
322
- """Configure the coloring of the widget"""
261
+ def init_mode(self):
262
+ """Configure the dark/light mode of the NeXpy widgets."""
323
263
  define_mode()
324
264
 
325
265
  def init_signal(self):
326
- """allow clean shutdown on sigint"""
266
+ """
267
+ Initialize the signal handler for the application.
268
+
269
+ The signal handler is configured to start a timer, so that the
270
+ interpreter will be given a chance to run every 200
271
+ milliseconds. This is necessary because the application could be
272
+ blocked waiting for a real Qt event to occur, and the signal
273
+ handler needs to have a chance to run.
274
+
275
+ This code is based on the following code from Stack Overflow:
276
+ http://stackoverflow.com/q/4938723/938949
277
+ """
327
278
  signal.signal(signal.SIGINT, lambda sig, frame: self.exit(-2))
328
- # need a timer, so that QApplication doesn't block until a real
329
- # Qt event fires (can require mouse movement)
330
- # timer trick from http://stackoverflow.com/q/4938723/938949
331
279
  timer = QtCore.QTimer()
332
- # Let the interpreter run each 200 ms:
333
280
  timer.timeout.connect(lambda: None)
334
281
  timer.start(200)
335
- # hold onto ref, so the timer doesn't get cleaned up
336
282
  self._sigint_timer = timer
337
283
 
338
- @catch_config_error
339
- def initialize(self, args, extra_args):
284
+ def initialize(self, args):
285
+ """
286
+ Initialize the NeXpy application.
287
+
288
+ This method is called by JupyterConsoleApp to initialize the
289
+ application. It is responsible for initializing the configuration,
290
+ logging, plugins, tree view, shell and graphical user interface.
291
+
292
+ Parameters
293
+ ----------
294
+ args : argparse.Namespace
295
+ The parsed command line arguments.
296
+ """
340
297
  if args.faulthandler:
341
298
  import faulthandler
342
299
  faulthandler.enable(all_threads=False)
343
- super().initialize(extra_args)
344
300
  self.init_dir()
345
301
  self.init_settings()
346
302
  self.init_log()
@@ -349,20 +305,22 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
349
305
  self.init_config()
350
306
  self.init_gui()
351
307
  self.init_shell(args)
352
- self.init_colors()
308
+ self.init_mode()
353
309
  self.init_signal()
354
310
 
355
311
  def start(self):
356
- super().start()
312
+ """
313
+ Start the application.
357
314
 
358
- # draw the window
359
- self.window.show()
315
+ This method starts the application main loop. It is called by
316
+ JupyterConsoleApp after the application has been initialized.
360
317
 
361
- # Issue startup messages
318
+ This method is responsible for drawing the window, issuing
319
+ startup messages, and starting the application main loop.
320
+ """
321
+ self.window.show()
362
322
  self.window.start()
363
-
364
- # Start the application main loop.
365
- self.app.exec_()
323
+ self.app.exec()
366
324
 
367
325
 
368
326
  # -----------------------------------------------------------------------------
@@ -370,9 +328,17 @@ class NXConsoleApp(JupyterApp, JupyterConsoleApp):
370
328
  # -----------------------------------------------------------------------------
371
329
 
372
330
 
373
- def main(args, extra_args):
331
+ def main(args):
332
+ """
333
+ Main entry point for NeXpy console application.
334
+
335
+ Parameters
336
+ ----------
337
+ args : list of str
338
+ List of command line arguments.
339
+ """
374
340
  app = NXConsoleApp()
375
- app.initialize(args, extra_args)
341
+ app.initialize(args)
376
342
  app.start()
377
343
  sys.exit(0)
378
344
 
@@ -0,0 +1,17 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) 2025, NeXpy Development Team.
3
+ #
4
+ # Distributed under the terms of the Modified BSD License.
5
+ #
6
+ # The full license is in the file COPYING, distributed with this software.
7
+ # -----------------------------------------------------------------------------
8
+ import warnings
9
+
10
+ from .dialogs import *
11
+
12
+ warnings.warn(
13
+ "The module 'nexpy.gui.datadialogs' is deprecated and will be removed " +
14
+ "in a future release. Please use 'nexpy.gui.dialogs' instead.",
15
+ DeprecationWarning,
16
+ stacklevel=2
17
+ )