Beispiel #1
0
 def _createCommand(self):
     cliname = "auto_advanced_cli.jl"
     cmd = [self.juliaCommand]
     cmd.append("--project=" + ABS_PATH_TO_ADVANCED_CLI())
     cmd.append("--threads")
     cmd.append(str(self.numOfThreads))
     cmd.append(cliname)
     if self.outputParamsDump:
         cmd.append("--output-params-dump")
         cmd.append(
             formatPath(self._getworkdir() + "\\" + self.outputParamsDump))
     if self.outputDaily:
         cmd.append("--output-daily")
         cmd.append(formatPath(self._getworkdir() + "\\" +
                               self.outputDaily))
     if self.outputSummary:
         cmd.append("--output-summary")
         cmd.append(
             formatPath(self._getworkdir() + "\\" + self.outputSummary))
     if self.outputRunDumpPrefix:
         cmd.append("--output-run-dump-prefix")
         cmd.append(
             formatPath(self._getworkdir() + "\\" +
                        self.outputRunDumpPrefix))
     cmd.append(self.openedFilePath)
     return cmd
 def outputRunDumpPrefix(self, path):
     newpath = formatPath(path, makeRelativeTo=self._getworkdir())
     if self._outputRunDumpPrefix != path:
         self._outputRunDumpPrefix = newpath
         self.__saveCliOptions()
         self.outputRunDumpPrefixChanged.emit()
         self.outputRunDumpPrefixAcceptabilityCheckReq.emit()
 def outputParamsDump(self, path):
     newpath = formatPath(path, makeRelativeTo=self._getworkdir())
     if self._outputParamsDump != path:
         self._outputParamsDump = newpath
         self.__saveCliOptions()
         self.outputParamsDumpChanged.emit()
         self.outputParamsDumpAcceptabilityCheckReq.emit()
 def outputSummary(self, path):
     newpath = formatPath(path, makeRelativeTo=self._getworkdir())
     if self._outputSummary != path:
         self._outputSummary = newpath
         self.__saveCliOptions()
         self.outputSummaryChanged.emit()
         self.outputSummaryAcceptabilityCheckReq.emit()
Beispiel #5
0
 def saveAs(self, path):
     path = formatPath(path)
     fh = open(path, "w", encoding='utf-8')
     json.dump(self._settings.serialize(), fh, indent=4, ensure_ascii=False)
     fh.close()
     self._openedFilePath = path
     self.openedNewConf.emit()
     self.setOpenedConfModified(False)
Beispiel #6
0
 def __saveConfToTempFile(self):
     fh = tempfile.NamedTemporaryFile(mode='w',
                                      encoding='utf-8',
                                      delete=False)
     json.dump(self._settings.serialize(), fh, indent=4, ensure_ascii=False)
     path = formatPath(fh.name)
     fh.close()
     return path
 def juliaCommand(self, cmd):
     if cmd != "julia":
         cmd = formatPath(cmd)
     if self._juliaCommand != cmd:
         self._juliaCommand = cmd
         self.__saveCliOptions()
         self.juliaCommandChanged.emit()
         self.juliaCommandAcceptabilityCheckReq.emit()
Beispiel #8
0
 def _createCommand(self):
     cliname = "auto_advanced_cli.jl"
     cmd = ["julia", cliname]
     if self.outputParamsDump:
         cmd.append("--output-params-dump")
         cmd.append(
             formatPath(self._getworkdir() + "\\" + self.outputParamsDump))
     if self.outputDaily:
         cmd.append("--output-daily")
         cmd.append(formatPath(self._getworkdir() + "\\" +
                               self.outputDaily))
     if self.outputSummary:
         cmd.append("--output-summary")
         cmd.append(
             formatPath(self._getworkdir() + "\\" + self.outputSummary))
     if self.outputRunDumpPrefix:
         cmd.append("--output-run-dump-prefix")
         cmd.append(
             formatPath(self._getworkdir() + "\\" +
                        self.outputRunDumpPrefix))
     cmd.append(self.openedFilePath)
     return cmd
Beispiel #9
0
 def open(self, path):
     try:
         path = formatPath(path)
         inputFileHandle = open(path, 'r', encoding='utf-8')
         data = json.loads(inputFileHandle.read())
         ConfigurationValidator.validateAgainstSchema(data)
         self._settings.populate(data)
         self.modulationFunctionChanged.emit()
         self._openedFilePath = path
         self._isOpenedConfModified = False
         self.openedNewConf.emit()
         self._applicationSettings.setAsRecentFile(path)
         self._settings.spreading.truncationAcceptabilityCheckReq.emit()
     except FileNotFoundError as error:
         self.showErrorMsg.emit(str(error))
     except json.decoder.JSONDecodeError as error:
         self.showErrorMsg.emit(
             "File: json schema is corrupted: {0}".format(str(error)))
     except ValidationError as error:
         self.showErrorMsg.emit(
             "Unable to open file at: {0} due to wrong input data: {1}".
             format(path, str(error)))
Beispiel #10
0
 def setPopulationFilePath(self, path):
     self._settings.generalSettings.populationPath = formatPath(path)
Beispiel #11
0
 def populationPath(self, path):
     path = formatPath(path)
     if self._populationPath != path:
         self._populationPath = path
         self.populationPathChanged.emit()
Beispiel #12
0
 def clean(self):
     if self.openedFilePath.find(formatPath(tempfile.gettempdir())) != -1:
         os.remove(self.openedFilePath)
 def outputRunDumpPrefixAcceptable(self):
     fullpath = formatPath(self._getworkdir() + "\\" +
                           self._outputRunDumpPrefix)
     return (self._outputRunDumpPrefix == ""
             or (os.path.dirname(fullpath) != fullpath
                 and os.access(os.path.dirname(fullpath), os.W_OK)))
 def __isPathToOutputFileJld2Correct(self, relpath):
     fullpath = formatPath(self._getworkdir() + "\\" + relpath)
     return (os.path.dirname(fullpath) != fullpath
             and relpath.endswith(".jld2")
             and os.access(os.path.dirname(fullpath), os.W_OK))