Shellmen/src/__main__.py

44 lines
1.2 KiB
Python
Raw Normal View History

2022-01-25 04:32:31 +00:00
#!/usr/bin/python3
2020-04-18 19:46:19 +00:00
# Python imports
import argparse
import faulthandler
import traceback
2022-01-25 04:32:31 +00:00
from setproctitle import setproctitle
# Lib imports
2020-04-18 19:46:19 +00:00
# Application imports
from __builtins__ import *
from app import Application
2020-04-18 19:46:19 +00:00
if __name__ == "__main__":
''' Set process title, get arguments, and create GTK main thread. '''
2022-01-25 04:32:31 +00:00
try:
setproctitle(f'{app_name}')
2022-01-25 04:32:31 +00:00
faulthandler.enable() # For better debug info
2020-04-18 19:46:19 +00:00
parser = argparse.ArgumentParser()
# Add long and short arguments
parser.add_argument("--theme", "-t", default="default", help="Set the theme. Options [orange, red, purple, green].")
parser.add_argument("--debug", "-d", default="false", help="Do extra console messaging.")
parser.add_argument("--trace-debug", "-td", default="false", help="Disable saves, ignore IPC lock, do extra console messaging.")
2020-04-18 19:46:19 +00:00
# Read arguments (If any...)
2022-01-25 04:32:31 +00:00
args, unknownargs = parser.parse_known_args()
if args.debug == "true":
settings_manager.set_debug(True)
if args.trace_debug == "true":
settings_manager.set_trace_debug(True)
Application(args, unknownargs)
2020-04-18 19:46:19 +00:00
except Exception as e:
2022-01-25 04:32:31 +00:00
traceback.print_exc()
quit()