Skip to content

Commit

Permalink
Fixed external python file path for forms
Browse files Browse the repository at this point in the history
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 9b91f92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgseditformconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down

0 comments on commit 9b91f92

Please sign in to comment.