[GRASS] disabled wrong GISBASE warning on startup

This commit is contained in:
Radim Blazek 2015-09-14 09:48:22 +02:00
parent ddb80ebd8a
commit 0be74e5fd9
2 changed files with 95 additions and 84 deletions

View File

@ -413,7 +413,9 @@ bool QgsGrass::init( void )
}
bool userGisbase = false;
bool valid = false;
bool valid = isValidGrassBaseDir( gisBase );
// TODO add GISBASE selection to options dialog
#if 0
while ( !( valid = isValidGrassBaseDir( gisBase ) ) )
{
@ -446,14 +448,21 @@ bool QgsGrass::init( void )
gisBase = shortPath( gisBase );
#endif
}
#endif
if ( !valid )
{
// warn user
QMessageBox::information( 0, QObject::tr( "GRASS plugin" ),
QObject::tr( "GRASS data won't be available if GISBASE is not specified." ) );
nonInitializable = true;
error_message = tr( "GRASS was not found in '%1'(GISBASE), provider and plugin will not work." ).arg( gisBase );
QgsDebugMsg( error_message );
#if 0
// TODO: how to emit message from provider (which does not know about QgisApp)
QgisApp::instance()->messageBar()->pushMessage( tr( "GRASS error" ),
error_message, QgsMessageBar: WARNING );
#endif
}
else
{
if ( userGisbase )
{
settings.setValue( "/GRASS/gisbase", gisBase );
@ -539,10 +548,11 @@ bool QgsGrass::init( void )
putEnv( "GRASS_PAGER", pager );
}
}
}
initialized = 1;
unlock();
return true;
return valid;
}
/*

View File

@ -94,6 +94,7 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
mValid = false;
if ( !QgsGrass::init() )
{
appendError( QgsGrass::errorMessage() );
return;
}