1111from git .exc import GitCommandError , InvalidGitRepositoryError
1212from git .repo import Repo
1313
14- from git_sim .enums import ColorByOptions
14+ from git_sim .enums import ColorByOptions , StyleOptions
1515from git_sim .settings import settings
1616
1717
@@ -62,6 +62,17 @@ def __init__(self):
6262 self .fill_opacity = 0.5
6363 self .ref_fill_opacity = 1.0
6464
65+ if settings .style == StyleOptions .CLEAN :
66+ self .commit_stroke_width = 5
67+ self .arrow_stroke_width = 5
68+ self .arrow_tip_shape = m .ArrowTriangleFilledTip
69+ self .font_weight = m .NORMAL
70+ elif settings .style == StyleOptions .THICK :
71+ self .commit_stroke_width = 30
72+ self .arrow_stroke_width = 10
73+ self .arrow_tip_shape = m .StealthTip
74+ self .font_weight = m .BOLD
75+
6576 def init_repo (self ):
6677 try :
6778 self .repo = Repo (search_parent_directories = True )
@@ -243,6 +254,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
243254
244255 circle = m .Circle (
245256 stroke_color = commit_fill ,
257+ stroke_width = self .commit_stroke_width ,
246258 fill_color = commit_fill ,
247259 fill_opacity = self .fill_opacity ,
248260 )
@@ -280,7 +292,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
280292 )
281293 end = self .drawnCommits [commit .hexsha ].get_center ()
282294
283- arrow = m .Arrow (start , end , color = self .fontColor )
295+ arrow = m .Arrow (start , end , color = self .fontColor , stroke_width = self . arrow_stroke_width , tip_shape = self . arrow_tip_shape , max_stroke_width_to_length_ratio = 1000 )
284296
285297 if commit == "dark" :
286298 arrow = m .Arrow (
@@ -299,7 +311,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
299311 for commitCircle in self .drawnCommits .values ():
300312 inter = m .Intersection (lineRect , commitCircle )
301313 if inter .has_points ():
302- arrow = m .CurvedArrow (start , end , color = self .fontColor )
314+ arrow = m .CurvedArrow (start , end , color = self .fontColor , stroke_width = self . arrow_stroke_width , tip_shape = self . arrow_tip_shape )
303315 if start [1 ] == end [1 ]:
304316 arrow .shift (m .UP * 1.25 )
305317 if start [0 ] < end [0 ] and start [1 ] == end [1 ]:
@@ -320,7 +332,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
320332 font = "Monospace" ,
321333 font_size = 20 if settings .highlight_commit_messages else 14 ,
322334 color = self .fontColor ,
323- weight = m .BOLD if settings .highlight_commit_messages else m .NORMAL ,
335+ weight = m .BOLD if settings .highlight_commit_messages or settings . style == StyleOptions . THICK else m .NORMAL ,
324336 ).next_to (circle , m .DOWN )
325337
326338 if settings .animate and commit != "dark" and isNewCommit :
@@ -373,14 +385,15 @@ def get_nonparent_branch_names(self):
373385 def build_commit_id_and_message (self , commit , i ):
374386 hide_refs = False
375387 if commit == "dark" :
376- commitId = m .Text ("" , font = "Monospace" , font_size = 20 , color = self .fontColor )
388+ commitId = m .Text ("" , font = "Monospace" , font_size = 20 , color = self .fontColor , weight = self . font_weight )
377389 commitMessage = ""
378390 else :
379391 commitId = m .Text (
380392 commit .hexsha [0 :6 ],
381393 font = "Monospace" ,
382394 font_size = 20 ,
383395 color = self .fontColor ,
396+ weight = self .font_weight ,
384397 )
385398 commitMessage = commit .message .split ("\n " )[0 ][:40 ].replace ("\n " , " " )
386399 return commitId , commitMessage , commit , hide_refs
@@ -397,7 +410,7 @@ def draw_head(self, commit, i, commitId):
397410 else :
398411 headbox .next_to (commitId , m .UP )
399412 headText = m .Text (
400- "HEAD" , font = "Monospace" , font_size = 20 , color = self .fontColor
413+ "HEAD" , font = "Monospace" , font_size = 20 , color = self .fontColor , weight = self . font_weight ,
401414 ).move_to (headbox .get_center ())
402415
403416 head = m .VGroup (headbox , headText )
@@ -444,7 +457,7 @@ def draw_branch(self, commit, i, make_branches_remote=False):
444457 )
445458
446459 branchText = m .Text (
447- text , font = "Monospace" , font_size = 20 , color = self .fontColor
460+ text , font = "Monospace" , font_size = 20 , color = self .fontColor , weight = self . font_weight ,
448461 )
449462 branchRec = m .Rectangle (
450463 color = m .GREEN ,
@@ -490,6 +503,7 @@ def draw_tag(self, commit, i):
490503 font = "Monospace" ,
491504 font_size = 20 ,
492505 color = self .fontColor ,
506+ weight = self .font_weight ,
493507 )
494508 tagRec = m .Rectangle (
495509 color = m .YELLOW ,
@@ -653,6 +667,7 @@ def setup_and_draw_zones(
653667 font = "Monospace" ,
654668 font_size = 28 ,
655669 color = self .fontColor ,
670+ weight = m .BOLD ,
656671 )
657672 .move_to ((vert1 .get_center ()[0 ] - 4 , 0 , 0 ))
658673 .shift (m .UP * self .zone_title_offset )
@@ -663,6 +678,7 @@ def setup_and_draw_zones(
663678 font = "Monospace" ,
664679 font_size = 28 ,
665680 color = self .fontColor ,
681+ weight = m .BOLD ,
666682 )
667683 .move_to (self .camera .frame .get_center ())
668684 .align_to (firstColumnTitle , m .UP )
@@ -673,6 +689,7 @@ def setup_and_draw_zones(
673689 font = "Monospace" ,
674690 font_size = 28 ,
675691 color = self .fontColor ,
692+ weight = m .BOLD ,
676693 )
677694 .move_to ((vert2 .get_center ()[0 ] + 4 , 0 , 0 ))
678695 .align_to (firstColumnTitle , m .UP )
@@ -985,7 +1002,7 @@ def setup_and_draw_parent(
9851002 color = m .RED ,
9861003 ):
9871004 circle = m .Circle (
988- stroke_color = color , fill_color = color , fill_opacity = self .ref_fill_opacity
1005+ stroke_color = color , stroke_width = self . commit_stroke_width , fill_color = color , fill_opacity = self .ref_fill_opacity
9891006 )
9901007 circle .height = 1
9911008 circle .next_to (
@@ -997,12 +1014,12 @@ def setup_and_draw_parent(
9971014
9981015 start = circle .get_center ()
9991016 end = self .drawnCommits [child .hexsha ].get_center ()
1000- arrow = m .Arrow (start , end , color = self .fontColor )
1017+ arrow = m .Arrow (start , end , color = self .fontColor , stroke_width = self . arrow_stroke_width , tip_shape = self . arrow_tip_shape , max_stroke_width_to_length_ratio = 1000 )
10011018 length = numpy .linalg .norm (start - end ) - (1.5 if start [1 ] == end [1 ] else 3 )
10021019 arrow .set_length (length )
10031020
10041021 commitId = m .Text (
1005- "abcdef" , font = "Monospace" , font_size = 20 , color = self .fontColor
1022+ "abcdef" , font = "Monospace" , font_size = 20 , color = self .fontColor , weight = self . font_weight ,
10061023 ).next_to (circle , m .UP )
10071024 self .toFadeOut .add (commitId )
10081025
@@ -1014,6 +1031,7 @@ def setup_and_draw_parent(
10141031 font = "Monospace" ,
10151032 font_size = 14 ,
10161033 color = self .fontColor ,
1034+ weight = self .font_weight ,
10171035 ).next_to (circle , m .DOWN )
10181036 self .toFadeOut .add (message )
10191037
@@ -1061,7 +1079,7 @@ def get_nondark_commits(self):
10611079 return nondark_commits
10621080
10631081 def draw_ref (self , commit , top , i = 0 , text = "HEAD" , color = m .BLUE ):
1064- refText = m .Text (text , font = "Monospace" , font_size = 20 , color = self .fontColor )
1082+ refText = m .Text (text , font = "Monospace" , font_size = 20 , color = self .fontColor , weight = self . font_weight )
10651083 refbox = m .Rectangle (
10661084 color = color ,
10671085 fill_color = color ,
@@ -1196,6 +1214,7 @@ def color_by(self, offset=0):
11961214 font = "Monospace" ,
11971215 font_size = 36 ,
11981216 color = self .colors [int (i % 11 )],
1217+ weight = self .font_weight ,
11991218 )
12001219 authorText .move_to (
12011220 [(- 5 - offset ) if settings .reverse else (5 + offset ), - i , 0 ]
0 commit comments