IPC updates, module rename and repath

This commit is contained in:
itdominator 2022-06-10 20:13:57 -05:00
parent 9442453d43
commit e4656c771a
21 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,3 @@
"""
Base module
Base module
"""

View File

@ -5,7 +5,7 @@ import os, inspect, time
# Application imports
from utils.settings import Settings
from context.controller import Controller
from core.controller import Controller
from __builtins__ import EventSystem

View File

@ -1,3 +0,0 @@
"""
Gtk Bound Signal Module
"""

View File

@ -0,0 +1,3 @@
"""
Core Module
"""

View File

@ -1,5 +1,6 @@
# Python imports
import sys, os, signal
from dataclasses import dataclass
# Lib imports
import gi
@ -11,6 +12,7 @@ from shellfm.windows.controller import WindowController
from plugins.plugins import Plugins
@dataclass(slots=True)
class State:
wid: int = None
tid: int = None
@ -21,6 +23,7 @@ class State:
class Controller_Data:
""" Controller_Data contains most of the state of the app at ay given time. It also has some support methods. """
__slots__ = "settings", "builder", "logger", "keybindings", "trashman", "fm_controller", "window", "window1", "window2", "window3", "window4"
def setup_controller_data(self, _settings: type) -> None:
self.settings = _settings

View File

@ -20,14 +20,20 @@ class IPCServer:
def __init__(self, conn_type: str = "socket"):
self.is_ipc_alive = False
self._conn_type = conn_type
self.ipc_port = 4848
self.ipc_address = '127.0.0.1'
self.ipc_authkey = b'solarfm-ipc'
self.ipc_timeout = 15.0
if conn_type == "socket":
self.ipc_address = '/tmp/solarfm-ipc.sock'
else:
self.ipc_address = '127.0.0.1'
self.ipc_port = 4848
elif conn_type == "full_network":
self.ipc_address = '0.0.0.0'
elif conn_type == "full_network_unsecured":
self.ipc_authkey = None
self.ipc_address = '0.0.0.0'
elif conn_type == "local_network_unsecured":
self.ipc_authkey = None
@threaded
@ -37,8 +43,10 @@ class IPCServer:
return
listener = Listener(address=self.ipc_address, family="AF_UNIX", authkey=self.ipc_authkey)
else:
elif "unsecured" not in conn_type:
listener = Listener((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey)
else:
listener = Listener((self.ipc_address, self.ipc_port))
self.is_ipc_alive = True
@ -80,9 +88,10 @@ class IPCServer:
try:
if self._conn_type == "socket":
conn = Client(address=self.ipc_address, family="AF_UNIX", authkey=self.ipc_authkey)
else:
elif "unsecured" not in conn_type:
conn = Client((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey)
else:
conn = Client((self.ipc_address, self.ipc_port))
conn.send(message)
conn.send('close connection')

View File

@ -0,0 +1,3 @@
"""
Tests Module
"""