mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-29 00:13:53 -05:00
Remove exception which is never raised
This commit is contained in:
parent
9ba699ee1c
commit
0fff9338bb
@ -29,7 +29,6 @@ from qgis.PyQt.QtCore import QFileInfo, QCoreApplication
|
||||
from qgis.core import QgsApplication, QgsSettings, QgsProcessingModelAlgorithm
|
||||
|
||||
from processing.gui.ToolboxAction import ToolboxAction
|
||||
from processing.modeler.exceptions import WrongModelException
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -23,15 +23,11 @@ __copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
import os
|
||||
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
|
||||
from qgis.core import (Qgis,
|
||||
QgsApplication,
|
||||
QgsProcessingProvider,
|
||||
QgsMessageLog,
|
||||
QgsProcessingModelAlgorithm,
|
||||
QgsProcessingUtils,
|
||||
QgsXmlUtils)
|
||||
QgsProcessingModelAlgorithm)
|
||||
|
||||
from processing.core.ProcessingConfig import ProcessingConfig, Setting
|
||||
|
||||
@ -45,7 +41,6 @@ from processing.modeler.DeleteModelAction import DeleteModelAction
|
||||
from processing.modeler.EditModelAction import EditModelAction
|
||||
from processing.modeler.ExportModelAsPythonScriptAction import ExportModelAsPythonScriptAction
|
||||
from processing.modeler.OpenModelFromFileAction import OpenModelFromFileAction
|
||||
from processing.modeler.exceptions import WrongModelException
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
@ -120,17 +115,14 @@ class ModelerAlgorithmProvider(QgsProcessingProvider):
|
||||
for path, subdirs, files in os.walk(folder):
|
||||
for descriptionFile in files:
|
||||
if descriptionFile.endswith('model3'):
|
||||
try:
|
||||
fullpath = os.path.join(path, descriptionFile)
|
||||
fullpath = os.path.join(path, descriptionFile)
|
||||
|
||||
alg = QgsProcessingModelAlgorithm()
|
||||
if alg.fromFile(fullpath):
|
||||
if alg.name():
|
||||
alg.setSourceFilePath(fullpath)
|
||||
self.algs.append(alg)
|
||||
else:
|
||||
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
|
||||
self.tr('Processing'), Qgis.Critical)
|
||||
except WrongModelException as e:
|
||||
QgsMessageLog.logMessage(self.tr('Could not load model {0}\n{1}', 'ModelerAlgorithmProvider').format(descriptionFile, str(e)),
|
||||
alg = QgsProcessingModelAlgorithm()
|
||||
if alg.fromFile(fullpath):
|
||||
if alg.name():
|
||||
alg.setSourceFilePath(fullpath)
|
||||
self.algs.append(alg)
|
||||
else:
|
||||
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
|
||||
self.tr('Processing'), Qgis.Critical)
|
||||
|
||||
|
||||
@ -18,9 +18,5 @@
|
||||
"""
|
||||
|
||||
|
||||
class WrongModelException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UndefinedParameterException(Exception):
|
||||
pass
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user