diff --git a/.vscode/launch.json b/.vscode/launch.json index fe2dc5b..d6dff23 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", "cwd": "${workspaceFolder}", "module": "contact.__main__", - "args": [] + "args": ["-c"] } ] } diff --git a/contact/__main__.py b/contact/__main__.py index 8752234..20d2159 100644 --- a/contact/__main__.py +++ b/contact/__main__.py @@ -14,6 +14,7 @@ from pubsub import pub import sys import io import logging +import subprocess import traceback import threading @@ -41,7 +42,7 @@ if os.environ.get("COLORTERM") == "gnome-terminal": # Run `tail -f client.log` in another terminal to view live logging.basicConfig( filename=config.log_file_path, - level=logging.INFO, # DEBUG, INFO, WARNING, ERROR, CRITICAL) + level=logging.DEBUG, # DEBUG, INFO, WARNING, ERROR, CRITICAL) format="%(asctime)s - %(levelname)s - %(message)s" ) @@ -57,6 +58,11 @@ def main(stdscr): parser = setup_parser() args = parser.parse_args() + # Check if --settings was passed and run settings.py as a subprocess + if getattr(args, 'settings', False): + subprocess.run([sys.executable, "-m", "contact.settings"], check=True) + return + logging.info("Initializing interface %s", args) with globals.lock: globals.interface = initialize_interface(args) diff --git a/contact/utilities/arg_parser.py b/contact/utilities/arg_parser.py index 391dc0e..f017715 100644 --- a/contact/utilities/arg_parser.py +++ b/contact/utilities/arg_parser.py @@ -33,5 +33,14 @@ def setup_parser(): default=None, const="any" ) + parser.add_argument( + "--settings", + "--set", + "--control", + "-c", + help="Launch directly into the settings", + action="store_true" + ) + return parser \ No newline at end of file