Skip to content
Permalink
Browse files
fix python feature form identifier in case of non-ascii layer ids
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13842 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 29, 2010
1 parent 86451ba commit 6a0dfecd50757ce0776b5d351ffd6d57b6d886fb
Showing with 14 additions and 5 deletions.
  1. +11 −4 src/app/qgsattributedialog.cpp
  2. +2 −0 src/app/qgsattributedialog.h
  3. +1 −1 src/python/qgspythonutilsimpl.cpp
@@ -42,12 +42,15 @@
#include <QVBoxLayout>
#include <QLineEdit>

int QgsAttributeDialog::smFormCounter = 0;

QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature )
: mDialog( 0 )
, mSettingsPath( "/Windows/AttributeDialog/" )
, mLayer( vl )
, mpFeature( thepFeature )
, mRubberBand( 0 )
, mFormNr( -1 )
{
if ( mpFeature == NULL || vl->dataProvider() == NULL )
return;
@@ -227,9 +230,10 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
QgisApp::instance()->runPythonString( QString( "import %1" ).arg( module.left( pos ) ) );
}

QgisApp::instance()->runPythonString( QString( "_qgis_featureform_%1 = wrapinstance( %2, QtGui.QDialog )" ).arg( mLayer->getLayerID() ).arg(( unsigned long ) mDialog ) );
mFormNr = smFormCounter++;
QgisApp::instance()->runPythonString( QString( "_qgis_featureform_%1 = wrapinstance( %2, QtGui.QDialog )" ).arg( mFormNr ).arg(( unsigned long ) mDialog ) );

QString expr = QString( "%1(_qgis_featureform_%2,'%2',%3)" ).arg( vl->editFormInit() ).arg( vl->getLayerID() ).arg( mpFeature->id() );
QString expr = QString( "%1(_qgis_featureform_%2,'%3',%4)" ).arg( vl->editFormInit() ).arg( mFormNr ).arg( vl->getLayerID() ).arg( mpFeature->id() );
QgsDebugMsg( QString( "running featureForm init: %1" ).arg( expr ) );
QgisApp::instance()->runPythonString( expr );
}
@@ -331,8 +335,11 @@ void QgsAttributeDialog::dialogDestroyed()
mLayer->setProperty( "featureForm.dialog", QVariant() );
mLayer->setProperty( "featureForm.id", QVariant() );
#endif
QString expr = QString( "if locals().has_key('_qgis_featureform_%1'): del _qgis_featureform_%1\n" ).arg( mLayer->getLayerID() );
QgisApp::instance()->runPythonString( expr );
if ( -1 < mFormNr )
{
QString expr = QString( "if locals().has_key('_qgis_featureform_%1'): del _qgis_featureform_%1\n" ).arg( mFormNr );
QgisApp::instance()->runPythonString( expr );
}

mDialog = NULL;
deleteLater();
@@ -68,6 +68,8 @@ class QgsAttributeDialog : public QObject
QgsVectorLayer *mLayer;
QgsFeature *mpFeature;
QgsRubberBand *mRubberBand;
int mFormNr;
static int smFormCounter;
};

#endif
@@ -161,7 +161,7 @@ bool QgsPythonUtilsImpl::runString( const QString& command, QString msgOnError )
evalString( "str(sys.path)", path );
evalString( "sys.version", version );

QString str = "<font color=\"red\">" + msgOnError + "</font><br><br>" + traceback + "<br>"
QString str = "<font color=\"red\">" + msgOnError + "</font><br><pre>\n" + traceback + "\n</pre>"
+ QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>"
+ QObject::tr( "QGIS version:" ) + "<br>" + QString( "%1 '%2', %3" ).arg( QGis::QGIS_VERSION ).arg( QGis::QGIS_RELEASE_NAME ).arg( QGis::QGIS_SVN_VERSION ) + "<br><br>"
+ QObject::tr( "Python path:" ) + "<br>" + path;

0 comments on commit 6a0dfec

Please sign in to comment.