Added code load start files command; improved show logic for code widget

This commit is contained in:
2025-12-24 16:38:06 -06:00
parent 4c179974c0
commit a075a79572
5 changed files with 55 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ class EditorsContainer(Gtk.Box):
self._subscribe_to_events()
self._load_widgets()
self.show()
self.show_all()
def _setup_styling(self):

View File

@@ -20,8 +20,6 @@ class PanedEditorsContainer(Gtk.Paned):
self._subscribe_to_events()
self._load_widgets()
self.show()
def _setup_styling(self):
self.ctx = self.get_style_context()
@@ -53,9 +51,6 @@ class PanedEditorsContainer(Gtk.Paned):
self.add1(scrolled_win1)
self.add2(scrolled_win2)
scrolled_win1.show_all()
scrolled_win2.show_all()
def _init_map(self, view):
def _first_show_init():
self.disconnect(self.map_id)
@@ -65,8 +60,7 @@ class PanedEditorsContainer(Gtk.Paned):
return False
# GLib.timeout_add(1000, _first_show_init)
GLib.idle_add(_first_show_init)
GLib.timeout_add(200, _first_show_init)
def _handle_first_show(self):
self.set_position(

View File

@@ -0,0 +1,42 @@
# Python imports
# Lib imports
import gi
gi.require_version('GtkSource', '4')
from gi.repository import GtkSource
from gi.repository import Gio
# Application imports
from ..source_file import SourceFile
def execute(
editor: GtkSource.View,
):
logger.debug("Load Start File(s) Command")
starting_files = settings_manager.get_starting_files()
if len(starting_files) == 0: return
file = starting_files.pop()
file = file.replace("FILE|", "")
gfile = Gio.File.new_for_path(file)
buffer = editor.get_buffer()
file = editor.files.get_file(buffer)
editor.command.exec_with_args(
"load_file",
(editor, gfile, file)
)
if len(starting_files) == 0: return
for file in starting_files:
file = file.replace("FILE|", "")
gfile = Gio.File.new_for_path(file)
editor.command.exec_with_args("load_file", (editor, gfile))

View File

@@ -19,8 +19,6 @@ class MiniViewWidget(Map):
self._subscribe_to_events()
self._load_widgets()
self.show_all()
def _setup_styling(self):
self.set_hexpand(False)

View File

@@ -71,15 +71,10 @@ class SourceView(SourceViewEventsMixin, SourceViewDnDMixin, GtkSource.View):
self._set_up_dnd()
def _init_map(self, view):
def _init_first_show():
self.disconnect(self.map_id)
del self.map_id
self._init_show()
return False
GLib.idle_add(_init_first_show)
GLib.idle_add(self._init_show)
def _init_show(self):
self.language_manager = GtkSource.LanguageManager()
@@ -98,12 +93,13 @@ class SourceView(SourceViewEventsMixin, SourceViewDnDMixin, GtkSource.View):
f"{settings_manager.settings.theming.syntax_theme}"
)
def _inner_init():
self.connect("focus-in-event", self._focus_in_event)
self.command.exec("new_file")
if self.sibling_right:
self.command.exec("new_file")
if not self.sibling_right: return
self.grab_focus()
self._focus_in_event(None, None)
self.command.exec("load_start_files")
GLib.idle_add(_inner_init)
return False