MCPcopy Index your code
hub / github.com/initialcommit-com/git-sim / setup_and_draw_parent

Method setup_and_draw_parent

src/git_sim/rebase.py:108–192  ·  view source on GitHub ↗
(
        self,
        child,
        commitMessage="New commit",
        shift=numpy.array([0.0, 0.0, 0.0]),
        draw_arrow=True,
    )

Source from the content-addressed store, hash-verified

106 self.show_outro()
107
108 def setup_and_draw_parent(
109 self,
110 child,
111 commitMessage="New commit",
112 shift=numpy.array([0.0, 0.0, 0.0]),
113 draw_arrow=True,
114 ):
115 circle = m.Circle(
116 stroke_color=m.RED,
117 stroke_width=self.commit_stroke_width,
118 fill_color=m.RED,
119 fill_opacity=0.25,
120 )
121 circle.height = 1
122 circle.next_to(
123 self.drawnCommits[child],
124 m.LEFT if settings.reverse else m.RIGHT,
125 buff=1.5,
126 )
127 circle.shift(shift)
128
129 start = circle.get_center()
130 end = self.drawnCommits[child].get_center()
131 arrow = m.Arrow(
132 start,
133 end,
134 color=self.fontColor,
135 stroke_width=self.arrow_stroke_width,
136 tip_shape=self.arrow_tip_shape,
137 max_stroke_width_to_length_ratio=1000,
138 )
139 length = numpy.linalg.norm(start - end) - (1.5 if start[1] == end[1] else 3)
140 arrow.set_length(length)
141
142 sha = "".join(
143 chr(ord(letter) + 1)
144 if (
145 (chr(ord(letter) + 1).isalpha() and letter < "f")
146 or chr(ord(letter) + 1).isdigit()
147 )
148 else letter
149 for letter in child[:6]
150 )
151 commitId = m.Text(
152 sha if commitMessage != "..." else "...",
153 font=self.font,
154 font_size=20,
155 color=self.fontColor,
156 ).next_to(circle, m.UP)
157 self.toFadeOut.add(commitId)
158
159 commitMessage = commitMessage[:40].replace("\n", " ")
160 message = m.Text(
161 "\n".join(
162 commitMessage[j : j + 20] for j in range(0, len(commitMessage), 20)
163 )[:100],
164 font=self.font,
165 font_size=14,

Callers 4

constructMethod · 0.95
constructMethod · 0.45
constructMethod · 0.45
constructMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected