Moved plugins and refactor command system

- Moved plugins to apropriate sub folders
- Refactor command system with new add_command method and rename GetCommandSystemEvent to GetNewCommandSystemEvent
- Add RegisterCommandEvent for dynamic command registration
- Change footer container orientation to VERTICAL
- Add search-highlight tag to source buffer
- Add file change detection (deleted, externally modified) in source_file
- Add JSON prettify option to source view popup menu
- Enable hexpand on VTE widget
- Update plugins_controller_mixin to use widget_registry
This commit is contained in:
2026-02-18 23:49:01 -06:00
parent 2819598ae2
commit 61b8bbc5fa
89 changed files with 850 additions and 1029 deletions

View File

@@ -0,0 +1,65 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from libs.event_factory import Event_Factory, Code_Event_Types
from plugins.plugin_types import PluginCode
from .search_replace import SearchReplace
search_replace = SearchReplace()
class Plugin(PluginCode):
def __init__(self):
super(Plugin, self).__init__()
def _controller_message(self, event: Code_Event_Types.CodeEvent):
if isinstance(event, Code_Event_Types.FocusedViewEvent):
self._handle_view_change(event)
def _handle_view_change(self, event: Code_Event_Types.FocusedViewEvent):
if search_replace.is_visible():
buffer = search_replace.active_view.get_buffer()
search_replace.clear_highlight(buffer)
search_replace.active_view = event.view
if search_replace.is_visible():
search_replace._find_entry_search_change(
search_replace.find_entry
)
def load(self):
footer = self.requests_ui_element("footer-container")
footer.add( search_replace )
event = Event_Factory.create_event("register_command",
command_name = "search_replace",
command = Handler,
binding_mode = "released",
binding = "<Control>f"
)
self.message_to("source_views", event)
def run(self):
...
class Handler:
@staticmethod
def execute(
view: any
):
logger.debug("Command: Search/Replace")
search_replace.hide() if search_replace.is_visible() else search_replace.show()