Plugin work on socket/plug

This commit is contained in:
2022-01-31 00:13:43 -06:00
parent 628740fd31
commit a863dbc586
7 changed files with 84 additions and 51 deletions

View File

@@ -62,7 +62,6 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, Controller_Data
except Exception as e:
print(repr(e))
def custom_except_hook(self, exctype, value, _traceback):
trace = ''.join(traceback.format_tb(_traceback))
data = f"Exectype: {exctype} <--> Value: {value}\n\n{trace}\n\n\n\n"

View File

@@ -34,7 +34,7 @@ class IPCServerMixin:
if "FILE|" in msg:
file = msg.split("FILE|")[1].strip()
if file:
event_system.push_gui_event([None, "handle_file_from_ipc", file])
event_system.push_gui_event([None, "handle_file_from_ipc", (file,)])
conn.close()
break

View File

@@ -96,6 +96,12 @@ class ShowHideMixin:
dialog.response(Gtk.ResponseType.OK)
def show_plugins_popup(self, widget=None, eve=None):
self.builder.get_object("plugin_list").popup()
def hide_plugins_popup(self, widget=None, eve=None):
self.builder.get_object("plugin_list").hide()
def show_context_menu(self, widget=None, eve=None):
self.builder.get_object("context_menu").run()

View File

@@ -133,8 +133,6 @@ class WidgetMixin:
grid.connect("button_release_event", self.grid_icon_single_click)
grid.connect("item-activated", self.grid_icon_double_click)
# grid.connect("toggle-cursor-item", self.grid_cursor_toggled)
# grid.connect("notify", self.grid_cursor_toggled)
grid.connect("selection-changed", self.grid_set_selected_items)
grid.connect("drag-data-get", self.grid_on_drag_set)
grid.connect("drag-data-received", self.grid_on_drag_data_received)

View File

@@ -16,15 +16,18 @@ class Plugins:
"""docstring for Plugins"""
def __init__(self, settings):
self._settings = settings
self._plugin_list_widget = self._settings.get_builder().get_object("plugin_list")
self._plugin_list_socket = self._settings.get_builder().get_object("plugin_socket")
self._plugins_path = self._settings.get_plugins_path()
self.gtk_socket = Gtk.Socket().new()
self._gtk_socket = Gtk.Socket().new()
self._plugins_dir_watcher = None
self.gtk_socket_id = None
self._plugin_collection = []
self._settings.get_main_window().add(self.gtk_socket)
self.gtk_socket.show()
self.gtk_socket_id = self.gtk_socket.get_id()
self._plugin_list_socket.add(self._gtk_socket)
# NOTE: Must get ID after adding socket to window. Else issues....
self._gtk_socket_id = self._gtk_socket.get_id()
self._plugin_list_widget.show_all()
def launch_plugins(self):
@@ -49,10 +52,10 @@ class Plugins:
if isdir(path):
spec = importlib.util.spec_from_file_location(file, join(path, "__main__.py"))
module = importlib.util.module_from_spec(spec)
self._plugin_collection.append([file, module])
spec.loader.exec_module(module)
module.Main(self.gtk_socket_id, event_system)
plugin = module.Main(self._gtk_socket_id, event_system)
self._plugin_collection.append([file, plugin])
def reload_plugins(self, file=None):
print(f"Reloading plugins...")