Refactored to reduce Glade dependency...

This commit is contained in:
2022-10-13 20:58:44 -05:00
parent ee812c520f
commit e427cddec9
16 changed files with 361 additions and 220 deletions

View File

@@ -1,19 +1,20 @@
# Python imports
import os, inspect, time
import os
import time
# Lib imports
# Application imports
from __builtins__ import *
from utils.ipc_server import IPCServer
from utils.settings import Settings
from context.controller import Controller
from core.window import Window
class App_Launch_Exception(Exception):
class AppLaunchException(Exception):
...
class Controller_Start_Exceptio(Exception):
class ControllerStartExceptiom(Exception):
...
@@ -22,8 +23,13 @@ class Application(IPCServer):
def __init__(self, args, unknownargs):
super(Application, self).__init__()
if args.debug == "true":
settings.set_debug(True)
if not trace_debug:
if args.trace_debug == "true":
settings.set_trace_debug(True)
if not settings.is_trace_debug():
self.create_ipc_listener()
time.sleep(0.05)
@@ -34,26 +40,6 @@ class Application(IPCServer):
message = f"FILE|{arg}"
self.send_ipc_message(message)
raise App_Launch_Exception(f"IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/{app_name}-ipc.sock")
raise AppLaunchException(f"IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/{app_name}-ipc.sock")
settings = Settings()
settings.create_window()
controller = Controller(settings, args, unknownargs)
if not controller:
raise Controller_Start_Exceptio("Controller exited and doesn't exist...")
# Gets the methods from the classes and sets to handler.
# Then, builder from settings will connect to any signals it needs.
classes = [controller]
handlers = {}
for c in classes:
methods = None
try:
methods = inspect.getmembers(c, predicate=inspect.ismethod)
handlers.update(methods)
except Exception as e:
print(repr(e))
settings.get_builder().connect_signals(handlers)
Window(args, unknownargs)