SolarFM/src/versions/solarfm-0.0.1/SolarFM/solarfm/__main__.py

57 lines
1.5 KiB
Python
Raw Normal View History

2021-10-10 06:45:55 +00:00
#!/usr/bin/python3
# Python imports
import argparse, faulthandler, traceback
2021-10-10 06:45:55 +00:00
from setproctitle import setproctitle
import tracemalloc
tracemalloc.start()
# Lib imports
import gi
2021-10-10 06:45:55 +00:00
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
2021-10-10 06:45:55 +00:00
# Application imports
from __builtins__ import *
2022-03-03 22:45:37 +00:00
from app import Application
2021-10-10 06:45:55 +00:00
def run():
2021-10-10 06:45:55 +00:00
try:
2022-10-26 04:27:21 +00:00
setproctitle(f"{app_name}")
2021-10-10 06:45:55 +00:00
faulthandler.enable() # For better debug info
2022-09-03 01:15:20 +00:00
2021-10-10 06:45:55 +00:00
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.")
2021-11-25 08:21:10 +00:00
parser.add_argument("--new-tab", "-t", default="", help="Open a file into new tab.")
parser.add_argument("--new-window", "-w", default="", help="Open a file into a new window.")
2021-10-10 06:45:55 +00:00
# Read arguments (If any...)
2021-11-25 08:21:10 +00:00
args, unknownargs = parser.parse_known_args()
2022-10-23 04:53:33 +00:00
if args.debug == "true":
settings.set_debug(True)
if args.trace_debug == "true":
settings.set_trace_debug(True)
settings.do_dirty_start_check()
2022-03-03 22:45:37 +00:00
Application(args, unknownargs)
Gtk.main()
2021-10-10 06:45:55 +00:00
except Exception as e:
traceback.print_exc()
quit()
if __name__ == "__main__":
""" Set process title, get arguments, and create GTK main thread. """
run()