From 111c5358766f5c8a2f30be97602cfb0ef1444b06 Mon Sep 17 00:00:00 2001
From: itdominator <1itdominator@gmail.com>
Date: Sat, 18 Jun 2022 22:27:17 -0500
Subject: [PATCH] Small fixes
---
plugins/template/__main__.py | 17 ++++++-----
plugins/youtube_download/__main__.py | 28 +++++++++----------
.../SolarFM/solarfm/core/controller.py | 2 +-
.../solarfm/core/mixins/ui/grid_mixin.py | 8 +-----
.../usr/share/solarfm/Main_Window.glade | 8 +++---
5 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/plugins/template/__main__.py b/plugins/template/__main__.py
index 8264621..110ce10 100644
--- a/plugins/template/__main__.py
+++ b/plugins/template/__main__.py
@@ -9,13 +9,13 @@ from gi.repository import Gtk
# Application imports
-# NOTE: Threads will not die with parent's destruction
+# NOTE: Threads WILL NOT die with parent's destruction.
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
return wrapper
-# NOTE: Insure threads die with parent's destruction
+# NOTE: Threads WILL die with parent's destruction.
def daemon_threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
@@ -39,18 +39,11 @@ class Plugin:
button = Gtk.Button(label=self._plugin_name)
button.connect("button-release-event", self.send_message)
- # self._module_event_observer() # NOTE: Enable if you want the plugin to watch for events sent to it
-
plugin_list = self._builder.get_object("plugin_socket")
plugin_list.add(button)
plugin_list.show_all()
- def send_message(self, widget=None, eve=None):
- message = "Hello, World!"
- self._event_system.push_gui_event([self._plugin_name, "display_message", ("warning", message, None)])
-
-
def get_plugin_name(self):
return self._plugin_name
@@ -63,6 +56,12 @@ class Plugin:
def get_socket_id(self):
return self._socket_id
+
+ def send_message(self, widget=None, eve=None):
+ message = "Hello, World!"
+ self._event_system.push_gui_event([self._plugin_name, "display_message", ("warning", message, None)])
+
+
@daemon_threaded
def _module_event_observer(self):
while True:
diff --git a/plugins/youtube_download/__main__.py b/plugins/youtube_download/__main__.py
index bc81cbb..06d7e06 100644
--- a/plugins/youtube_download/__main__.py
+++ b/plugins/youtube_download/__main__.py
@@ -9,13 +9,13 @@ from gi.repository import Gtk
# Application imports
-# NOTE: Threads will not die with parent's destruction
+# NOTE: Threads WILL NOT die with parent's destruction.
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
return wrapper
-# NOTE: Insure threads die with parent's destruction
+# NOTE: Threads WILL die with parent's destruction.
def daemon_threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
@@ -36,16 +36,26 @@ class Plugin:
self._event_sleep_time = .5
self._fm_event_message = None
+ self._module_event_observer()
button = Gtk.Button(label=self._plugin_name)
button.connect("button-release-event", self._do_download)
- self._module_event_observer()
-
plugin_list = self._fm_builder.get_object("plugin_socket")
plugin_list.add(button)
plugin_list.show_all()
+
+ def get_plugin_name(self):
+ return self._plugin_name
+
+ def get_plugin_author(self):
+ return self._plugin_author
+
+ def get_plugin_version(self):
+ return self._plugin_version
+
+
@daemon_threaded
def _module_event_observer(self):
while True:
@@ -74,13 +84,3 @@ class Plugin:
state = self._fm_event_message
subprocess.Popen([f'{self.SCRIPT_PTH}/download.sh' , state.tab.get_current_directory()])
self._fm_event_message = None
-
-
- def get_plugin_name(self):
- return self._plugin_name
-
- def get_plugin_author(self):
- return self._plugin_author
-
- def get_plugin_version(self):
- return self._plugin_version
diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/controller.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/controller.py
index 4e0491a..deb4493 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/controller.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/controller.py
@@ -62,7 +62,7 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
Gtk.main_quit()
- @threaded
+ @daemon_threaded
def gui_event_observer(self):
while True:
time.sleep(event_sleep_time)
diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/mixins/ui/grid_mixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/mixins/ui/grid_mixin.py
index 11721c8..8d4d065 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/mixins/ui/grid_mixin.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/core/mixins/ui/grid_mixin.py
@@ -43,13 +43,6 @@ class GridMixin:
GLib.idle_add(self.update_store, *(i, store, icon, tab, dir, file,))
def update_store(self, i, store, icon, tab, dir, file):
- while True:
- try:
- itr = store.get_iter(i)
- break
- except:
- pass
-
if not icon:
path = f"{dir}/{file}"
icon = self.get_system_thumbnail(path, tab.sys_icon_wh[0])
@@ -57,6 +50,7 @@ class GridMixin:
if not icon:
icon = GdkPixbuf.Pixbuf.new_from_file(tab.DEFAULT_ICON)
+ itr = store.get_iter(i)
store.set_value(itr, 0, icon)
def get_system_thumbnail(self, filename, size):
diff --git a/user_config/usr/share/solarfm/Main_Window.glade b/user_config/usr/share/solarfm/Main_Window.glade
index 065cf65..56fdb37 100644
--- a/user_config/usr/share/solarfm/Main_Window.glade
+++ b/user_config/usr/share/solarfm/Main_Window.glade
@@ -1266,7 +1266,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
False
- True
+ False
@@ -1304,7 +1304,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
False
- True
+ False
@@ -1356,7 +1356,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
False
- True
+ False
@@ -1393,7 +1393,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
False
- True
+ False