diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py index be64d81..6e674cb 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py @@ -18,6 +18,11 @@ class Builtins(IPCServerMixin): self._gui_events = [] self._fm_events = [] self.is_ipc_alive = False + self.ipc_authkey = b'solarfm-ipc' + self.ipc_address = '127.0.0.1' + self.ipc_port = 4848 + self.ipc_timeout = 15.0 + # Makeshift fake "events" type system FIFO def _pop_gui_event(self): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py index 69a492a..9c3a8a7 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/Path.py @@ -24,14 +24,14 @@ class Path: self.load_directory() def pop_from_path(self): - if self.path: + if len(self.path) > 1: self.path.pop() if not self.go_past_home: if self.get_home() not in self.get_path(): self.set_to_home() - self.load_directory() + self.load_directory() def set_path(self, path): if path == self.get_path(): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py index 8fb42a4..09ae50f 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller.py @@ -1,5 +1,5 @@ # Python imports -import sys, traceback, threading, signal, inspect, os, time +import sys, traceback, threading, inspect, os, time # Lib imports import gi @@ -23,15 +23,10 @@ class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \ KeyboardSignalsMixin, Controller_Data): def __init__(self, args, unknownargs, _settings): # sys.excepthook = self.custom_except_hook - self.settings = _settings - self.setup_controller_data() - + self.setup_controller_data(_settings) self.window.show() self.generate_windows(self.state) - self.window.connect("delete-event", self.tear_down) - GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) - if not trace_debug: self.gui_event_observer() diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py index ccace6d..83ed9d2 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/Controller_Data.py @@ -1,4 +1,5 @@ # Python imports +import signal # Lib imports from gi.repository import GLib @@ -14,16 +15,17 @@ class Controller_Data: def has_method(self, o, name): return callable(getattr(o, name, None)) - def setup_controller_data(self): - self.window_controller = WindowController() + def setup_controller_data(self, _settings): self.trashman = XDGTrash() + self.window_controller = WindowController() + self.state = self.window_controller.load_state() self.trashman.regenerate() - self.state = self.window_controller.load_state() - self.builder = self.settings.builder - self.logger = self.settings.logger + self.settings = _settings + self.builder = self.settings.get_builder() + self.logger = self.settings.get_logger() - self.window = self.settings.getMainWindow() + self.window = self.settings.get_main_window() self.window1 = self.builder.get_object("window_1") self.window2 = self.builder.get_object("window_2") self.window3 = self.builder.get_object("window_3") @@ -99,3 +101,7 @@ class Controller_Data: self.success = "#88cc27" self.warning = "#ffa800" self.error = "#ff0000" + + + self.window.connect("delete-event", self.tear_down) + GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py index e7534c5..be92ace 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/IPCServerMixin.py @@ -19,7 +19,7 @@ class IPCServerMixin: @threaded def create_ipc_server(self): - listener = Listener(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + listener = Listener((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) self.is_ipc_alive = True while True: conn = listener.accept() @@ -49,7 +49,7 @@ class IPCServerMixin: # NOTE: Not perfect but insures we don't lockup the connection for too long. end_time = time.time() - if (end - start) > 15.0: + if (end - start) > self.ipc_timeout: conn.close() listener.close() @@ -57,7 +57,7 @@ class IPCServerMixin: def send_ipc_message(self, message="Empty Data..."): try: - conn = Client(('127.0.0.1', 4848), authkey=b'solarfm-ipc') + conn = Client((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey) conn.send(message) conn.send('close connection') except Exception as e: diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py index 85a947c..06ba422 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetFileActionMixin.py @@ -232,10 +232,7 @@ class WidgetFileActionMixin: target = f"{view.get_current_directory()}" if file_name: - if len(target) == 1: - path = f"{target}{file_name}" - else: - path = f"{target}/{file_name}" + path = f"{target}/{file_name}" if type == True: # Create File self.handle_files([path], "create_file") diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py index aa8687f..a397738 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WindowMixin.py @@ -82,7 +82,7 @@ class WindowMixin(TabMixin): _wid, _tid, _view, iconview, store = self.get_current_state() selected_files = iconview.get_selected_items() current_directory = view.get_current_directory() - path_file = Gio.File.new_for_path( current_directory) + path_file = Gio.File.new_for_path(current_directory) mount_file = path_file.query_filesystem_info(attributes="filesystem::*", cancellable=None) formatted_mount_free = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::free")) ) formatted_mount_size = self.sizeof_fmt( int(mount_file.get_attribute_as_string("filesystem::size")) ) @@ -101,11 +101,16 @@ class WindowMixin(TabMixin): uris = self.format_to_uris(store, _wid, _tid, selected_files, True) combined_size = 0 for uri in uris: - file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", - flags=Gio.FileQueryInfoFlags.NONE, - cancellable=None) - file_size = file_info.get_size() - combined_size += file_size + try: + file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size", + flags=Gio.FileQueryInfoFlags.NONE, + cancellable=None) + file_size = file_info.get_size() + combined_size += file_size + except Exception as e: + if debug: + print(repr(e)) + formatted_size = self.sizeof_fmt(combined_size) if view.hide_hidden: diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py index 3dc368f..205b919 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/utils/Settings.py @@ -72,7 +72,9 @@ class Settings: cr.paint() cr.set_operator(cairo.OPERATOR_OVER) - def getMainWindow(self): return self.main_window + def get_builder(self): return self.builder + def get_logger(self): return self.logger + def get_main_window(self): return self.main_window def getMonitorData(self):