Small fixes
This commit is contained in:
parent
793621745a
commit
111c535876
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -1266,7 +1266,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -1304,7 +1304,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -1356,7 +1356,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -1393,7 +1393,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user