Skip to content
Permalink
Browse files

Fixed external python file path for forms

Path is now correctly converted to absolute
when read form the project.

A separate default dir is also stored in the
settings.
  • Loading branch information
elpaso committed Dec 17, 2015
1 parent 0def769 commit 9b91f92feac016cb1799cbd37b1b10139af95a22
Showing with 3 additions and 3 deletions.
  1. +2 −2 src/app/qgsfieldsproperties.cpp
  2. +1 −1 src/core/qgseditformconfig.cpp
@@ -848,14 +848,14 @@ QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget( QTr
void QgsFieldsProperties::on_pbtnSelectInitFilePath_clicked()
{
QSettings myQSettings;
QString lastUsedDir = myQSettings.value( "style/lastUIDir", "." ).toString();
QString lastUsedDir = myQSettings.value( "style/lastInitFilePathDir", "." ).toString();
QString pyfilename = QFileDialog::getOpenFileName( this, tr( "Select Python file" ), lastUsedDir, tr( "Python file" ) + " (*.py)" );

if ( pyfilename.isNull() )
return;

QFileInfo fi( pyfilename );
myQSettings.setValue( "style/lastUIDir", fi.path() );
myQSettings.setValue( "style/lastInitFilePathDir", fi.path() );
mInitFilePathLineEdit->setText( pyfilename );
}

@@ -147,7 +147,7 @@ void QgsEditFormConfig::readXml( const QDomNode& node )
QDomNode editFormInitFilePathNode = node.namedItem( "editforminitfilepath" );
if ( !editFormInitFilePathNode.isNull() || ( !editFormInitFilePathNode.isNull() && !editFormInitFilePathNode.toElement().text().isEmpty() ) )
{
setInitFilePath( editFormInitFilePathNode.toElement().text() );
setInitFilePath( QgsProject::instance()->readPath( editFormInitFilePathNode.toElement().text() ) );
}

QDomNode fFSuppNode = node.namedItem( "featformsuppress" );

0 comments on commit 9b91f92

Please sign in to comment.
You can’t perform that action at this time.