Skip to content

Commit

Permalink
Add an 'Open in external editor' option for python scripts in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 20, 2017
1 parent 274a902 commit d6bf317
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/qgsappbrowserproviders.cpp
Expand Up @@ -15,6 +15,7 @@

#include "qgsappbrowserproviders.h"
#include "qgisapp.h"
#include <QDesktopServices>

//
// QgsQlrDataItem
Expand Down Expand Up @@ -208,12 +209,17 @@ bool QgsPyDataItem::handleDoubleClick()

QList<QAction *> QgsPyDataItem::actions()
{
QAction *runScript = new QAction( tr( "Run Script" ), this );
QAction *runScript = new QAction( tr( "&Run Script" ), this );
connect( runScript, &QAction::triggered, this, [ = ]
{
QgisApp::instance()->runScript( path() );
} );
return QList<QAction *>() << runScript ;
QAction *editScript = new QAction( tr( "Open in External &Editor" ), this );
connect( editScript, &QAction::triggered, this, [ = ]
{
QDesktopServices::openUrl( QUrl::fromLocalFile( path() ) );
} );
return QList<QAction *>() << runScript << editScript;
}

//
Expand Down

0 comments on commit d6bf317

Please sign in to comment.