Small fixes

This commit is contained in:
itdominator 2021-11-30 00:21:50 -06:00
parent f5d2fc86f1
commit f497a8a05f
5 changed files with 25 additions and 16 deletions

View File

@ -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
<ul>
@ -15,6 +15,8 @@ SolarFM is a Gtk+ Python file manager.
<li>Add drive size free and consumed info to bottom bar.</li>
<li>Add simpleish plugin system to run bash/python scripts.</li>
<li>Add DnD context awareness for over folder drop.</li>
<li>Add double click event for App chooser.</li>
<li>Add enter key event for rename dialog.</li>
</ul>
# Images

View File

@ -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():

View File

@ -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)

View File

@ -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)

View File

@ -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)}")