--- a/eric6/Graphics/ApplicationDiagramBuilder.py Thu May 06 19:46:00 2021 +0200 +++ b/eric6/Graphics/ApplicationDiagramBuilder.py Sat May 08 18:34:08 2021 +0200 @@ -446,3 +446,31 @@ "project_name": self.project.getProjectName(), "no_modules": self.noModules, } + + def fromDict(self, version, data): + """ + Public method to populate the class with data persisted by 'toDict()'. + + @param version version of the data + @type str + @param data dictionary containing the persisted data + @type dict + @return tuple containing a flag indicating success and an info + message in case the diagram belongs to a different project + @rtype tuple of (bool, str) + """ + try: + self.noModules = data["no_modules"] + + if data["project_name"] != self.project.getProjectName(): + msg = self.tr( + "<p>The diagram belongs to project <b>{0}</b>." + " Please open it and try again.</p>" + ).format(data["project_name"]) + return False, msg + except KeyError: + return False, "" + + self.initialize() + + return True, ""