From f497a8a05fc2dbf675786309dfe6364edfefe23f Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 30 Nov 2021 00:21:50 -0600 Subject: [PATCH] Small fixes --- README.md | 4 +++- .../new/solarfm/shellfm/windows/view/Path.py | 11 ++++++----- .../mixins/WidgetFileActionMixin.py | 16 ++++++++++++---- .../solarfm/signal_classes/mixins/WidgetMixin.py | 2 ++ .../solarfm/signal_classes/mixins/WindowMixin.py | 8 ++------ 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 687f47f..298505c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ SolarFM is a Gtk+ Python file manager. # Notes -```sudo apt-get install python3 wget steamcmd``` +```sudo apt-get install python3 wget ffmpegthumbnailer steamcmd``` # TODO # Images diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/Path.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/Path.py index 91787b0..7c4cdc2 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/Path.py +++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/Path.py @@ -21,13 +21,14 @@ class Path: self.load_directory() def pop_from_path(self): - self.path.pop() + 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() + 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/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py index 94fcd49..e883c39 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py @@ -16,10 +16,15 @@ class WidgetFileActionMixin: if debug: print(f"Watcher Is Cancelled: {watcher.is_cancelled()}") - dir_watcher = Gio.File.new_for_path(view.get_current_directory()) \ - .monitor_directory(Gio.FileMonitorFlags.WATCH_MOVES, - Gio.Cancellable() - ) + cur_dir = view.get_current_directory() + # Temp updating too much with current events we are checking for. + # Causes invalid iter errors in WidbetMixin > update_store + if cur_dir == "/tmp": + watcher = None + return + + dir_watcher = Gio.File.new_for_path(cur_dir) \ + .monitor_directory(Gio.FileMonitorFlags.WATCH_MOVES, Gio.Cancellable()) wid = view.get_wid() tid = view.get_tab_id() @@ -30,6 +35,9 @@ class WidgetFileActionMixin: if eve_type in [Gio.FileMonitorEvent.CREATED, Gio.FileMonitorEvent.DELETED, Gio.FileMonitorEvent.RENAMED, Gio.FileMonitorEvent.MOVED_IN, Gio.FileMonitorEvent.MOVED_OUT]: + if debug: + print(eve_type) + wid, tid = data[0].split("|") notebook = self.builder.get_object(f"window_{wid}") view = self.get_fm_window(wid).get_view_by_id(tid) diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py index e574ad3..a3cf20b 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py @@ -44,6 +44,8 @@ class WidgetMixin: fpath = dir + "/" + file GLib.idle_add(self.update_store, (i, store, icon, view, fpath,)) + # NOTE: Might need to keep an eye on this throwing invalid iters when too + # many updates are happening to a folder. Example: /tmp def update_store(self, item): i, store, icon, view, fpath = item itr = store.get_iter(i) diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WindowMixin.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WindowMixin.py index a16c79d..7977bda 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WindowMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WindowMixin.py @@ -104,20 +104,16 @@ class WindowMixin(TabMixin): fileName = model[item][1] dir = view.get_current_directory() file = dir + "/" + fileName - refresh = True if isdir(file): view.set_path(file) - elif isfile(file): - refresh = False - view.open_file_locally(file) - - if refresh == True: self.load_store(view, model) tab_label.set_label(view.get_end_of_path()) path_entry.set_text(view.get_current_directory()) self.set_file_watcher(view) self.set_bottom_labels(view) + else: + view.open_file_locally(file) except Exception as e: self.display_message(self.error, f"{repr(e)}")