Navigation Menu

Skip to content

Commit

Permalink
[processing] Report provider version string alongside QGIS version in…
Browse files Browse the repository at this point in the history
… log

Helpful for debugging and reproducability of results
  • Loading branch information
nyalldawson committed Apr 8, 2019
1 parent 708bf44 commit 933559b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Expand Up @@ -9,6 +9,7 @@




class QgsProcessingFeedback : QgsFeedback
{
%Docstring
Expand Down Expand Up @@ -92,7 +93,7 @@ report the output from executing an external command or subprocess.
.. seealso:: :py:func:`pushCommandInfo`
%End

void pushVersionInfo();
void pushVersionInfo( const QgsProcessingProvider *provider = 0 );
%Docstring
Pushes a summary of the QGIS (and underlying library) version information to the log.

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -205,7 +205,7 @@ def runAlgorithm(self):
break

self.clearProgress()
self.feedback.pushVersionInfo()
self.feedback.pushVersionInfo(self.algorithm().provider())
self.setProgressText(QCoreApplication.translate('AlgorithmDialog', 'Processing algorithm…'))

self.setInfo(
Expand Down
7 changes: 6 additions & 1 deletion src/core/processing/qgsprocessingfeedback.cpp
Expand Up @@ -17,6 +17,7 @@

#include "qgsprocessingfeedback.h"
#include "qgsgeos.h"
#include "qgsprocessingprovider.h"
#include <ogr_api.h>
#include <gdal_version.h>
#if PROJ_VERSION_MAJOR > 4
Expand Down Expand Up @@ -54,7 +55,7 @@ void QgsProcessingFeedback::pushConsoleInfo( const QString &info )
QgsMessageLog::logMessage( info, tr( "Processing" ), Qgis::Info );
}

void QgsProcessingFeedback::pushVersionInfo()
void QgsProcessingFeedback::pushVersionInfo( const QgsProcessingProvider *provider )
{
pushDebugInfo( tr( "QGIS version: %1" ).arg( Qgis::QGIS_VERSION ) );
if ( QString( Qgis::QGIS_DEV_VERSION ) != QLatin1String( "exported" ) )
Expand All @@ -71,6 +72,10 @@ void QgsProcessingFeedback::pushVersionInfo()
#else
pushDebugInfo( tr( "PROJ version: %1" ).arg( PJ_VERSION ) );
#endif
if ( provider && !provider->versionInfo().isEmpty() )
{
pushDebugInfo( tr( "%1 version: %2" ).arg( provider->name(), provider->versionInfo() ) );
}
}


Expand Down
4 changes: 3 additions & 1 deletion src/core/processing/qgsprocessingfeedback.h
Expand Up @@ -22,6 +22,8 @@
#include "qgsfeedback.h"
#include "qgsmessagelog.h"

class QgsProcessingProvider;

/**
* \class QgsProcessingFeedback
* \ingroup core
Expand Down Expand Up @@ -95,7 +97,7 @@ class CORE_EXPORT QgsProcessingFeedback : public QgsFeedback
* Pushes a summary of the QGIS (and underlying library) version information to the log.
* \since QGIS 3.4.7
*/
void pushVersionInfo();
void pushVersionInfo( const QgsProcessingProvider *provider = nullptr );

};

Expand Down

0 comments on commit 933559b

Please sign in to comment.