Skip to content
Snippets Groups Projects
Commit 4f5b51df authored by Tomáš Orviský's avatar Tomáš Orviský
Browse files

DiagramClass docstring

parent b5112132
Branches
No related merge requests found
...@@ -10,7 +10,6 @@ from .diagram_object import DiagramObject ...@@ -10,7 +10,6 @@ from .diagram_object import DiagramObject
class DiagramClass(DiagramObject): class DiagramClass(DiagramObject):
def __init__(self, def __init__(self,
name: str, name: str,
edges: List[DiagramEdge] = None, edges: List[DiagramEdge] = None,
...@@ -67,6 +66,8 @@ class DiagramClass(DiagramObject): ...@@ -67,6 +66,8 @@ class DiagramClass(DiagramObject):
return self.edges return self.edges
def get_edge_to(self, target: DiagramObject) -> DiagramEdge | None: def get_edge_to(self, target: DiagramObject) -> DiagramEdge | None:
"""Returns edge to target if it exists in this class."""
for e in self.edges: for e in self.edges:
if e.target == target: if e.target == target:
return e return e
...@@ -92,6 +93,7 @@ class DiagramClass(DiagramObject): ...@@ -92,6 +93,7 @@ class DiagramClass(DiagramObject):
self.redraw() self.redraw()
def set_show_icon(self, show_icon: bool): def set_show_icon(self, show_icon: bool):
"""Sets if the class icon should be drawn."""
self.__show_icon = show_icon self.__show_icon = show_icon
self.redraw() self.redraw()
...@@ -209,6 +211,8 @@ class DiagramClass(DiagramObject): ...@@ -209,6 +211,8 @@ class DiagramClass(DiagramObject):
@staticmethod @staticmethod
def get_icon(text: str, colour) -> VMobject: def get_icon(text: str, colour) -> VMobject:
"""Returns VGroup representing icon for DiagramClass."""
c = Circle(color=BLACK, fill_color=colour, stroke_width=2, fill_opacity=1) c = Circle(color=BLACK, fill_color=colour, stroke_width=2, fill_opacity=1)
t = Text(text, color=BLACK) t = Text(text, color=BLACK)
c.surround(t, buffer_factor=1.6) c.surround(t, buffer_factor=1.6)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment