Skip to content
Permalink
Browse files
Also show "Copy as Python" action in right click menu
  • Loading branch information
nyalldawson committed Dec 21, 2021
1 parent 3714e25 commit 940270e91f8103393720cab569caa5df25dc5bb2
Showing with 9 additions and 1 deletion.
  1. +9 −1 python/plugins/processing/gui/HistoryDialog.py
@@ -229,6 +229,14 @@ def showPopupMenu(self, point):
if isinstance(item, TreeLogEntryItem):
popupmenu = QMenu()

python_command = item.as_python_command()
if python_command:
python_action = QAction(
QCoreApplication.translate('HistoryDialog', 'Copy as Python Command'), self.tree)
python_action.setIcon(QgsApplication.getThemeIcon("mIconPythonFile.svg"))
python_action.triggered.connect(partial(self.copy_text, python_command))
popupmenu.addAction(python_action)

qgis_process_command = item.as_qgis_process_command()
if qgis_process_command:
qgis_process_action = QAction(
@@ -248,7 +256,7 @@ def showPopupMenu(self, point):
if not popupmenu.isEmpty():
popupmenu.addSeparator()

if item.as_python_command():
if python_command:
create_test_action = QAction(QCoreApplication.translate('HistoryDialog', 'Create Test…'), self.tree)
create_test_action.triggered.connect(self.createTest)
popupmenu.addAction(create_test_action)

0 comments on commit 940270e

Please sign in to comment.