adding guard in IPC, adding settings
This commit is contained in:
parent
ba94493fb8
commit
48d6c505a7
|
@ -55,10 +55,14 @@ class IPCServer:
|
||||||
|
|
||||||
@daemon_threaded
|
@daemon_threaded
|
||||||
def _run_ipc_loop(self, listener) -> None:
|
def _run_ipc_loop(self, listener) -> None:
|
||||||
|
# NOTE: Not thread safe if using with Gtk. Need to import GLib and use idle_add
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
conn = listener.accept()
|
conn = listener.accept()
|
||||||
start_time = time.perf_counter()
|
start_time = time.perf_counter()
|
||||||
self._handle_ipc_message(conn, start_time)
|
self._handle_ipc_message(conn, start_time)
|
||||||
|
except Exception as e:
|
||||||
|
...
|
||||||
|
|
||||||
listener.close()
|
listener.close()
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ class Settings(StartCheckMixin):
|
||||||
self._KEY_BINDINGS_FILE = f"{self._HOME_CONFIG_PATH}/key-bindings.json"
|
self._KEY_BINDINGS_FILE = f"{self._HOME_CONFIG_PATH}/key-bindings.json"
|
||||||
self._PID_FILE = f"{self._HOME_CONFIG_PATH}/{app_name.lower()}.pid"
|
self._PID_FILE = f"{self._HOME_CONFIG_PATH}/{app_name.lower()}.pid"
|
||||||
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
|
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
|
||||||
|
self._UI_WIDEGTS_PATH = f"{self._HOME_CONFIG_PATH}/ui_widgets"
|
||||||
|
self._CONTEXT_MENU = f"{self._HOME_CONFIG_PATH}/contexct_menu.json"
|
||||||
|
|
||||||
if not os.path.exists(self._HOME_CONFIG_PATH):
|
if not os.path.exists(self._HOME_CONFIG_PATH):
|
||||||
os.mkdir(self._HOME_CONFIG_PATH)
|
os.mkdir(self._HOME_CONFIG_PATH)
|
||||||
|
@ -63,11 +65,25 @@ class Settings(StartCheckMixin):
|
||||||
self._WINDOW_ICON = f"{self._USR_PATH}/icons/{app_name.lower()}.png"
|
self._WINDOW_ICON = f"{self._USR_PATH}/icons/{app_name.lower()}.png"
|
||||||
if not os.path.exists(self._WINDOW_ICON):
|
if not os.path.exists(self._WINDOW_ICON):
|
||||||
raise MissingConfigError("Unable to find the application icon.")
|
raise MissingConfigError("Unable to find the application icon.")
|
||||||
|
if not os.path.exists(self._UI_WIDEGTS_PATH):
|
||||||
|
self._UI_WIDEGTS_PATH = f"{self._USR_PATH}/ui_widgets"
|
||||||
|
if not os.path.exists(self._CONTEXT_MENU):
|
||||||
|
self._CONTEXT_MENU = f"{self._USR_PATH}/contexct_menu.json"
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
with open(self._KEY_BINDINGS_FILE) as file:
|
with open(self._KEY_BINDINGS_FILE) as file:
|
||||||
bindings = json.load(file)["keybindings"]
|
bindings = json.load(file)["keybindings"]
|
||||||
keybindings.configure(bindings)
|
keybindings.configure(bindings)
|
||||||
|
except Exception as e:
|
||||||
|
print( f"Settings: {self._KEY_BINDINGS_FILE}\n\t\t{repr(e)}" )
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(self._CONTEXT_MENU) as file:
|
||||||
|
self._context_menu_data = json.load(file)
|
||||||
|
except Exception as e:
|
||||||
|
print( f"Settings: {self._CONTEXT_MENU}\n\t\t{repr(e)}" )
|
||||||
|
|
||||||
|
|
||||||
self._main_window = None
|
self._main_window = None
|
||||||
self._main_window_w = 800
|
self._main_window_w = 800
|
||||||
|
@ -114,6 +130,8 @@ class Settings(StartCheckMixin):
|
||||||
def get_builder(self) -> any: return self._builder
|
def get_builder(self) -> any: return self._builder
|
||||||
def get_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR
|
def get_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR
|
||||||
def get_glade_file(self) -> str: return self._GLADE_FILE
|
def get_glade_file(self) -> str: return self._GLADE_FILE
|
||||||
|
def get_ui_widgets_path(self) -> str: return self._UI_WIDEGTS_PATH
|
||||||
|
def get_context_menu_data(self) -> str: return self._context_menu_data
|
||||||
|
|
||||||
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
||||||
def get_icon_theme(self) -> str: return self._ICON_THEME
|
def get_icon_theme(self) -> str: return self._ICON_THEME
|
||||||
|
|
Loading…
Reference in New Issue