From d23db3e43248d40c35a9e3cf4dc40c75ac7c2719 Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Fri, 12 Jun 2026 12:37:27 -0500 Subject: [PATCH] Auto find editor --- .env.example | 6 + gui/workflow_tab.py | 237 ++++++++++++++++++++++++++++++- util/tl_inspector/TLInspector.js | 5 +- util/tl_inspector/__init__.py | 15 +- util/tl_inspector/config.py | 139 ++++++++++++++++++ util/tl_inspector/installer.py | 26 +++- 6 files changed, 421 insertions(+), 7 deletions(-) create mode 100644 util/tl_inspector/config.py diff --git a/.env.example b/.env.example index 0a83caf..a034a29 100644 --- a/.env.example +++ b/.env.example @@ -61,3 +61,9 @@ batchsize="10" # Frequency penalty - adjust according to your needs frequency_penalty= 0.2 + +# TL Inspector (Step 8 playtest) — editor opened when clicking a source line in-game +# tlEditorCmd: 'auto' scans for VS Code / Cursor, or set an absolute path to any editor exe +tlEditorCmd='auto' +# tlWorkspaceFolder: 'auto' uses the game root folder, or set a custom workspace path +tlWorkspaceFolder='auto' diff --git a/gui/workflow_tab.py b/gui/workflow_tab.py index 045de82..7237ad5 100644 --- a/gui/workflow_tab.py +++ b/gui/workflow_tab.py @@ -29,6 +29,7 @@ from PyQt5.QtGui import QFont from PyQt5.QtWidgets import ( QApplication, QCheckBox, + QComboBox, QFileDialog, QFrame, QGridLayout, @@ -719,6 +720,7 @@ class WorkflowTab(QWidget): self._populate_p2_checkboxes() if index == 8: self._refresh_tl_inspector_status() + self._load_tli_editor_settings() def _register_import_button(self, button: QPushButton) -> None: self._import_buttons.append(button) @@ -2435,6 +2437,87 @@ class WorkflowTab(QWidget): self._tli_status_label.setStyleSheet("color:#7a7a7a;font-size:13px;") inner.addWidget(self._tli_status_label) + editor_title = QLabel("Editor settings") + editor_title.setStyleSheet("color:#4ec9b0;font-size:12px;font-weight:bold;padding-top:4px;") + inner.addWidget(editor_title) + + editor_row = QHBoxLayout() + editor_row.setSpacing(6) + editor_lbl = QLabel("Editor:") + editor_lbl.setFixedWidth(72) + editor_lbl.setStyleSheet("color:#9d9d9d;font-size:12px;") + editor_row.addWidget(editor_lbl) + self._tli_editor_combo = QComboBox() + self._tli_editor_combo.setMinimumWidth(280) + self._tli_editor_combo.currentIndexChanged.connect(self._on_tli_editor_combo_changed) + editor_row.addWidget(self._tli_editor_combo, 1) + detect_btn = _make_btn("Detect", "#4a4a4a") + detect_btn.setFixedWidth(72) + detect_btn.setToolTip("Scan this PC for VS Code, Insiders, or Cursor") + detect_btn.clicked.connect(self._detect_tli_editors) + editor_row.addWidget(detect_btn) + inner.addLayout(editor_row) + + custom_row = QHBoxLayout() + custom_row.setSpacing(6) + custom_row.addSpacing(72) + self._tli_editor_custom = QLineEdit() + self._tli_editor_custom.setPlaceholderText("Path to editor executable (when Custom is selected)") + self._tli_editor_custom.setEnabled(False) + custom_row.addWidget(self._tli_editor_custom, 1) + browse_editor_btn = _make_btn("Browse…", "#4a4a4a") + browse_editor_btn.setFixedWidth(88) + browse_editor_btn.clicked.connect(self._browse_tli_editor) + custom_row.addWidget(browse_editor_btn) + inner.addLayout(custom_row) + + self._tli_detect_label = QLabel("") + self._tli_detect_label.setWordWrap(True) + self._tli_detect_label.setStyleSheet("color:#6a6a6a;font-size:11px;padding-left:72px;") + inner.addWidget(self._tli_detect_label) + + ws_row = QHBoxLayout() + ws_row.setSpacing(6) + ws_lbl = QLabel("Workspace:") + ws_lbl.setFixedWidth(72) + ws_lbl.setStyleSheet("color:#9d9d9d;font-size:12px;") + ws_row.addWidget(ws_lbl) + self._tli_workspace_auto = QCheckBox("Use game folder (auto)") + self._tli_workspace_auto.setChecked(True) + self._tli_workspace_auto.setStyleSheet("color:#cccccc;font-size:12px;") + self._tli_workspace_auto.toggled.connect(self._on_tli_workspace_auto_toggled) + ws_row.addWidget(self._tli_workspace_auto) + ws_row.addStretch() + inner.addLayout(ws_row) + + ws_custom_row = QHBoxLayout() + ws_custom_row.setSpacing(6) + ws_custom_row.addSpacing(72) + self._tli_workspace_edit = QLineEdit() + self._tli_workspace_edit.setPlaceholderText("Custom VS Code / Cursor workspace folder") + self._tli_workspace_edit.setEnabled(False) + ws_custom_row.addWidget(self._tli_workspace_edit, 1) + browse_ws_btn = _make_btn("Browse…", "#4a4a4a") + browse_ws_btn.setFixedWidth(88) + browse_ws_btn.clicked.connect(self._browse_tli_workspace) + ws_custom_row.addWidget(browse_ws_btn) + inner.addLayout(ws_custom_row) + + cfg_btn_row = QHBoxLayout() + cfg_btn_row.setSpacing(8) + save_tli_btn = _make_btn("✔ Save settings", "#3a5a7a") + save_tli_btn.setFixedWidth(140) + save_tli_btn.setToolTip("Write editor settings to .env (used on Install / Apply)") + save_tli_btn.clicked.connect(self._save_tli_editor_settings) + cfg_btn_row.addWidget(save_tli_btn) + apply_tli_btn = _make_btn("↻ Apply to game", "#3a5a7a") + apply_tli_btn.setFixedWidth(140) + apply_tli_btn.setToolTip("Update the installed TLInspector.js in your game folder") + apply_tli_btn.clicked.connect(self._apply_tli_editor_settings) + cfg_btn_row.addWidget(apply_tli_btn) + cfg_btn_row.addStretch() + inner.addLayout(cfg_btn_row) + tips = QLabel( "