Skip to content
Permalink
Browse files
Report python errors when running python commands from qgis gui (e.g.…
… run actions, feature form init).

Try to delete feature form only if exists (#2590).


git-svn-id: http://svn.osgeo.org/qgis/trunk@13751 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jun 20, 2010
1 parent 8872fcb commit 52a49c90f39734de421a775ce80324e0d4d628c5
Showing with 7 additions and 2 deletions.
  1. +1 −1 src/app/qgisapp.cpp
  2. +2 −1 src/app/qgsattributedialog.cpp
  3. +4 −0 src/python/qgspythonutils.h
@@ -6546,7 +6546,7 @@ void QgisApp::runPythonString( const QString &expr )
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
mPythonUtils->runStringUnsafe( expr );
mPythonUtils->runString( expr );
}
}

@@ -331,7 +331,8 @@ void QgsAttributeDialog::dialogDestroyed()
mLayer->setProperty( "featureForm.dialog", QVariant() );
mLayer->setProperty( "featureForm.id", QVariant() );
#endif
QgisApp::instance()->runPythonString( QString( "del _qgis_featureform_%1" ).arg( mLayer->getLayerID() ) );
QString expr = QString( "if locals().has_key('_qgis_featureform_%1'): del _qgis_featureform_%1\n" ).arg( mLayer->getLayerID() );
QgisApp::instance()->runPythonString( expr );

mDialog = NULL;
deleteLater();
@@ -50,6 +50,10 @@ class PYTHON_EXPORT QgsPythonUtils

/* console */

//! run a statement, show an error message on error
//! @return true if no error occured
virtual bool runString( const QString& command, QString msgOnError = QString() ) = 0;

//! run a statement, error reporting is not done
//! @return true if no error occured
virtual bool runStringUnsafe( const QString& command, bool single = true ) = 0;

0 comments on commit 52a49c9

Please sign in to comment.