Skip to content

Commit 07fae8f

Browse files
committedOct 20, 2015
[GRASS] fixed overwrite existing output
1 parent 2d159f3 commit 07fae8f

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed
 

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,15 @@ void QgsGrassModule::run()
630630
if ( ret == QMessageBox::Cancel )
631631
return;
632632

633-
// r.mapcalc does not use standard parser
634-
if ( typeid( *mOptions ) != typeid( QgsGrassMapcalc ) )
633+
#if GRASS_VERSION_MAJOR < 7
634+
// r.mapcalc does not use standard parser (does not accept --o) in GRASS 6
635+
if ( mXName != "r.mapcalc" )
635636
{
636637
arguments.append( "--o" );
637-
//mProcess.addArgument( "--o" );
638-
//command.append ( " --o" );
639638
}
639+
#else
640+
arguments.append( "--o" );
641+
#endif
640642
}
641643
}
642644

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

651653
QStringList list = mOptions->arguments();
654+
list << arguments;
652655

653656
QStringList argumentsHtml;
654657
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )

‎src/plugins/grass/qgsgrassmoduleinput.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ void QgsGrassModuleInputModel::onDirectoryChanged( const QString & path )
119119
watch( path + "/" + watchedDir );
120120
}
121121
// TODO: use db path defined in mapset VAR
122+
#if GRASS_VERSION_MAJOR >= 7
122123
watch( path + "/tgis/sqlite.db" );
124+
#endif
123125
}
124126
else // cellhd or vector dir
125127
{
@@ -209,7 +211,9 @@ void QgsGrassModuleInputModel::refreshMapset( QStandardItem *mapsetItem, const Q
209211
if ( types.isEmpty() )
210212
{
211213
types << QgsGrassObject::Raster << QgsGrassObject::Vector;
214+
#if GRASS_VERSION_MAJOR >= 7
212215
types << QgsGrassObject::Strds << QgsGrassObject::Stvds << QgsGrassObject::Str3ds;
216+
#endif
213217
}
214218
Q_FOREACH ( QgsGrassObject::Type type, types )
215219
{
@@ -304,7 +308,9 @@ void QgsGrassModuleInputModel::reload()
304308
{
305309
watch( dirPath + "/" + watchedDir );
306310
}
311+
#if GRASS_VERSION_MAJOR >= 7
307312
watch( dirPath + "/tgis/sqlite.db" );
313+
#endif
308314
}
309315
}
310316

‎src/plugins/grass/qgsgrasstools.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void QgsGrassTools::runModule( QString name, bool direct )
274274
#ifdef Q_OS_WIN
275275
QgsGrass::putEnv( "GRASS_HTML_BROWSER", QgsGrassUtils::htmlBrowserPath() );
276276
QStringList env;
277-
QByteArray origPath = qgetenv( "PATH" );
277+
QByteArray origPath = qgetenv( "PATH" );
278278
QByteArray origPythonPath = qgetenv( "PYTHONPATH" );
279279
QString path = QString( origPath ) + QgsGrass::pathSeparator() + QgsGrass::grassModulesPaths().join( QgsGrass::pathSeparator() );
280280
QString pythonPath = QString( origPythonPath ) + QgsGrass::pathSeparator() + QgsGrass::getPythonPath();
@@ -303,7 +303,10 @@ void QgsGrassTools::runModule( QString name, bool direct )
303303
}
304304
else
305305
{
306+
// set wait cursor because starting module may be slow because of getting temporal datasets (t.list)
307+
QApplication::setOverrideCursor( Qt::WaitCursor );
306308
QgsGrassModule *gmod = new QgsGrassModule( this, name, mIface, direct, mTabWidget );
309+
QApplication::restoreOverrideCursor();
307310
if ( !gmod->errors().isEmpty() )
308311
{
309312
QgsGrass::warning( gmod->errors().join( "\n" ) );
@@ -332,7 +335,6 @@ void QgsGrassTools::runModule( QString name, bool direct )
332335

333336
// We must call resize to reset COLUMNS environment variable
334337
// used by bash !!!
335-
336338
#if 0
337339
/* TODO: Implement something that resizes the terminal without
338340
* crashes.

‎src/providers/grass/qgsgrass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
14861486
}
14871487
else if ( type == QgsGrassObject::Strds || type == QgsGrassObject::Stvds || type == QgsGrassObject::Str3ds )
14881488
{
1489+
#if GRASS_VERSION_MAJOR >= 7
14891490
QString cmd = gisbase() + "/scripts/t.list";
14901491
QStringList arguments;
14911492

@@ -1515,6 +1516,7 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
15151516
}
15161517
}
15171518
}
1519+
#endif
15181520
}
15191521
else
15201522
{

0 commit comments

Comments
 (0)
Please sign in to comment.