Skip to content

Commit

Permalink
fixed 6048 and 5952
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@314 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Jul 26, 2012
1 parent 7a5ca2d commit 3334068
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/sextante/core/GeoAlgorithm.py
Expand Up @@ -246,7 +246,7 @@ def getOutputValue(self, name):

def getAsCommand(self):
'''Returns the command that would run this same algorithm from the console.
Should return null if the algorithm can be run from the console.'''
Should return null if the algorithm cannot be run from the console.'''
s="Sextante.runalg(\"" + self.commandLineName() + "\","
for param in self.parameters:
s+=param.getValueAsCommandLineParameter() + ","
Expand Down
5 changes: 3 additions & 2 deletions src/sextante/core/Sextante.py
Expand Up @@ -292,15 +292,15 @@ def runAlgorithm(algOrName, onFinish, *args):
except:
print ("Unable to execute algorithm\n" + msg)
return

SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())

QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS) and onFinish:
algEx = AlgorithmExecutor(alg)
progress = QProgressDialog()
progress.setWindowTitle(alg.name)
progress.setLabelText("Executing %s..." % alg.name)
progress.setLabelText("Executing %s..." % alg.name)
def finish():
QApplication.restoreOverrideCursor()
onFinish(alg)
Expand All @@ -325,6 +325,7 @@ def cancel():
UnthreadedAlgorithmExecutor.runalg(alg, SilentProgress())
if onFinish:
onFinish(alg)
QApplication.restoreOverrideCursor()
return alg

@staticmethod
Expand Down
14 changes: 8 additions & 6 deletions src/sextante/core/SextanteLog.py
Expand Up @@ -28,25 +28,26 @@ def logFilename():

@staticmethod
def addToLog(msgtype, msg):
try: #it seems that this fails sometimes depending on the msg added:
#try: #it seems that this fails sometimes depending on the msg added:
#To avoid it stopping the normal functioning of the algorithm,
#we catch all errors, assuming that is better to miss some log info
#that breaking the algorithm.
if isinstance(msg, list):
a = "|".join(m.strip("\n") for m in msg)
text = unicode(a)
text = a
else:
text = unicode(msg).replace("\n", "|")
text = msg.replace("\n", "|")
line = msgtype + "|" + datetime.datetime.now().strftime("%a %b %d %Y %H:%M:%S") + "|" + text + "\n"
logfile = codecs.open(SextanteLog.logFilename(), "a", encoding='utf-8')
logfile = open(SextanteLog.logFilename(), "a")
#logfile = codecs.open(SextanteLog.logFilename(), "a", encoding='utf-8')
logfile.write(line)
logfile.close()
if msgtype==SextanteLog.LOG_ALGORITHM:
algname = text[len("Sextante.runalg(\""):]
algname = algname[:algname.index("\"")]
if algname not in SextanteLog.recentAlgs:
SextanteLog.recentAlgs.append(algname)
except:
#except:
pass


Expand All @@ -57,7 +58,8 @@ def getLogEntries():
algorithms=[]
warnings=[]
info=[]
lines = codecs.open(SextanteLog.logFilename(), encoding='utf-8')
#lines = codecs.open(SextanteLog.logFilename(), encoding='utf-8')
lines = open(SextanteLog.logFilename())
line = lines.readline()
while line != "":
line = line.strip("\n").strip()
Expand Down
5 changes: 2 additions & 3 deletions src/sextante/grass/description/v.random.txt
Expand Up @@ -4,8 +4,7 @@ Vector (v.*)
ParameterNumber|n|Number of points to be created|None|None|100
ParameterNumber|zmin|Minimum z height for 3D output|None|None|0.0
ParameterNumber|zmax|Maximum z height for 3D output|None|None|0.0
ParameterTableField|column|Column for Z values|z
ParameterBoolean|-z|Create 3D output|False
ParameterBoolean|-d|Use drand48() function instead of rand()|False
ParameterString|column|Column for Z values|z
*ParameterBoolean|-d|Use drand48() function instead of rand()|False
OutputVector|output|Name for output vector map

0 comments on commit 3334068

Please sign in to comment.