Wiring plugins to controller messages; importing plugin controller to code base; fixed VTE widget adding to bash history

This commit is contained in:
2026-01-18 22:39:52 -06:00
parent b8ce6e160a
commit a036dc428b
7 changed files with 31 additions and 20 deletions

View File

@@ -6,7 +6,8 @@ from shutil import which
# Lib imports
# Application imports
from plugins.plugins_controller import PluginsController
from plugins import plugins_controller
from ..builder_wrapper import BuilderWrapper
@@ -17,7 +18,7 @@ class BaseControllerData:
def _setup_controller_data(self) -> None:
self.window = settings_manager.get_main_window()
self.builder = BuilderWrapper()
self.plugins_controller = PluginsController()
self.plugins_controller = plugins_controller
self.base_container = None
self.was_midified_key = False

View File

@@ -3,6 +3,8 @@
# Lib imports
# Application imports
from plugins import plugins_controller
from libs.controllers.controller_manager import ControllerManager
from .controllers.files_controller import FilesController
@@ -38,7 +40,7 @@ class CodeBase:
self.controller_manager.register_controller("commands", commands_controller)
self.controller_manager.register_controller("completion", completion_controller)
self.controller_manager.register_controller("source_views", source_views_controller)
# self.controller_manager.register_controller("plugins", plugins_controller)
self.controller_manager.register_controller("plugins", plugins_controller)
def get_tabs_widget(self):
return self.controller_manager["tabs"].get_tabs_widget()

View File

@@ -58,28 +58,29 @@ class VteWidget(Vte.Terminal):
...
def _do_session_spawn(self):
env = [
"DISPLAY=:0",
"LC_ALL=C",
"TERM='xterm-256color'",
f"HOME='{settings_manager.path_manager.get_home_path()}'",
"XDG_RUNTIME_DIR='/run/user/1000'",
f"XAUTHORITY='{settings_manager.path_manager.get_home_path()}/.Xauthority'",
"HISTFILE=/dev/null",
"HISTSIZE=0",
"HISTFILESIZE=0",
"PS1=\\h@\\u \\W -->: ",
]
self.spawn_sync(
Vte.PtyFlags.DEFAULT,
settings_manager.path_manager.get_home_path(),
["/bin/bash"],
[],
env,
GLib.SpawnFlags.DEFAULT,
None, None,
)
# Note: '-->:' is used as a delimiter to split on to get command actual.
# !!! DO NOT REMOVE UNLESS CODE UPDATED ACCORDINGLY !!!
# Also, KEEP the <space> prefix in commands to keep from inserting to bash history.
startup_cmds = [
" env -i /bin/bash --noprofile --norc\n",
" export TERM='xterm-256color'\n",
" export LC_ALL=C\n",
" export XDG_RUNTIME_DIR='/run/user/1000'\n",
" export DISPLAY=:0\n",
f" export XAUTHORITY='{settings_manager.path_manager.get_home_path()}/.Xauthority'\n",
f" \nexport HOME='{settings_manager.path_manager.get_home_path()}'\n",
" export PS1='\\h@\\u \\W -->: '\n",
" clear\n"
]
for i in startup_cmds:

View File

@@ -1,3 +1,5 @@
"""
Gtk Bound Plugins Module
"""
from .controller import plugins_controller

View File

@@ -47,7 +47,8 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
def _controller_message(self, event: BaseEvent):
...
for manifest_meta in self._plugin_collection:
manifest_meta.instance._controller_message(event)
def _collect_search_locations(self, path: str, locations: list):
locations.append(path)
@@ -121,7 +122,6 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
def execute_plugin(self, module: type, manifest_meta: ManifestMeta):
plugin = module.Plugin()
plugin.plugin_context: PluginContext = self.create_plugin_context()
plugin._controller_message: callable = self._controller_message
manifest = manifest_meta.manifest
manifest_meta.instance = plugin

View File

@@ -21,7 +21,7 @@ class PluginBase:
self.plugin_context: PluginContext = None
def _controller_message(self):
def _controller_message(self, event: BaseEvent):
raise PluginBaseException("Plugin Base '_controller_message' must be overriden by Plugin")
def load(self):