diff --git a/CHANGELOG b/CHANGELOG index 178cd6e..f576027 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,5 @@ 0.1.0 - - initial working release + - initial prototype release 0.0.3 - fix readme 0.0.1 diff --git a/build-recipes/hook-chipstream.py b/build-recipes/hook-chipstream.py index 62c723e..00e5d5a 100644 --- a/build-recipes/hook-chipstream.py +++ b/build-recipes/hook-chipstream.py @@ -10,6 +10,19 @@ # Hook for MPL-Data-Cast from PyInstaller.utils.hooks import collect_data_files +hiddenimports = [ + "chipstream", + "chipstream.cli", + "chipstream.gui", + "dcnum", + "dcnum.feat", + "dcnum.logic", + "dcnum.meta", + "dcnum.read", + "dcnum.segm", + "dcnum.write", +] + # Data files datas = collect_data_files("chipstream", include_py_files=True) datas += collect_data_files("chipstream", subdir="gui/img") diff --git a/chipstream/gui/__init__.py b/chipstream/gui/__init__.py index c2ad9c7..259c526 100644 --- a/chipstream/gui/__init__.py +++ b/chipstream/gui/__init__.py @@ -4,15 +4,34 @@ PyQt6 = None +class DevNull: + """Effectively a file-like object for piping everything to nothing.""" + def write(self, *args, **kwargs): + pass + + if PyQt6 is None: def main(*args, **kwargs): print("Please install 'chipstream[gui]' to access the GUI!") else: def main(): from importlib import resources + import multiprocessing as mp import sys from PyQt6 import QtWidgets, QtCore, QtGui + mp.freeze_support() + + # In case we have a frozen application, and we encounter errors + # in subprocesses, then these will try to print everything to stdout + # and stderr. However, if we compiled the app with PyInstaller with + # the --noconsole option, sys.stderr and sys.stdout are None and + # an exception is raised, breaking the program. + if sys.stdout is None: + sys.stdout = DevNull() + if sys.stderr is None: + sys.stderr = DevNull() + from .main_window import ChipStream app = QtWidgets.QApplication(sys.argv) diff --git a/chipstream/gui/main_window.py b/chipstream/gui/main_window.py index 9641dc5..c78d66f 100644 --- a/chipstream/gui/main_window.py +++ b/chipstream/gui/main_window.py @@ -13,6 +13,8 @@ from .._version import version +from . import splash + class ChipStream(QtWidgets.QMainWindow): run_completed = QtCore.pyqtSignal() @@ -87,6 +89,8 @@ def __init__(self, *arguments): self.timer.timeout.connect(self.tableView_input.on_selection_changed) self.timer.start(1000) + splash.splash_close() + # finalize self.show() self.activateWindow() diff --git a/chipstream/gui/splash.py b/chipstream/gui/splash.py new file mode 100644 index 0000000..0d2319a --- /dev/null +++ b/chipstream/gui/splash.py @@ -0,0 +1,11 @@ +try: + import pyi_splash +except (ImportError, ModuleNotFoundError): + pyi_splash = None + + +def splash_close(): + """Close the splash screen""" + if pyi_splash is not None: + if pyi_splash.is_alive(): + pyi_splash.close() diff --git a/pyproject.toml b/pyproject.toml index b2673ba..5088255 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,12 +47,6 @@ tracker = "https://github.com/DC-Analysis/ChipStream/issues" documentation = "https://chipstream.readthedocs.io/en/stable/" changelog = "https://chipstream.readthedocs.io/en/stable/sec_changelog.html" -# We need the following, because automatic package discovery does not work -# when running cibuildwheel on GitHub Actions (there will be a "wheelhouse" -# directory). -[tool.setuptools] -packages = ["chipstream"] - [tool.setuptools_scm] write_to = "chipstream/_version.py" version_scheme = "post-release"