[processing] fixed add model from file

fixes #12902
This commit is contained in:
volaya 2015-06-22 10:12:02 +02:00
parent 5013bb5600
commit b6975d6121

View File

@ -55,7 +55,7 @@ class AddModelFromFileAction(ToolboxAction):
if filename:
try:
settings.setValue('Processing/lastModelsDir',
QFileInfo(fileName).absoluteDir().absolutePath())
QFileInfo(filename).absoluteDir().absolutePath())
ModelerAlgorithm.fromFile(filename)
except WrongModelException:
@ -68,6 +68,7 @@ class AddModelFromFileAction(ToolboxAction):
QMessageBox.warning(self.toolbox,
self.tr('Error reading model', 'AddModelFromFileAction'),
self.tr('Cannot read file', 'AddModelFromFileAction'))
return
destFilename = os.path.join(ModelerUtils.modelsFolder(), os.path.basename(filename))
shutil.copyfile(filename,destFilename)
self.toolbox.updateProvider('model')