Small fixes
This commit is contained in:
parent
793621745a
commit
111c535876
|
@ -9,13 +9,13 @@ from gi.repository import Gtk
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Threads will not die with parent's destruction
|
# NOTE: Threads WILL NOT die with parent's destruction.
|
||||||
def threaded(fn):
|
def threaded(fn):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
# NOTE: Insure threads die with parent's destruction
|
# NOTE: Threads WILL die with parent's destruction.
|
||||||
def daemon_threaded(fn):
|
def daemon_threaded(fn):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
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 = Gtk.Button(label=self._plugin_name)
|
||||||
button.connect("button-release-event", self.send_message)
|
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 = self._builder.get_object("plugin_socket")
|
||||||
plugin_list.add(button)
|
plugin_list.add(button)
|
||||||
plugin_list.show_all()
|
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):
|
def get_plugin_name(self):
|
||||||
return self._plugin_name
|
return self._plugin_name
|
||||||
|
|
||||||
|
@ -63,6 +56,12 @@ class Plugin:
|
||||||
def get_socket_id(self):
|
def get_socket_id(self):
|
||||||
return self._socket_id
|
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
|
@daemon_threaded
|
||||||
def _module_event_observer(self):
|
def _module_event_observer(self):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -9,13 +9,13 @@ from gi.repository import Gtk
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Threads will not die with parent's destruction
|
# NOTE: Threads WILL NOT die with parent's destruction.
|
||||||
def threaded(fn):
|
def threaded(fn):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
# NOTE: Insure threads die with parent's destruction
|
# NOTE: Threads WILL die with parent's destruction.
|
||||||
def daemon_threaded(fn):
|
def daemon_threaded(fn):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||||
|
@ -36,16 +36,26 @@ class Plugin:
|
||||||
self._event_sleep_time = .5
|
self._event_sleep_time = .5
|
||||||
self._fm_event_message = None
|
self._fm_event_message = None
|
||||||
|
|
||||||
|
self._module_event_observer()
|
||||||
|
|
||||||
button = Gtk.Button(label=self._plugin_name)
|
button = Gtk.Button(label=self._plugin_name)
|
||||||
button.connect("button-release-event", self._do_download)
|
button.connect("button-release-event", self._do_download)
|
||||||
|
|
||||||
self._module_event_observer()
|
|
||||||
|
|
||||||
plugin_list = self._fm_builder.get_object("plugin_socket")
|
plugin_list = self._fm_builder.get_object("plugin_socket")
|
||||||
plugin_list.add(button)
|
plugin_list.add(button)
|
||||||
plugin_list.show_all()
|
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
|
@daemon_threaded
|
||||||
def _module_event_observer(self):
|
def _module_event_observer(self):
|
||||||
while True:
|
while True:
|
||||||
|
@ -74,13 +84,3 @@ class Plugin:
|
||||||
state = self._fm_event_message
|
state = self._fm_event_message
|
||||||
subprocess.Popen([f'{self.SCRIPT_PTH}/download.sh' , state.tab.get_current_directory()])
|
subprocess.Popen([f'{self.SCRIPT_PTH}/download.sh' , state.tab.get_current_directory()])
|
||||||
self._fm_event_message = None
|
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()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@daemon_threaded
|
||||||
def gui_event_observer(self):
|
def gui_event_observer(self):
|
||||||
while True:
|
while True:
|
||||||
time.sleep(event_sleep_time)
|
time.sleep(event_sleep_time)
|
||||||
|
|
|
@ -43,13 +43,6 @@ class GridMixin:
|
||||||
GLib.idle_add(self.update_store, *(i, store, icon, tab, dir, file,))
|
GLib.idle_add(self.update_store, *(i, store, icon, tab, dir, file,))
|
||||||
|
|
||||||
def update_store(self, 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:
|
if not icon:
|
||||||
path = f"{dir}/{file}"
|
path = f"{dir}/{file}"
|
||||||
icon = self.get_system_thumbnail(path, tab.sys_icon_wh[0])
|
icon = self.get_system_thumbnail(path, tab.sys_icon_wh[0])
|
||||||
|
@ -57,6 +50,7 @@ class GridMixin:
|
||||||
if not icon:
|
if not icon:
|
||||||
icon = GdkPixbuf.Pixbuf.new_from_file(tab.DEFAULT_ICON)
|
icon = GdkPixbuf.Pixbuf.new_from_file(tab.DEFAULT_ICON)
|
||||||
|
|
||||||
|
itr = store.get_iter(i)
|
||||||
store.set_value(itr, 0, icon)
|
store.set_value(itr, 0, icon)
|
||||||
|
|
||||||
def get_system_thumbnail(self, filename, size):
|
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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1304,7 +1304,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1356,7 +1356,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1393,7 +1393,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in New Issue