Bringing to latest changes #3

Merged
itdominator merged 41 commits from develop into master 2022-07-16 19:14:30 +00:00
7 changed files with 84 additions and 51 deletions
Showing only changes of commit a863dbc586 - Show all commits

View File

@ -20,18 +20,17 @@ class Main:
self._socket_id = socket_id
self._event_system = event_system
self._gtk_plug = Gtk.Plug.new(self._socket_id)
self.start_loop()
@threaded
def start_loop(self):
i = 0
cycles = 5
alive = True
while alive:
if i == cycles:
alive = False
button = Gtk.Button(label="Click Me!")
button.connect("button-release-event", self._do_action)
self._gtk_plug.add(button)
self._gtk_plug.show_all()
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

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...")

View File

@ -1124,7 +1124,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<class name="alert-border"/>
</style>
</object>
<object class="GtkImage" id="image1">
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can-focus">False</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>
</object>
</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>
<object class="GtkImageMenuItem">
<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>
</object>
</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>
<packing>
<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="spacing">5</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>
<object class="GtkToggleButton" id="tggl_notebook_1">
<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>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -1547,7 +1561,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -1563,7 +1577,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -1579,7 +1593,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
</object>
@ -2043,6 +2057,20 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
</object>
</child>
</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">
<property name="can-focus">False</property>
<property name="margin-start">5</property>