From cdd147f57be9fbe6669946b880d8d0c601c9c880 Mon Sep 17 00:00:00 2001 From: Till Frankenbach <81414045+merydian@users.noreply.github.com> Date: Sat, 15 Jun 2024 01:04:12 +0200 Subject: [PATCH] Add open in external editor button Works for QGIS 3.38+ --- firstaid/debugwidget.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/firstaid/debugwidget.py b/firstaid/debugwidget.py index 35c15c0..fb147af 100644 --- a/firstaid/debugwidget.py +++ b/firstaid/debugwidget.py @@ -390,6 +390,9 @@ def current_frame_changed(self, current, previous): row = current.row() if 0 <= row < len(self.entries): self.go_to_frame(row) + path = self.entries[row][0] + if self._source_editor_widget: + self._source_editor_widget.setFilePath(path) def go_to_frame(self, index): if self._source_editor_widget: @@ -439,6 +442,12 @@ def __init__(self, exc_info, parent=None): ) self.clear_history_button.clicked.connect(self.clear_console_history) + self.open_external_editor_button = QPushButton(self.tr("Open Text Editor")) + self.open_external_editor_button.setIcon( + QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg") + ) + self.open_external_editor_button.clicked.connect(self.open_in_external_editor) + self.save_output_button = QPushButton(self.tr("Copy Details")) self.save_output_button.setIcon( QIcon(":images/themes/default/mActionEditCopy.svg") @@ -447,6 +456,8 @@ def __init__(self, exc_info, parent=None): self.horz_layout.addWidget(self.clear_history_button) self.horz_layout.addWidget(self.save_output_button) + if self._source_editor_widget: + self.horz_layout.addWidget(self.open_external_editor_button) self.horz_layout.addWidget(self.button_box) layout.addLayout(self.horz_layout) @@ -458,6 +469,9 @@ def __init__(self, exc_info, parent=None): def clear_console_history(self): self.debug_widget.console.console.history = [] + def open_in_external_editor(self): + self.debug_widget._source_editor_widget.openInExternalEditor() + def save_output(self): report = { "ExceptionDetails": {