eric6/Graphics/AssociationItem.py

changeset 8295
3f5e8b0a338e
parent 8291
3d79b1e5bf3c
equal deleted inserted replaced
8294:cb4e5bbf3a2c 8295:3f5e8b0a338e
614 "src": self.itemA.getId(), 614 "src": self.itemA.getId(),
615 "dst": self.itemB.getId(), 615 "dst": self.itemB.getId(),
616 "type": self.assocType.value, 616 "type": self.assocType.value,
617 "topToBottom": self.topToBottom, 617 "topToBottom": self.topToBottom,
618 } 618 }
619
620 @classmethod
621 def fromDict(cls, data, umlItems, colors=None):
622 """
623 Class method to create an association item from persisted data.
624
625 @param data dictionary containing the persisted data as generated
626 by toDict()
627 @type dict
628 @param umlItems list of UML items
629 @type list of UMLItem
630 @param colors tuple containing the foreground and background colors
631 @type tuple of (QColor, QColor)
632 @return created association item
633 @rtype AssociationItem
634 """
635 try:
636 return cls(umlItems[data["src"]],
637 umlItems[data["dst"]],
638 assocType=AssociationType(data["type"]),
639 topToBottom=data["topToBottom"],
640 colors=colors)
641 except (KeyError, ValueError):
642 return None

eric ide

mercurial