File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 11import logging
22import sys
3+ import os
34from PyQt6 .QtWidgets import QApplication
5+ from PyQt6 .QtCore import QTimer
46
57from src .models .barrier_tool_model import BarrierToolModel
68from src .presenters .barrier_tool_presenter import BarrierToolPresenter
79from src .views .barrier_tool_view import BarrierToolView
8-
910from src .utils .logging import setup_logging
1011
11- if __name__ == "__main__" :
12- # Setup logging. Possible values: logging.DEBUG, logging.INFO:
12+
13+ def launch_app (auto_close = False ):
14+ """
15+ Launch the Barrier Tool GUI.
16+
17+ :param auto_close: If True, closes the GUI automatically after 1 second (for testing).
18+ :return: exit code of the QApplication
19+ """
20+ # Setup logging
1321 setup_logging (logging .INFO )
1422
1523 app = QApplication (sys .argv )
1927 presenter = BarrierToolPresenter (model , view )
2028
2129 presenter .show ()
22- sys .exit (app .exec ())
30+
31+ # Auto-close if testing
32+ if auto_close or os .getenv ("AUTO_CLOSE_GUI" ) == "1" :
33+ QTimer .singleShot (1000 , app .quit ) # quit after 1 second
34+
35+ return app .exec ()
36+
37+
38+ def main ():
39+ exit_code = launch_app ()
40+ sys .exit (exit_code )
41+
42+
43+ if __name__ == "__main__" :
44+ main ()
File renamed without changes.
You can’t perform that action at this time.
0 commit comments