diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py index 19540d8..831ec5f 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__builtins__.py @@ -62,5 +62,5 @@ class Builtins(DBusControllerMixin): # NOTE: Just reminding myself we can add to builtins two different ways... # __builtins__.update({"event_system": Builtins()}) builtins.event_system = Builtins() -builtins.event_sleep_time = 0.5 +builtins.event_sleep_time = 0.2 builtins.debug = False diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py index ddaa127..5fed289 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/__init__.py @@ -14,7 +14,7 @@ from __builtins__ import Builtins class Main(Builtins): def __init__(self, args, unknownargs): event_system.create_ipc_server() - time.sleep(0.5) + time.sleep(0.2) if not event_system.is_ipc_alive: if unknownargs: for arg in unknownargs: diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py index f551ee6..f65d7bb 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/shellfm/windows/view/icons/Icon.py @@ -17,7 +17,7 @@ def threaded(fn): class Icon(DesktopIconMixin, VideoIconMixin): def create_icon(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" return self.get_icon_image(dir, file, full_path) def get_icon_image(self, dir, file, full_path): @@ -36,29 +36,27 @@ class Icon(DesktopIconMixin, VideoIconMixin): return None def create_thumbnail(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" try: file_hash = hashlib.sha256(str.encode(full_path)).hexdigest() - hash_img_pth = self.ABS_THUMBS_PTH + "/" + file_hash + ".jpg" + hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg" if isfile(hash_img_pth) == False: self.generate_video_thumbnail(full_path, hash_img_pth) thumbnl = self.create_scaled_image(hash_img_pth, self.VIDEO_ICON_WH) if thumbnl == None: # If no icon whatsoever, return internal default - thumbnl = GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + thumbnl = GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") return thumbnl except Exception as e: print("Thumbnail generation issue:") print( repr(e) ) - return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") def create_scaled_image(self, path, wxh): try: - pixbuf = GdkPixbuf.Pixbuf.new_from_file(path) - scaled_pixbuf = pixbuf.scale_simple(wxh[0], wxh[1], 2) # 2 = BILINEAR and is best by default - return scaled_pixbuf + return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True) except Exception as e: print("Image Scaling Issue:") print( repr(e) ) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py index 96f503d..06ba422 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetFileActionMixin.py @@ -107,7 +107,7 @@ class WidgetFileActionMixin: def open_with_files(self, appchooser_widget): wid, tid, view, iconview, store = self.get_current_state() app_info = appchooser_widget.get_app_info() - uris = self.format_to_uris(store, wid, tid, self.selected_files, True) + uris = self.format_to_uris(store, wid, tid, self.selected_files) view.app_chooser_exec(app_info, uris) diff --git a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py index 52b9a0d..99e0741 100644 --- a/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py +++ b/src/debs/solarfm-0-0-1-x64/opt/SolarFM/signal_classes/mixins/WidgetMixin.py @@ -1,5 +1,5 @@ # Python imports -import os, threading, subprocess +import os, threading, subprocess, time # Lib imports import gi @@ -20,15 +20,13 @@ def threaded(fn): class WidgetMixin: - def load_store(self, view, store, save_state=False): store.clear() dir = view.get_current_directory() files = view.get_files() - icon = GdkPixbuf.Pixbuf.new_from_file(view.DEFAULT_ICON) for i, file in enumerate(files): - store.append([icon, file[0]]) + store.append([None, file[0]]) self.create_icon(i, view, store, dir, file[0]) # NOTE: Not likely called often from here but it could be useful @@ -50,10 +48,14 @@ class WidgetMixin: try: itr = store.get_iter(i) except Exception as e: - print(":Invalid Itr detected: (Potential race condition...)") - print(f"Index Requested: {i}") - print(f"Store Size: {len(store)}") - return + try: + time.sleep(0.2) + itr = store.get_iter(i) + except Exception as e: + print(":Invalid Itr detected: (Potential race condition...)") + print(f"Index Requested: {i}") + print(f"Store Size: {len(store)}") + return if not icon: icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0]) @@ -113,7 +115,7 @@ class WidgetMixin: def create_grid_iconview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.IconView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) grid.set_model(store) grid.set_pixbuf_column(0) @@ -154,8 +156,8 @@ class WidgetMixin: def create_grid_treeview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.TreeView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) - # store = Gtk.TreeStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) + # store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str) column = Gtk.TreeViewColumn("Icons") icon = Gtk.CellRendererPixbuf() name = Gtk.CellRendererText() 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 19540d8..831ec5f 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__builtins__.py @@ -62,5 +62,5 @@ class Builtins(DBusControllerMixin): # NOTE: Just reminding myself we can add to builtins two different ways... # __builtins__.update({"event_system": Builtins()}) builtins.event_system = Builtins() -builtins.event_sleep_time = 0.5 +builtins.event_sleep_time = 0.2 builtins.debug = False diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py index ddaa127..5fed289 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/__init__.py @@ -14,7 +14,7 @@ from __builtins__ import Builtins class Main(Builtins): def __init__(self, args, unknownargs): event_system.create_ipc_server() - time.sleep(0.5) + time.sleep(0.2) if not event_system.is_ipc_alive: if unknownargs: for arg in unknownargs: diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py index fa414d6..f65d7bb 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py @@ -17,7 +17,7 @@ def threaded(fn): class Icon(DesktopIconMixin, VideoIconMixin): def create_icon(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" return self.get_icon_image(dir, file, full_path) def get_icon_image(self, dir, file, full_path): @@ -36,22 +36,22 @@ class Icon(DesktopIconMixin, VideoIconMixin): return None def create_thumbnail(self, dir, file): - full_path = dir + "/" + file + full_path = f"{dir}/{file}" try: file_hash = hashlib.sha256(str.encode(full_path)).hexdigest() - hash_img_pth = self.ABS_THUMBS_PTH + "/" + file_hash + ".jpg" + hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg" if isfile(hash_img_pth) == False: self.generate_video_thumbnail(full_path, hash_img_pth) thumbnl = self.create_scaled_image(hash_img_pth, self.VIDEO_ICON_WH) if thumbnl == None: # If no icon whatsoever, return internal default - thumbnl = GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + thumbnl = GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") return thumbnl except Exception as e: print("Thumbnail generation issue:") print( repr(e) ) - return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICONS + "/video.png") + return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png") def create_scaled_image(self, path, wxh): diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py index d6cbb16..99e0741 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py @@ -20,15 +20,13 @@ def threaded(fn): class WidgetMixin: - def load_store(self, view, store, save_state=False): store.clear() dir = view.get_current_directory() files = view.get_files() - icon = GdkPixbuf.Pixbuf() for i, file in enumerate(files): - store.append([icon, file[0]]) + store.append([None, file[0]]) self.create_icon(i, view, store, dir, file[0]) # NOTE: Not likely called often from here but it could be useful @@ -117,7 +115,7 @@ class WidgetMixin: def create_grid_iconview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.IconView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) grid.set_model(store) grid.set_pixbuf_column(0) @@ -158,8 +156,8 @@ class WidgetMixin: def create_grid_treeview_widget(self, view, wid): scroll = Gtk.ScrolledWindow() grid = Gtk.TreeView() - store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) - # store = Gtk.TreeStore(GdkPixbuf.Pixbuf, str) + store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) + # store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str) column = Gtk.TreeViewColumn("Icons") icon = Gtk.CellRendererPixbuf() name = Gtk.CellRendererText()