Files
Python-With-Gtk-Template/plugins/code/commands/split_pane/create_split_view.py
itdominator fac9ee028b 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__
2026-05-22 21:16:01 -05:00

68 lines
1.6 KiB
Python

# 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 libs.dto.states import SourceViewStates
emit_to: callable = None
def execute(
source_view1,
char_str,
modkeys_states
):
logger.debug("Command: Split Pane")
scrolled_win1 = source_view1.get_parent()
container = scrolled_win1.get_parent()
pane = Gtk.Paned()
event = Event_Factory.create_event(
"create_source_view",
state = SourceViewStates.INSERT
)
emit_to("source_views", event)
scrolled_win2, \
source_view2 = event.response
old_sibling_right = None
if source_view1.sibling_right:
old_sibling_right = source_view1.sibling_right
source_view1.sibling_right = source_view2
if old_sibling_right:
old_sibling_right.sibling_left = source_view2
source_view2.sibling_right = old_sibling_right
source_view2.sibling_left = source_view1
pane.set_hexpand(True)
pane.set_vexpand(True)
scrolled_win1.set_hexpand(True)
scrolled_win2.set_vexpand(True)
pane.set_wide_handle(True)
container.remove(scrolled_win1)
pane.pack1( scrolled_win1, True, True )
pane.pack2( scrolled_win2, True, True )
container.add(pane)
if char_str == "|":
pane.set_orientation(Gtk.Orientation.VERTICAL)
elif char_str == "\\":
pane.set_orientation(Gtk.Orientation.HORIZONTAL)
pane.show_all()
source_view2.command.exec("new_file")
source_view2.grab_focus()