Added quad pane container option

This commit is contained in:
2026-10-01 17:26:44 -05:00
parent b86f10b007
commit 62db247dc4
8 changed files with 178 additions and 21 deletions
+15 -10
View File
@@ -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!")
logger.debug("Hello, World!")
+3
View File
@@ -0,0 +1,3 @@
"""
Containers Package
"""
@@ -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)
@@ -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)
+44
View File
@@ -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)
+3 -1
View File
@@ -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)
+3 -3
View File
@@ -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)
+7 -7
View File
@@ -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)