eric6/Graphics/UMLDialog.py

changeset 8205
4a0f1f896341
parent 8143
2c730d5fd177
child 8218
7c09585bd960
diff -r fd477cded1c1 -r 4a0f1f896341 eric6/Graphics/UMLDialog.py
--- a/eric6/Graphics/UMLDialog.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/Graphics/UMLDialog.py	Thu Apr 08 18:27:47 2021 +0200
@@ -163,6 +163,14 @@
         @return reference to the instantiated diagram builder
         @exception ValueError raised to indicate an illegal diagram type
         """
+        if diagramType not in (
+            UMLDialog.ClassDiagram, UMLDialog.PackageDiagram,
+            UMLDialog.ImportsDiagram, UMLDialog.ApplicationDiagram,
+            UMLDialog.NoDiagram
+        ):
+            raise ValueError(self.tr(
+                "Illegal diagram type '{0}' given.").format(diagramType))
+        
         if diagramType == UMLDialog.ClassDiagram:
             from .UMLClassDiagramBuilder import UMLClassDiagramBuilder
             return UMLClassDiagramBuilder(
@@ -179,11 +187,8 @@
             from .ApplicationDiagramBuilder import ApplicationDiagramBuilder
             return ApplicationDiagramBuilder(
                 self, self.umlView, self.__project, **kwargs)
-        elif diagramType == UMLDialog.NoDiagram:
+        else:
             return None
-        else:
-            raise ValueError(self.tr(
-                "Illegal diagram type '{0}' given.").format(diagramType))
     
     def __diagramTypeString(self):
         """

eric ide

mercurial