Skip to content

Commit

Permalink
Add open in external editor button
Browse files Browse the repository at this point in the history
Works for QGIS 3.38+
  • Loading branch information
merydian authored Jun 14, 2024
1 parent 309fb98 commit cdd147f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions firstaid/debugwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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": {
Expand Down

0 comments on commit cdd147f

Please sign in to comment.