diff --git a/src/core/containers/center_container.py b/src/core/containers/center_container.py index 7b12bf0..0ee7b6d 100644 --- a/src/core/containers/center_container.py +++ b/src/core/containers/center_container.py @@ -6,6 +6,7 @@ gi.require_version('Gtk', '3.0') from gi.repository import Gtk # Application imports +from .quad.quad_container import QuadContainer from core.widgets.webkit.webkit_ui import WebkitUI @@ -43,20 +44,24 @@ class CenterContainer(Gtk.Box): def _load_widgets(self): widget_registery.expose_object("center-container", self) - glade_box = widget_registery.get_object("glade_box") - button = Gtk.Button(label = "Click Me!") - webkit_ui = WebkitUI() - - webkit_ui.load_context_base_path() + quad_container = QuadContainer() + webkit_ui = WebkitUI() + button = Gtk.Button(label = "Click Me!") + label = Gtk.Label(label = "bright") + glade_box = widget_registery.get_object("glade_box") button.connect("clicked", self._hello_world) - + webkit_ui.load_context_base_path() button.show() + label.show() glade_box.show() - self.add(button) - self.add(glade_box) - self.add(webkit_ui) + quad_container.top_container.pack1(button, True, True) + quad_container.top_container.pack2(glade_box, True, True) + quad_container.bottom_container.pack1(webkit_ui, True, True) + quad_container.bottom_container.pack2(label, True, True) + + self.add(quad_container) def _hello_world(self, widget = None, eve = None): - logger.debug("Hello, World!") \ No newline at end of file + logger.debug("Hello, World!") diff --git a/src/core/containers/quad/__init__.py b/src/core/containers/quad/__init__.py new file mode 100644 index 0000000..c59e952 --- /dev/null +++ b/src/core/containers/quad/__init__.py @@ -0,0 +1,3 @@ +""" + Containers Package +""" \ No newline at end of file diff --git a/src/core/containers/quad/bottom_container.py b/src/core/containers/quad/bottom_container.py new file mode 100644 index 0000000..99e1df5 --- /dev/null +++ b/src/core/containers/quad/bottom_container.py @@ -0,0 +1,44 @@ +# Python imports + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +# Application imports + + + +class BottomContainer(Gtk.Paned): + def __init__(self): + super(BottomContainer, self).__init__() + + self._setup_styling() + self._setup_signals() + self._subscribe_to_events() + + self.show() + + + def _setup_styling(self): + self.ctx = self.get_style_context() + self.ctx.add_class("quad-bottom-container") + + self.set_hexpand(True) + self.set_vexpand(True) + self.set_wide_handle(True) + self.set_orientation(Gtk.Orientation.HORIZONTAL) + + def _setup_signals(self): + self.connect("show", self._handle_show) + + def _subscribe_to_events(self): + pass + + def _handle_show(self, widget): + self.disconnect_by_func( self._handle_show ) + self._load_widgets() + self.show_all() + + def _load_widgets(self): + widget_registery.expose_object("quad-bottom-container", self) diff --git a/src/core/containers/quad/quad_container.py b/src/core/containers/quad/quad_container.py new file mode 100644 index 0000000..2f94ebc --- /dev/null +++ b/src/core/containers/quad/quad_container.py @@ -0,0 +1,59 @@ +# Python imports + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +# Application imports +from .top_container import TopContainer +from .bottom_container import BottomContainer + + + +class QuadContainer(Gtk.Paned): + def __init__(self): + super(QuadContainer, self).__init__() + + self._setup_styling() + self._setup_signals() + self._subscribe_to_events() + + self.show() + + + def _setup_styling(self): + self.ctx = self.get_style_context() + self.ctx.add_class("quad-container") + + self.set_hexpand(True) + self.set_vexpand(True) + self.set_wide_handle(True) + self.set_orientation(Gtk.Orientation.VERTICAL) + + def _setup_signals(self): + self.connect("show", self._handle_show) + self.connect("size-allocate", self._size_allocate) + + def _subscribe_to_events(self): + pass + + def _handle_show(self, widget): + self.disconnect_by_func( self._handle_show ) + self._load_widgets() + + def _size_allocate(self, widget, allocation): + self.disconnect_by_func( self._size_allocate ) + + self.top_container.set_position( allocation.width / 2 ) + self.bottom_container.set_position( allocation.width / 2 ) + self.set_position( allocation.height / 2 ) + + def _load_widgets(self): + widget_registery.expose_object("quad-container", self) + + self.top_container = TopContainer() + self.bottom_container = BottomContainer() + + self.pack1(self.top_container, True, True) + self.pack2(self.bottom_container, True, True) diff --git a/src/core/containers/quad/top_container.py b/src/core/containers/quad/top_container.py new file mode 100644 index 0000000..ef5a57a --- /dev/null +++ b/src/core/containers/quad/top_container.py @@ -0,0 +1,44 @@ +# Python imports + +# Lib imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +# Application imports + + + +class TopContainer(Gtk.Paned): + def __init__(self): + super(TopContainer, self).__init__() + + self._setup_styling() + self._setup_signals() + self._subscribe_to_events() + + self.show() + + + def _setup_styling(self): + self.ctx = self.get_style_context() + self.ctx.add_class("quad-top-container") + + self.set_hexpand(True) + self.set_vexpand(True) + self.set_wide_handle(True) + self.set_orientation(Gtk.Orientation.HORIZONTAL) + + def _setup_signals(self): + self.connect("show", self._handle_show) + + def _subscribe_to_events(self): + pass + + def _handle_show(self, widget): + self.disconnect_by_func( self._handle_show ) + self._load_widgets() + self.show_all() + + def _load_widgets(self): + widget_registery.expose_object("quad-top-container", self) diff --git a/src/libs/controllers/controller_base.py b/src/libs/controllers/controller_base.py index 3997ba6..53ce236 100644 --- a/src/libs/controllers/controller_base.py +++ b/src/libs/controllers/controller_base.py @@ -37,8 +37,10 @@ class ControllerBase(Singleton, EmitDispatcher): return self.controller_message_bus.message_to(name, event) def message_to_selected(self, names: list[str], event: BaseEvent): - for name in names: + return [ self.controller_message_bus.message_to_selected(name, event) + for name in names + ] def register_controller(self, name: str, controller): self.controller_message_bus.register_controller(name, controller) diff --git a/src/plugins/plugin_types/plugin_code.py b/src/plugins/plugin_types/plugin_code.py index 3c6188d..3106eaf 100644 --- a/src/plugins/plugin_types/plugin_code.py +++ b/src/plugins/plugin_types/plugin_code.py @@ -41,10 +41,10 @@ class PluginCode(PluginBase): return self.plugin_context.request_ui_element(element_id) def emit(self, event: BaseEvent): - return self.plugin_context.emit(event) + self.plugin_context.emit(event) def emit_to(self, name: str, event: BaseEvent): - return self.plugin_context.emit_to(name, event) + self.plugin_context.emit_to(name, event) def emit_to_selected(self, names: list[str], event: BaseEvent): - return self.plugin_context.emit_to_selected(names, event) + self.plugin_context.emit_to_selected(names, event) diff --git a/src/plugins/plugin_types/plugin_ui.py b/src/plugins/plugin_types/plugin_ui.py index f09e09f..46ae04a 100644 --- a/src/plugins/plugin_types/plugin_ui.py +++ b/src/plugins/plugin_types/plugin_ui.py @@ -10,7 +10,7 @@ from .plugin_base import PluginBase -class PluginCodeException(Exception): +class PluginUIException(Exception): ... @@ -23,22 +23,22 @@ class PluginUI(PluginBase): def _controller_message(self, event: BaseEvent): - raise PluginCodeException("Plugin UI '_controller_message' must be overriden by Plugin") + raise PluginUIException("Plugin UI '_controller_message' must be overriden by Plugin") def load(self): - raise PluginCodeException("Plugin UI 'load' must be overriden by Plugin") + raise PluginUIException("Plugin UI 'load' must be overriden by Plugin") def run(self): - raise PluginCodeException("Plugin UI 'run' must be overriden by Plugin") + raise PluginUIException("Plugin UI 'run' must be overriden by Plugin") def request_ui_element(self, element_id: str): return self.plugin_context.request_ui_element(element_id) def emit(self, event: BaseEvent): - return self.plugin_context.emit(event) + self.plugin_context.emit(event) def emit_to(self, name: str, event: BaseEvent): - return self.plugin_context.emit_to(name, event) + self.plugin_context.emit_to(name, event) def emit_to_selected(self, names: list[str], event: BaseEvent): - return self.plugin_context.emit_to_selected(names, event) + self.plugin_context.emit_to_selected(names, event)