Open balthazarneveu opened 1 year ago
def populate_parser_for_gui(parser=None): if parser is None: parser = argparse.ArgumentParser(description="Interactive Pipe Application") parser.add_argument( "--backend", choices=["mpl", "qt", "nb"], default="mpl", help="Backend to use: mpl (Matplotlib) or pyqt (PyQt)." ) parser.add_argument( "--fullscreen", action="store_true", help="Start in fullscreen mode" ) return parser from typing import Tuple from interactive_pipe.graphical.gui import InteractivePipeGUI def gui_from_cli(parser=None) -> Tuple[InteractivePipeGUI, bool]: parser = populate_parser_for_gui(parser=parser) args = parser.parse_args() if args.backend == "mpl": from interactive_pipe.graphical.mpl_gui import InteractivePipeMatplotlib as InteractivePipeGui print("Using Matplotlib backend.") elif args.backend == "qt": from interactive_pipe.graphical.qt_gui import InteractivePipeQT as InteractivePipeGui print("Using PyQt backend.") elif args.backend == "nb": from interactive_pipe.graphical.nb_gui import InteractivePipeJupyter as InteractivePipeGui print("Using PyQt backend.") return InteractivePipeGui, args.fullscreen