IPC updates, module rename and repath
This commit is contained in:
parent
9442453d43
commit
e4656c771a
|
@ -1,3 +1,3 @@
|
||||||
"""
|
"""
|
||||||
Base module
|
Base module
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os, inspect, time
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from utils.settings import Settings
|
from utils.settings import Settings
|
||||||
from context.controller import Controller
|
from core.controller import Controller
|
||||||
from __builtins__ import EventSystem
|
from __builtins__ import EventSystem
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
"""
|
|
||||||
Gtk Bound Signal Module
|
|
||||||
"""
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Core Module
|
||||||
|
"""
|
|
@ -1,5 +1,6 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import sys, os, signal
|
import sys, os, signal
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -11,6 +12,7 @@ from shellfm.windows.controller import WindowController
|
||||||
from plugins.plugins import Plugins
|
from plugins.plugins import Plugins
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
class State:
|
class State:
|
||||||
wid: int = None
|
wid: int = None
|
||||||
tid: int = None
|
tid: int = None
|
||||||
|
@ -21,6 +23,7 @@ class State:
|
||||||
|
|
||||||
class Controller_Data:
|
class Controller_Data:
|
||||||
""" Controller_Data contains most of the state of the app at ay given time. It also has some support methods. """
|
""" 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:
|
def setup_controller_data(self, _settings: type) -> None:
|
||||||
self.settings = _settings
|
self.settings = _settings
|
|
@ -20,14 +20,20 @@ class IPCServer:
|
||||||
def __init__(self, conn_type: str = "socket"):
|
def __init__(self, conn_type: str = "socket"):
|
||||||
self.is_ipc_alive = False
|
self.is_ipc_alive = False
|
||||||
self._conn_type = conn_type
|
self._conn_type = conn_type
|
||||||
|
self.ipc_port = 4848
|
||||||
|
self.ipc_address = '127.0.0.1'
|
||||||
self.ipc_authkey = b'solarfm-ipc'
|
self.ipc_authkey = b'solarfm-ipc'
|
||||||
self.ipc_timeout = 15.0
|
self.ipc_timeout = 15.0
|
||||||
|
|
||||||
if conn_type == "socket":
|
if conn_type == "socket":
|
||||||
self.ipc_address = '/tmp/solarfm-ipc.sock'
|
self.ipc_address = '/tmp/solarfm-ipc.sock'
|
||||||
else:
|
elif conn_type == "full_network":
|
||||||
self.ipc_address = '127.0.0.1'
|
self.ipc_address = '0.0.0.0'
|
||||||
self.ipc_port = 4848
|
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
|
@threaded
|
||||||
|
@ -37,8 +43,10 @@ class IPCServer:
|
||||||
return
|
return
|
||||||
|
|
||||||
listener = Listener(address=self.ipc_address, family="AF_UNIX", authkey=self.ipc_authkey)
|
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)
|
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
|
self.is_ipc_alive = True
|
||||||
|
@ -80,9 +88,10 @@ class IPCServer:
|
||||||
try:
|
try:
|
||||||
if self._conn_type == "socket":
|
if self._conn_type == "socket":
|
||||||
conn = Client(address=self.ipc_address, family="AF_UNIX", authkey=self.ipc_authkey)
|
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)
|
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(message)
|
||||||
conn.send('close connection')
|
conn.send('close connection')
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Tests Module
|
||||||
|
"""
|
Loading…
Reference in New Issue