Skip to content

Commit d6bf317

Browse files
committedSep 20, 2017
Add an 'Open in external editor' option for python scripts in browser
1 parent 274a902 commit d6bf317

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/app/qgsappbrowserproviders.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "qgsappbrowserproviders.h"
1717
#include "qgisapp.h"
18+
#include <QDesktopServices>
1819

1920
//
2021
// QgsQlrDataItem
@@ -208,12 +209,17 @@ bool QgsPyDataItem::handleDoubleClick()
208209

209210
QList<QAction *> QgsPyDataItem::actions()
210211
{
211-
QAction *runScript = new QAction( tr( "Run Script" ), this );
212+
QAction *runScript = new QAction( tr( "&Run Script" ), this );
212213
connect( runScript, &QAction::triggered, this, [ = ]
213214
{
214215
QgisApp::instance()->runScript( path() );
215216
} );
216-
return QList<QAction *>() << runScript ;
217+
QAction *editScript = new QAction( tr( "Open in External &Editor" ), this );
218+
connect( editScript, &QAction::triggered, this, [ = ]
219+
{
220+
QDesktopServices::openUrl( QUrl::fromLocalFile( path() ) );
221+
} );
222+
return QList<QAction *>() << runScript << editScript;
217223
}
218224

219225
//

0 commit comments

Comments
 (0)
Please sign in to comment.