Ejemplo n.º 1
0
 def addToLog(msg):
     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 than breaking the algorithm.
         line = 'ALGORITHM' + LOG_SEPARATOR + datetime.datetime.now().strftime(
             ProcessingLog.DATE_FORMAT) + LOG_SEPARATOR \
             + msg + '\n'
         with codecs.open(ProcessingLog.logFilename(),
                          'a',
                          encoding='utf-8') as logfile:
             logfile.write(line)
         algname = msg[len('processing.run("'):]
         algname = algname[:algname.index('"')]
         if algname not in ProcessingLog.recentAlgs:
             ProcessingLog.recentAlgs.append(algname)
             recentAlgsString = ';'.join(ProcessingLog.recentAlgs[-6:])
             ProcessingConfig.setSettingValue(
                 ProcessingConfig.RECENT_ALGORITHMS, recentAlgsString)
     except:
         pass
 def setActive(self, active):
     ProcessingConfig.setSettingValue('ACTIVATE_GRASS7', active)
Ejemplo n.º 3
0
 def setActive(self, active):
     ProcessingConfig.setSettingValue('ACTIVATE_EXAMPLE', active)