Line data Source code
1 : # SPDX-FileCopyrightText: 2025 PairInteraction Developers 2 : # SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : 5 1 : import multiprocessing 6 1 : import sys 7 : 8 1 : from pairinteraction_gui.app import Application 9 1 : from pairinteraction_gui.main_window import MainWindow 10 : 11 1 : __all__ = ["main"] 12 : 13 : 14 1 : def main() -> int: 15 : """Run the PairInteraction GUI application. 16 : 17 : Returns: 18 : int: Application exit code 19 : 20 : """ 21 : # Multithreading together with "fork" is not supported 22 : # (up to python 3.14 "fork" was the default on linux 23 : # see also https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods 24 : # and https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-multiprocessing-start-method) 25 : # We set the start method to "spawn" for all platforms (anyway default on mac and windows) 26 : # TODO instead of multiprocessing it would probably be better to release the GIL during some C++ calls 27 : # see here: https://nanobind.readthedocs.io/en/latest/api_core.html#_CPPv4N8nanobind18gil_scoped_releaseE 28 0 : multiprocessing.set_start_method("spawn") 29 : 30 0 : app = Application(sys.argv) 31 0 : app.setApplicationName("PairInteraction") 32 : 33 0 : app.allow_ctrl_c() 34 : 35 0 : window = MainWindow() 36 0 : window.show() 37 : 38 0 : return app.exec()