add settings flag

This commit is contained in:
pdxlocations
2025-04-02 22:03:28 -07:00
parent 3674afc216
commit 0288a1d190
3 changed files with 17 additions and 2 deletions

2
.vscode/launch.json vendored
View File

@@ -7,7 +7,7 @@
"request": "launch",
"cwd": "${workspaceFolder}",
"module": "contact.__main__",
"args": []
"args": ["-c"]
}
]
}

View File

@@ -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)

View File

@@ -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