Files
Python-With-Gtk-Template/src/__main__.py

58 lines
1.6 KiB
Python
Raw Normal View History

2020-05-07 19:07:33 -05:00
#!/usr/bin/python3
# Python imports
import argparse
import faulthandler
import traceback
2020-05-07 19:07:33 -05:00
from setproctitle import setproctitle
2022-01-23 16:56:27 -06:00
import tracemalloc
tracemalloc.start()
# Lib imports
2020-05-07 19:07:33 -05:00
# Application imports
from __builtins__ import *
2022-03-03 16:37:29 -06:00
from app import Application
2020-05-07 19:07:33 -05:00
2023-01-29 00:06:52 -06:00
def main():
2024-02-29 18:50:34 -06:00
setproctitle(f'{APP_NAME}')
settings_manager.set_start_load_time()
2022-02-25 17:53:58 -06:00
if args.debug == "true":
settings_manager.set_debug(True)
if args.trace_debug == "true":
settings_manager.set_trace_debug(True)
settings_manager.do_dirty_start_check()
app = Application()
app.run()
2020-05-07 19:07:33 -05:00
2022-01-23 16:56:27 -06:00
if __name__ == "__main__":
''' Set process title, get arguments, and create GTK main thread. '''
parser = argparse.ArgumentParser()
# Add long and short arguments
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.")
parser.add_argument("--no-plugins", "-np", default = "false", help = "Do not load plugins.")
2022-10-22 23:26:13 -05:00
parser.add_argument("--new-tab", "-nt", default = "false", help = "Opens a 'New Tab' if a handler is set for it.")
parser.add_argument("--file", "-f", default = "default", help = "JUST SOME FILE ARG.")
2022-10-22 23:26:13 -05:00
# Read arguments (If any...)
args, unknownargs = parser.parse_known_args()
settings_manager.set_starting_args( args, unknownargs )
try:
faulthandler.enable() # For better debug info
main()
2020-05-07 19:07:33 -05:00
except Exception as e:
2022-01-23 16:56:27 -06:00
traceback.print_exc()
quit()