2023-04-23 17:06:16 +00:00
|
|
|
# Python imports
|
|
|
|
import os
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
|
|
|
|
# Application imports
|
|
|
|
from utils.ipc_server import IPCServer
|
|
|
|
from core.window import Window
|
|
|
|
|
|
|
|
|
|
|
|
class AppLaunchException(Exception):
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Application(IPCServer):
|
|
|
|
""" docstring for Application. """
|
|
|
|
|
|
|
|
def __init__(self, args, unknownargs):
|
|
|
|
super(Application, self).__init__()
|
|
|
|
if not settings.is_trace_debug():
|
|
|
|
try:
|
|
|
|
self.create_ipc_listener()
|
|
|
|
except Exception:
|
|
|
|
...
|
|
|
|
|
|
|
|
if not self.is_ipc_alive:
|
2023-04-27 00:26:19 +00:00
|
|
|
collection = unknownargs + [args.file] if args.file and os.path.isfile(args.file) else unknownargs
|
|
|
|
for arg in collection:
|
|
|
|
path = arg.replace("file://", "")
|
|
|
|
if os.path.isfile(path):
|
|
|
|
message = f"FILE|{path}"
|
2023-04-23 17:06:16 +00:00
|
|
|
self.send_ipc_message(message)
|
|
|
|
|
|
|
|
raise AppLaunchException(f"{app_name} IPC Server Exists: Will send path(s) to it and close...")
|
|
|
|
|
|
|
|
Window(args, unknownargs)
|