Removed StatusIcon; updated IPC logic
This commit is contained in:
26
src/app.py
26
src/app.py
@@ -23,13 +23,14 @@ class Application:
|
||||
def __init__(self):
|
||||
super(Application, self).__init__()
|
||||
|
||||
if not settings_manager.is_trace_debug():
|
||||
self.load_ipc()
|
||||
|
||||
self.setup_debug_hook()
|
||||
|
||||
|
||||
def run(self):
|
||||
if not settings_manager.is_trace_debug():
|
||||
if not self.load_ipc():
|
||||
return
|
||||
|
||||
win = Window()
|
||||
win.start()
|
||||
|
||||
@@ -39,13 +40,20 @@ class Application:
|
||||
ipc_server = IPCServer()
|
||||
|
||||
self.ipc_realization_check(ipc_server)
|
||||
if not ipc_server.is_ipc_alive:
|
||||
for arg in unknownargs + [args.new_tab,]:
|
||||
if os.path.isfile(arg):
|
||||
message = f"FILE|{arg}"
|
||||
ipc_server.send_ipc_message(message)
|
||||
if ipc_server.is_ipc_alive:
|
||||
return True
|
||||
|
||||
raise AppLaunchException(f"{APP_NAME} IPC Server Exists: Have sent path(s) to it and closing...")
|
||||
logger.warning(f"{app_name} IPC Server Exists: Have sent path(s) to it and closing...")
|
||||
for arg in unknownargs + [args.new_tab,]:
|
||||
if os.path.isfile(arg):
|
||||
message = f"FILE|{arg}"
|
||||
ipc_server.send_ipc_message(message)
|
||||
|
||||
if os.path.isdir(arg):
|
||||
message = f"DIR|{arg}"
|
||||
ipc_server.send_ipc_message(message)
|
||||
|
||||
return False
|
||||
|
||||
def ipc_realization_check(self, ipc_server):
|
||||
try:
|
||||
|
||||
@@ -11,7 +11,6 @@ from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
from libs.status_icon import StatusIcon
|
||||
from core.controllers.base_controller import BaseController
|
||||
|
||||
|
||||
@@ -28,7 +27,6 @@ class Window(Gtk.ApplicationWindow):
|
||||
super(Window, self).__init__()
|
||||
settings_manager.set_main_window(self)
|
||||
|
||||
self._status_icon = None
|
||||
self._controller = None
|
||||
self.guake_key = settings_manager.get_guake_key()
|
||||
self.hidefunc = None
|
||||
@@ -79,7 +77,6 @@ class Window(Gtk.ApplicationWindow):
|
||||
self.set_interactive_debugging(True)
|
||||
|
||||
self._controller = BaseController()
|
||||
self._status_icon = StatusIcon()
|
||||
if not self._controller:
|
||||
raise ControllerStartException("BaseController exited and doesn't exist...")
|
||||
|
||||
@@ -95,10 +92,6 @@ class Window(Gtk.ApplicationWindow):
|
||||
return 'X11'
|
||||
|
||||
def _set_size_constraints(self):
|
||||
# _window_x = settings.config.main_window_x
|
||||
# _window_y = settings.config.main_window_y
|
||||
# self.move(_window_x, _window_y - 28)
|
||||
|
||||
_min_width = settings.config.main_window_min_width
|
||||
_min_height = settings.config.main_window_min_height
|
||||
_width = settings.config.main_window_width
|
||||
|
||||
@@ -61,8 +61,12 @@ class IPCServer(Singleton):
|
||||
conn = listener.accept()
|
||||
start_time = time.perf_counter()
|
||||
self._handle_ipc_message(conn, start_time)
|
||||
except EOFError as e:
|
||||
logger.debug( repr(e) )
|
||||
except Exception as e:
|
||||
logger.debug( repr(e) )
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
listener.close()
|
||||
|
||||
@@ -88,7 +92,7 @@ class IPCServer(Singleton):
|
||||
break
|
||||
|
||||
|
||||
if msg in ['close connection', 'close server']:
|
||||
if msg in ['close connection', 'close server', 'Empty Data...']:
|
||||
conn.close()
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user