Added args handler, made IPC singleton

This commit is contained in:
2023-03-27 21:25:54 -05:00
parent ef03030c88
commit b4120bdca4
6 changed files with 28 additions and 6 deletions

View File

@@ -27,6 +27,18 @@ class Controller(DummyMixin, SignalsMixins, ControllerData):
self.print_hello_world() # A mixin method from the DummyMixin file
if args.no_plugins == "false":
self.plugins.launch_plugins()
for arg in unknownargs + [args.new_tab,]:
if os.path.isfile(arg):
message = f"FILE|{arg}"
event_system.emit("post_file_to_ipc", message)
if os.path.isdir(arg):
message = f"DIR|{arg}"
event_system.emit("post_file_to_ipc", message)
logger.info(f"Made it past {self.__class__} loading...")
@@ -40,6 +52,7 @@ class Controller(DummyMixin, SignalsMixins, ControllerData):
def _subscribe_to_events(self):
event_system.subscribe("handle_file_from_ipc", self.handle_file_from_ipc)
event_system.subscribe("handle_dir_from_ipc", self.handle_dir_from_ipc)
event_system.subscribe("tggl_top_main_menubar", self._tggl_top_main_menubar)
def load_glade_file(self):

View File

@@ -14,4 +14,7 @@ class IPCSignalsMixin:
print(message)
def handle_file_from_ipc(self, path: str) -> None:
print(f"Path From IPC: {path}")
print(f"File From IPC: {path}")
def handle_dir_from_ipc(self, path: str) -> None:
print(f"Dir From IPC: {path}")

View File

@@ -22,7 +22,7 @@ class ControllerStartExceptiom(Exception):
class Window(Gtk.ApplicationWindow):
"""docstring for Window."""
""" docstring for Window. """
def __init__(self, args, unknownargs):
super(Window, self).__init__()