made main method
This commit is contained in:
parent
44ef6ea2bb
commit
a47bd23e78
|
@ -3,10 +3,12 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import argparse
|
import argparse
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import locale
|
|
||||||
import traceback
|
import traceback
|
||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
|
import tracemalloc
|
||||||
|
tracemalloc.start()
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
@ -15,38 +17,38 @@ from app import Application
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def main(args, unknownargs):
|
||||||
try:
|
setproctitle(f'{app_name}')
|
||||||
locale.setlocale(locale.LC_NUMERIC, 'C')
|
|
||||||
|
|
||||||
setproctitle(f"{app_name}")
|
if args.debug == "true":
|
||||||
# faulthandler.enable() # For better debug info
|
settings_manager.set_debug(True)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
if args.trace_debug == "true":
|
||||||
# Add long and short arguments
|
settings_manager.set_trace_debug(True)
|
||||||
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.")
|
|
||||||
|
|
||||||
parser.add_argument("--new-tab", "-t", default="", help="Open a file into new tab.")
|
settings_manager.do_dirty_start_check()
|
||||||
parser.add_argument("--new-window", "-w", default="", help="Open a file into a new window.")
|
Application(args, unknownargs)
|
||||||
|
|
||||||
# Read arguments (If any...)
|
|
||||||
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)
|
|
||||||
|
|
||||||
settings_manager.do_dirty_start_check()
|
|
||||||
Application(args, unknownargs)
|
|
||||||
except Exception as e:
|
|
||||||
traceback.print_exc()
|
|
||||||
quit()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
""" Set process title, get arguments, and create GTK main thread. """
|
''' Set process title, get arguments, and create GTK main thread. '''
|
||||||
run()
|
|
||||||
|
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.")
|
||||||
|
|
||||||
|
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.")
|
||||||
|
|
||||||
|
# Read arguments (If any...)
|
||||||
|
args, unknownargs = parser.parse_known_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
faulthandler.enable() # For better debug info
|
||||||
|
main(args, unknownargs)
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
quit()
|
|
@ -113,4 +113,4 @@ class Launcher:
|
||||||
if not os.path.islink(fp): # Skip if it is symbolic link
|
if not os.path.islink(fp): # Skip if it is symbolic link
|
||||||
total_size += os.path.getsize(fp)
|
total_size += os.path.getsize(fp)
|
||||||
|
|
||||||
return total_size
|
return total_size
|
Loading…
Reference in New Issue