2023-07-30 00:36:52 -05:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
|
import gi
|
|
|
|
|
gi.require_version('Gtk', '3.0')
|
|
|
|
|
from gi.repository import Gtk
|
|
|
|
|
|
|
|
|
|
# Application imports
|
2024-02-08 21:26:13 -06:00
|
|
|
from ..widgets.webkit.webkit_ui import WebkitUI
|
2023-11-19 15:37:11 -06:00
|
|
|
|
2023-07-30 00:36:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class CenterContainer(Gtk.Box):
|
|
|
|
|
def __init__(self):
|
|
|
|
|
super(CenterContainer, self).__init__()
|
|
|
|
|
|
|
|
|
|
self._setup_styling()
|
|
|
|
|
self._setup_signals()
|
|
|
|
|
self._subscribe_to_events()
|
|
|
|
|
|
2024-08-31 22:27:11 -05:00
|
|
|
self.show()
|
|
|
|
|
|
2023-07-30 00:36:52 -05:00
|
|
|
|
|
|
|
|
def _setup_styling(self):
|
2025-12-15 22:50:28 -06:00
|
|
|
self.ctx = self.get_style_context()
|
|
|
|
|
self.ctx.add_class("center-container")
|
2025-11-29 23:22:03 -06:00
|
|
|
|
2025-12-15 22:50:28 -06:00
|
|
|
self.set_orientation(Gtk.Orientation.VERTICAL)
|
2025-11-29 23:22:03 -06:00
|
|
|
self.set_hexpand(True)
|
|
|
|
|
self.set_vexpand(True)
|
2026-03-29 14:04:56 -05:00
|
|
|
self.set_size_request(320, -1)
|
2025-11-29 23:22:03 -06:00
|
|
|
|
2023-07-30 00:36:52 -05:00
|
|
|
def _setup_signals(self):
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
self.connect("show", self._handle_show)
|
2023-07-30 00:36:52 -05:00
|
|
|
|
|
|
|
|
def _subscribe_to_events(self):
|
|
|
|
|
...
|
|
|
|
|
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
def _handle_show(self, widget):
|
|
|
|
|
self.disconnect_by_func( self._handle_show )
|
|
|
|
|
self._load_widgets()
|
|
|
|
|
|
2023-07-30 00:36:52 -05:00
|
|
|
def _load_widgets(self):
|
2026-02-16 23:52:03 -06:00
|
|
|
widget_registery.expose_object("center-container", self)
|
|
|
|
|
|
2026-01-19 13:50:07 -06:00
|
|
|
glade_box = widget_registery.get_object("glade_box")
|
2025-12-15 22:50:28 -06:00
|
|
|
button = Gtk.Button(label = "Click Me!")
|
2026-02-21 00:38:27 -06:00
|
|
|
webkit_ui = WebkitUI()
|
|
|
|
|
|
|
|
|
|
webkit_ui.load_context_base_path()
|
2023-07-30 00:36:52 -05:00
|
|
|
|
2023-11-19 15:37:11 -06:00
|
|
|
button.connect("clicked", self._hello_world)
|
2023-07-30 00:36:52 -05:00
|
|
|
|
2024-08-31 22:27:11 -05:00
|
|
|
button.show()
|
|
|
|
|
glade_box.show()
|
|
|
|
|
|
2023-07-30 00:36:52 -05:00
|
|
|
self.add(button)
|
|
|
|
|
self.add(glade_box)
|
2026-02-21 00:38:27 -06:00
|
|
|
self.add(webkit_ui)
|
2023-07-30 00:36:52 -05:00
|
|
|
|
2023-10-21 18:58:20 -05:00
|
|
|
def _hello_world(self, widget = None, eve = None):
|
2024-02-08 21:26:13 -06:00
|
|
|
logger.debug("Hello, World!")
|