Bringing to latest changes #3
|
@ -20,18 +20,17 @@ class Main:
|
||||||
self._socket_id = socket_id
|
self._socket_id = socket_id
|
||||||
self._event_system = event_system
|
self._event_system = event_system
|
||||||
self._gtk_plug = Gtk.Plug.new(self._socket_id)
|
self._gtk_plug = Gtk.Plug.new(self._socket_id)
|
||||||
self.start_loop()
|
|
||||||
|
|
||||||
@threaded
|
button = Gtk.Button(label="Click Me!")
|
||||||
def start_loop(self):
|
button.connect("button-release-event", self._do_action)
|
||||||
i = 0
|
self._gtk_plug.add(button)
|
||||||
cycles = 5
|
self._gtk_plug.show_all()
|
||||||
alive = True
|
|
||||||
while alive:
|
|
||||||
if i == cycles:
|
|
||||||
alive = False
|
|
||||||
|
|
||||||
self._event_system.push_gui_event(["some_type", "display_message", ("warning", str(i), None)])
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
time.sleep(1)
|
def _do_action(self, widget=None, eve=None):
|
||||||
|
message = "Hello, World!"
|
||||||
|
self._event_system.push_gui_event(["some_type", "display_message", ("warning", message, None)])
|
||||||
|
|
||||||
|
|
||||||
|
def get_socket_id(self):
|
||||||
|
return self._socket_id
|
||||||
|
|
|
@ -62,7 +62,6 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, Controller_Data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(repr(e))
|
print(repr(e))
|
||||||
|
|
||||||
|
|
||||||
def custom_except_hook(self, exctype, value, _traceback):
|
def custom_except_hook(self, exctype, value, _traceback):
|
||||||
trace = ''.join(traceback.format_tb(_traceback))
|
trace = ''.join(traceback.format_tb(_traceback))
|
||||||
data = f"Exectype: {exctype} <--> Value: {value}\n\n{trace}\n\n\n\n"
|
data = f"Exectype: {exctype} <--> Value: {value}\n\n{trace}\n\n\n\n"
|
||||||
|
|
|
@ -34,7 +34,7 @@ class IPCServerMixin:
|
||||||
if "FILE|" in msg:
|
if "FILE|" in msg:
|
||||||
file = msg.split("FILE|")[1].strip()
|
file = msg.split("FILE|")[1].strip()
|
||||||
if file:
|
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()
|
conn.close()
|
||||||
break
|
break
|
||||||
|
|
|
@ -96,6 +96,12 @@ class ShowHideMixin:
|
||||||
dialog.response(Gtk.ResponseType.OK)
|
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):
|
def show_context_menu(self, widget=None, eve=None):
|
||||||
self.builder.get_object("context_menu").run()
|
self.builder.get_object("context_menu").run()
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,6 @@ class WidgetMixin:
|
||||||
|
|
||||||
grid.connect("button_release_event", self.grid_icon_single_click)
|
grid.connect("button_release_event", self.grid_icon_single_click)
|
||||||
grid.connect("item-activated", self.grid_icon_double_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("selection-changed", self.grid_set_selected_items)
|
||||||
grid.connect("drag-data-get", self.grid_on_drag_set)
|
grid.connect("drag-data-get", self.grid_on_drag_set)
|
||||||
grid.connect("drag-data-received", self.grid_on_drag_data_received)
|
grid.connect("drag-data-received", self.grid_on_drag_data_received)
|
||||||
|
|
|
@ -16,15 +16,18 @@ class Plugins:
|
||||||
"""docstring for Plugins"""
|
"""docstring for Plugins"""
|
||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
self._settings = 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._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._plugins_dir_watcher = None
|
||||||
self.gtk_socket_id = None
|
|
||||||
self._plugin_collection = []
|
self._plugin_collection = []
|
||||||
|
|
||||||
self._settings.get_main_window().add(self.gtk_socket)
|
self._plugin_list_socket.add(self._gtk_socket)
|
||||||
self.gtk_socket.show()
|
|
||||||
self.gtk_socket_id = self.gtk_socket.get_id()
|
# 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):
|
def launch_plugins(self):
|
||||||
|
@ -49,10 +52,10 @@ class Plugins:
|
||||||
if isdir(path):
|
if isdir(path):
|
||||||
spec = importlib.util.spec_from_file_location(file, join(path, "__main__.py"))
|
spec = importlib.util.spec_from_file_location(file, join(path, "__main__.py"))
|
||||||
module = importlib.util.module_from_spec(spec)
|
module = importlib.util.module_from_spec(spec)
|
||||||
self._plugin_collection.append([file, module])
|
|
||||||
|
|
||||||
spec.loader.exec_module(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):
|
def reload_plugins(self, file=None):
|
||||||
print(f"Reloading plugins...")
|
print(f"Reloading plugins...")
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<class name="alert-border"/>
|
<class name="alert-border"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkImage" id="image3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="stock">gtk-justify-center</property>
|
<property name="stock">gtk-justify-center</property>
|
||||||
|
@ -1386,6 +1386,29 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Debug</property>
|
||||||
|
<child type="submenu">
|
||||||
|
<object class="GtkMenu">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem">
|
||||||
|
<property name="label">Show Errors</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="image">image3</property>
|
||||||
|
<property name="use-stock">False</property>
|
||||||
|
<signal name="button-release-event" handler="show_messages_popup" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImageMenuItem">
|
<object class="GtkImageMenuItem">
|
||||||
<property name="label">gtk-quit</property>
|
<property name="label">gtk-quit</property>
|
||||||
|
@ -1482,29 +1505,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">Debug</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkImageMenuItem">
|
|
||||||
<property name="label">Show Errors</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="image">image1</property>
|
|
||||||
<property name="use-stock">False</property>
|
|
||||||
<signal name="button-release-event" handler="show_messages_popup" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -1518,6 +1518,20 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
<property name="layout-style">start</property>
|
<property name="layout-style">start</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="plugins_buttoin">
|
||||||
|
<property name="label" translatable="yes">Plugins</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<signal name="released" handler="show_plugins_popup" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="tggl_notebook_1">
|
<object class="GtkToggleButton" id="tggl_notebook_1">
|
||||||
<property name="name">tggl_notebook_1</property>
|
<property name="name">tggl_notebook_1</property>
|
||||||
|
@ -1531,7 +1545,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1547,7 +1561,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1563,7 +1577,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1579,7 +1593,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">3</property>
|
<property name="position">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -2043,6 +2057,20 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkPopover" id="plugin_list">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="relative-to">plugins_buttoin</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="plugin_socket">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkPopover" id="win1_search">
|
<object class="GtkPopover" id="win1_search">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="margin-start">5</property>
|
<property name="margin-start">5</property>
|
||||||
|
|
Loading…
Reference in New Issue