Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[GRASS] fixed overwrite existing output
  • Loading branch information
blazek committed Oct 20, 2015
1 parent 2d159f3 commit 07fae8f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -630,13 +630,15 @@ void QgsGrassModule::run()
if ( ret == QMessageBox::Cancel )
return;

// r.mapcalc does not use standard parser
if ( typeid( *mOptions ) != typeid( QgsGrassMapcalc ) )
#if GRASS_VERSION_MAJOR < 7
// r.mapcalc does not use standard parser (does not accept --o) in GRASS 6
if ( mXName != "r.mapcalc" )
{
arguments.append( "--o" );
//mProcess.addArgument( "--o" );
//command.append ( " --o" );
}
#else
arguments.append( "--o" );
#endif
}
}

Expand All @@ -649,6 +651,7 @@ void QgsGrassModule::run()
mViewButton->setEnabled( false );

QStringList list = mOptions->arguments();
list << arguments;

QStringList argumentsHtml;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/grass/qgsgrassmoduleinput.cpp
Expand Up @@ -119,7 +119,9 @@ void QgsGrassModuleInputModel::onDirectoryChanged( const QString & path )
watch( path + "/" + watchedDir );
}
// TODO: use db path defined in mapset VAR
#if GRASS_VERSION_MAJOR >= 7
watch( path + "/tgis/sqlite.db" );
#endif
}
else // cellhd or vector dir
{
Expand Down Expand Up @@ -209,7 +211,9 @@ void QgsGrassModuleInputModel::refreshMapset( QStandardItem *mapsetItem, const Q
if ( types.isEmpty() )
{
types << QgsGrassObject::Raster << QgsGrassObject::Vector;
#if GRASS_VERSION_MAJOR >= 7
types << QgsGrassObject::Strds << QgsGrassObject::Stvds << QgsGrassObject::Str3ds;
#endif
}
Q_FOREACH ( QgsGrassObject::Type type, types )
{
Expand Down Expand Up @@ -304,7 +308,9 @@ void QgsGrassModuleInputModel::reload()
{
watch( dirPath + "/" + watchedDir );
}
#if GRASS_VERSION_MAJOR >= 7
watch( dirPath + "/tgis/sqlite.db" );
#endif
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/plugins/grass/qgsgrasstools.cpp
Expand Up @@ -274,7 +274,7 @@ void QgsGrassTools::runModule( QString name, bool direct )
#ifdef Q_OS_WIN
QgsGrass::putEnv( "GRASS_HTML_BROWSER", QgsGrassUtils::htmlBrowserPath() );
QStringList env;
QByteArray origPath = qgetenv( "PATH" );
QByteArray origPath = qgetenv( "PATH" );
QByteArray origPythonPath = qgetenv( "PYTHONPATH" );
QString path = QString( origPath ) + QgsGrass::pathSeparator() + QgsGrass::grassModulesPaths().join( QgsGrass::pathSeparator() );
QString pythonPath = QString( origPythonPath ) + QgsGrass::pathSeparator() + QgsGrass::getPythonPath();
Expand Down Expand Up @@ -303,7 +303,10 @@ void QgsGrassTools::runModule( QString name, bool direct )
}
else
{
// set wait cursor because starting module may be slow because of getting temporal datasets (t.list)
QApplication::setOverrideCursor( Qt::WaitCursor );
QgsGrassModule *gmod = new QgsGrassModule( this, name, mIface, direct, mTabWidget );
QApplication::restoreOverrideCursor();
if ( !gmod->errors().isEmpty() )
{
QgsGrass::warning( gmod->errors().join( "\n" ) );
Expand Down Expand Up @@ -332,7 +335,6 @@ void QgsGrassTools::runModule( QString name, bool direct )

// We must call resize to reset COLUMNS environment variable
// used by bash !!!

#if 0
/* TODO: Implement something that resizes the terminal without
* crashes.
Expand Down
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -1486,6 +1486,7 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
}
else if ( type == QgsGrassObject::Strds || type == QgsGrassObject::Stvds || type == QgsGrassObject::Str3ds )
{
#if GRASS_VERSION_MAJOR >= 7
QString cmd = gisbase() + "/scripts/t.list";
QStringList arguments;

Expand Down Expand Up @@ -1515,6 +1516,7 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
}
}
}
#endif
}
else
{
Expand Down

0 comments on commit 07fae8f

Please sign in to comment.