fix: clean up GTK/WebKit integration and event handling
- fix split pane expansion/orientation setup logic - remove deferred pane positioning on show events - load VTE with interactive bash rcfile - migrate WebKit2 bindings from 4.0 to 4.1 - add icons path accessor to PathManager - normalize startup IPC file event payloads with FILE| prefix - alias App_Event_Types and update plugin event references - guard widget registry against unnamed builder objects - fix application_dirs home path lookup - remove unused GLib import from completion controller - reorder setproctitle import in __main__
This commit is contained in:
BIN
home/abaddon/.config/newton/lsps/ropeproject/autoimport.db
Normal file
BIN
home/abaddon/.config/newton/lsps/ropeproject/autoimport.db
Normal file
Binary file not shown.
@@ -47,6 +47,8 @@ def execute(
|
|||||||
|
|
||||||
pane.set_hexpand(True)
|
pane.set_hexpand(True)
|
||||||
pane.set_vexpand(True)
|
pane.set_vexpand(True)
|
||||||
|
scrolled_win1.set_hexpand(True)
|
||||||
|
scrolled_win2.set_vexpand(True)
|
||||||
pane.set_wide_handle(True)
|
pane.set_wide_handle(True)
|
||||||
|
|
||||||
container.remove(scrolled_win1)
|
container.remove(scrolled_win1)
|
||||||
@@ -54,21 +56,9 @@ def execute(
|
|||||||
pane.pack2( scrolled_win2, True, True )
|
pane.pack2( scrolled_win2, True, True )
|
||||||
container.add(pane)
|
container.add(pane)
|
||||||
|
|
||||||
def _show(pane, alloc, is_vertical: bool):
|
|
||||||
if is_vertical:
|
|
||||||
pane.set_position(alloc.width / 2)
|
|
||||||
else:
|
|
||||||
pane.set_position(alloc.height / 2)
|
|
||||||
|
|
||||||
pane.disconnect(pane.show_id)
|
|
||||||
|
|
||||||
is_control, is_shift, is_alt = modkeys_states
|
|
||||||
alloc = container.get_allocation()
|
|
||||||
if char_str == "|":
|
if char_str == "|":
|
||||||
pane.show_id = pane.connect("show", _show, alloc, True)
|
|
||||||
pane.set_orientation(Gtk.Orientation.VERTICAL)
|
pane.set_orientation(Gtk.Orientation.VERTICAL)
|
||||||
elif char_str == "\\":
|
elif char_str == "\\":
|
||||||
pane.show_id = pane.connect("show", _show, alloc, False)
|
|
||||||
pane.set_orientation(Gtk.Orientation.HORIZONTAL)
|
pane.set_orientation(Gtk.Orientation.HORIZONTAL)
|
||||||
|
|
||||||
pane.show_all()
|
pane.show_all()
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import traceback
|
import traceback
|
||||||
from setproctitle import setproctitle
|
|
||||||
|
|
||||||
import tracemalloc
|
import tracemalloc
|
||||||
tracemalloc.start()
|
tracemalloc.start()
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from __builtins__ import *
|
from __builtins__ import *
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class BaseController(IPCSignalsMixin, KeyboardSignalsMixin, BaseControllerMixin)
|
|||||||
|
|
||||||
def _load_files(self):
|
def _load_files(self):
|
||||||
for file in settings_manager.get_starting_files():
|
for file in settings_manager.get_starting_files():
|
||||||
event_system.emit("post-file-to-ipc", file)
|
event_system.emit("post-file-to-ipc", f"FILE|{file}")
|
||||||
|
|
||||||
def _tggl_top_main_menubar(self):
|
def _tggl_top_main_menubar(self):
|
||||||
logger.debug("_tggl_top_main_menubar > stub...")
|
logger.debug("_tggl_top_main_menubar > stub...")
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import gi
|
import gi
|
||||||
gi.require_version('GtkSource', '4')
|
gi.require_version('GtkSource', '4')
|
||||||
|
|
||||||
from gi.repository import GLib
|
|
||||||
from gi.repository import GtkSource
|
from gi.repository import GtkSource
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class VteWidget(Vte.Terminal):
|
|||||||
self.spawn_async(
|
self.spawn_async(
|
||||||
Vte.PtyFlags.DEFAULT,
|
Vte.PtyFlags.DEFAULT,
|
||||||
settings_manager.path_manager.get_home_path(),
|
settings_manager.path_manager.get_home_path(),
|
||||||
["/bin/bash"],
|
["/bin/bash", "--rcfile", f"{settings_manager.path_manager.get_home_path()}/.bashrc", "-i"],
|
||||||
env,
|
env,
|
||||||
GLib.SpawnFlags.DEFAULT,
|
GLib.SpawnFlags.DEFAULT,
|
||||||
None, None, -1, None, None,
|
None, None, -1, None, None,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gdk', '3.0')
|
gi.require_version('Gdk', '3.0')
|
||||||
gi.require_version('WebKit2', '4.0')
|
gi.require_version('WebKit2', '4.1')
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gio
|
from gi.repository import Gio
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class EventFactory(Singleton):
|
|||||||
event_type = self._class_name_to_event_type(name)
|
event_type = self._class_name_to_event_type(name)
|
||||||
|
|
||||||
self._event_classes[event_type] = obj
|
self._event_classes[event_type] = obj
|
||||||
Code_Event_Types.add_event_class(name, obj)
|
App_Event_Types.add_event_class(name, obj)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
logger.debug(f"Registered {i} event types:")
|
logger.debug(f"Registered {i} event types:")
|
||||||
@@ -44,7 +44,7 @@ class EventFactory(Singleton):
|
|||||||
event_type = self._class_name_to_event_type(name)
|
event_type = self._class_name_to_event_type(name)
|
||||||
|
|
||||||
del self._event_classes[event_type]
|
del self._event_classes[event_type]
|
||||||
Code_Event_Types.remove_event_class(name)
|
App_Event_Types.remove_event_class(name)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
logger.debug(f"Unregistered {i} event types:")
|
logger.debug(f"Unregistered {i} event types:")
|
||||||
@@ -98,6 +98,7 @@ class EventNamespace:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Code_Event_Types = EventNamespace()
|
App_Event_Types = EventNamespace()
|
||||||
|
Code_Event_Types = App_Event_Types
|
||||||
Event_Factory = EventFactory()
|
Event_Factory = EventFactory()
|
||||||
|
|
||||||
|
|||||||
@@ -35,5 +35,5 @@ class Config:
|
|||||||
main_window_height: int = 600
|
main_window_height: int = 600
|
||||||
application_dirs: list = field(default_factory=lambda: [
|
application_dirs: list = field(default_factory=lambda: [
|
||||||
"/usr/share/applications",
|
"/usr/share/applications",
|
||||||
f"{settings_manager.get_home_path()}/.local/share/applications"
|
f"{settings_manager.path_manager.get_home_path()}/.local/share/applications"
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ class PathManager:
|
|||||||
def get_ui_widgets_path(self) -> str: return self._UI_WIDGETS_PATH
|
def get_ui_widgets_path(self) -> str: return self._UI_WIDGETS_PATH
|
||||||
def get_context_path(self) -> str: return self._CONTEXT_PATH
|
def get_context_path(self) -> str: return self._CONTEXT_PATH
|
||||||
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
||||||
|
def get_icons_path(self) -> str: return self._DEFAULT_ICONS
|
||||||
def get_css_file(self) -> str: return self._CSS_FILE
|
def get_css_file(self) -> str: return self._CSS_FILE
|
||||||
def get_home_config_path(self) -> str: return self._HOME_CONFIG_PATH
|
def get_home_config_path(self) -> str: return self._HOME_CONFIG_PATH
|
||||||
def get_window_icon(self) -> str: return self._WINDOW_ICON
|
def get_window_icon(self) -> str: return self._WINDOW_ICON
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('WebKit2', '4.0')
|
gi.require_version('WebKit2', '4.1')
|
||||||
from gi.repository import WebKit2
|
from gi.repository import WebKit2
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class WidgetRegisteryController(ControllerBase):
|
|||||||
|
|
||||||
widgets = self._builder.get_objects()
|
widgets = self._builder.get_objects()
|
||||||
for widget in widgets:
|
for widget in widgets:
|
||||||
|
if not hasattr(widget, "get_name"): continue
|
||||||
self.builder_keys.append( widget.get_name() )
|
self.builder_keys.append( widget.get_name() )
|
||||||
|
|
||||||
def _controller_message(self, event: BaseEvent):
|
def _controller_message(self, event: BaseEvent):
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from gi.repository import Gtk
|
|||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from libs.event_factory import Event_Factory, Code_Event_Types
|
from libs.event_factory import Event_Factory, App_Event_Types, Code_Event_Types
|
||||||
from libs.controllers.controller_base import ControllerBase
|
from libs.controllers.controller_base import ControllerBase
|
||||||
from libs.dto.plugins.manifest_meta import ManifestMeta
|
from libs.dto.plugins.manifest_meta import ManifestMeta
|
||||||
from libs.dto.base_event import BaseEvent
|
from libs.dto.base_event import BaseEvent
|
||||||
@@ -58,7 +58,7 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
|
|||||||
item = Gtk.MenuItem(label = "Plugins")
|
item = Gtk.MenuItem(label = "Plugins")
|
||||||
item.connect("activate", self.toggle_plugins_ui)
|
item.connect("activate", self.toggle_plugins_ui)
|
||||||
event.menu.append(item)
|
event.menu.append(item)
|
||||||
elif isinstance(event, Code_Event_Types.TogglePluginsUiEvent):
|
elif isinstance(event, App_Event_Types.TogglePluginsUiEvent):
|
||||||
self.toggle_plugins_ui()
|
self.toggle_plugins_ui()
|
||||||
|
|
||||||
def _collect_search_locations(self, path: str, locations: list):
|
def _collect_search_locations(self, path: str, locations: list):
|
||||||
|
|||||||
Reference in New Issue
Block a user