11
11
from git .exc import GitCommandError , InvalidGitRepositoryError
12
12
from git .repo import Repo
13
13
14
- from git_sim .enums import ColorByOptions
14
+ from git_sim .enums import ColorByOptions , StyleOptions
15
15
from git_sim .settings import settings
16
16
17
17
@@ -62,6 +62,17 @@ def __init__(self):
62
62
self .fill_opacity = 0.5
63
63
self .ref_fill_opacity = 1.0
64
64
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
+
65
76
def init_repo (self ):
66
77
try :
67
78
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]))
243
254
244
255
circle = m .Circle (
245
256
stroke_color = commit_fill ,
257
+ stroke_width = self .commit_stroke_width ,
246
258
fill_color = commit_fill ,
247
259
fill_opacity = self .fill_opacity ,
248
260
)
@@ -280,7 +292,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
280
292
)
281
293
end = self .drawnCommits [commit .hexsha ].get_center ()
282
294
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 )
284
296
285
297
if commit == "dark" :
286
298
arrow = m .Arrow (
@@ -299,7 +311,7 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
299
311
for commitCircle in self .drawnCommits .values ():
300
312
inter = m .Intersection (lineRect , commitCircle )
301
313
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 )
303
315
if start [1 ] == end [1 ]:
304
316
arrow .shift (m .UP * 1.25 )
305
317
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]))
320
332
font = "Monospace" ,
321
333
font_size = 20 if settings .highlight_commit_messages else 14 ,
322
334
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 ,
324
336
).next_to (circle , m .DOWN )
325
337
326
338
if settings .animate and commit != "dark" and isNewCommit :
@@ -373,14 +385,15 @@ def get_nonparent_branch_names(self):
373
385
def build_commit_id_and_message (self , commit , i ):
374
386
hide_refs = False
375
387
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 )
377
389
commitMessage = ""
378
390
else :
379
391
commitId = m .Text (
380
392
commit .hexsha [0 :6 ],
381
393
font = "Monospace" ,
382
394
font_size = 20 ,
383
395
color = self .fontColor ,
396
+ weight = self .font_weight ,
384
397
)
385
398
commitMessage = commit .message .split ("\n " )[0 ][:40 ].replace ("\n " , " " )
386
399
return commitId , commitMessage , commit , hide_refs
@@ -397,7 +410,7 @@ def draw_head(self, commit, i, commitId):
397
410
else :
398
411
headbox .next_to (commitId , m .UP )
399
412
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 ,
401
414
).move_to (headbox .get_center ())
402
415
403
416
head = m .VGroup (headbox , headText )
@@ -444,7 +457,7 @@ def draw_branch(self, commit, i, make_branches_remote=False):
444
457
)
445
458
446
459
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 ,
448
461
)
449
462
branchRec = m .Rectangle (
450
463
color = m .GREEN ,
@@ -490,6 +503,7 @@ def draw_tag(self, commit, i):
490
503
font = "Monospace" ,
491
504
font_size = 20 ,
492
505
color = self .fontColor ,
506
+ weight = self .font_weight ,
493
507
)
494
508
tagRec = m .Rectangle (
495
509
color = m .YELLOW ,
@@ -653,6 +667,7 @@ def setup_and_draw_zones(
653
667
font = "Monospace" ,
654
668
font_size = 28 ,
655
669
color = self .fontColor ,
670
+ weight = m .BOLD ,
656
671
)
657
672
.move_to ((vert1 .get_center ()[0 ] - 4 , 0 , 0 ))
658
673
.shift (m .UP * self .zone_title_offset )
@@ -663,6 +678,7 @@ def setup_and_draw_zones(
663
678
font = "Monospace" ,
664
679
font_size = 28 ,
665
680
color = self .fontColor ,
681
+ weight = m .BOLD ,
666
682
)
667
683
.move_to (self .camera .frame .get_center ())
668
684
.align_to (firstColumnTitle , m .UP )
@@ -673,6 +689,7 @@ def setup_and_draw_zones(
673
689
font = "Monospace" ,
674
690
font_size = 28 ,
675
691
color = self .fontColor ,
692
+ weight = m .BOLD ,
676
693
)
677
694
.move_to ((vert2 .get_center ()[0 ] + 4 , 0 , 0 ))
678
695
.align_to (firstColumnTitle , m .UP )
@@ -985,7 +1002,7 @@ def setup_and_draw_parent(
985
1002
color = m .RED ,
986
1003
):
987
1004
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
989
1006
)
990
1007
circle .height = 1
991
1008
circle .next_to (
@@ -997,12 +1014,12 @@ def setup_and_draw_parent(
997
1014
998
1015
start = circle .get_center ()
999
1016
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 )
1001
1018
length = numpy .linalg .norm (start - end ) - (1.5 if start [1 ] == end [1 ] else 3 )
1002
1019
arrow .set_length (length )
1003
1020
1004
1021
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 ,
1006
1023
).next_to (circle , m .UP )
1007
1024
self .toFadeOut .add (commitId )
1008
1025
@@ -1014,6 +1031,7 @@ def setup_and_draw_parent(
1014
1031
font = "Monospace" ,
1015
1032
font_size = 14 ,
1016
1033
color = self .fontColor ,
1034
+ weight = self .font_weight ,
1017
1035
).next_to (circle , m .DOWN )
1018
1036
self .toFadeOut .add (message )
1019
1037
@@ -1061,7 +1079,7 @@ def get_nondark_commits(self):
1061
1079
return nondark_commits
1062
1080
1063
1081
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 )
1065
1083
refbox = m .Rectangle (
1066
1084
color = color ,
1067
1085
fill_color = color ,
@@ -1196,6 +1214,7 @@ def color_by(self, offset=0):
1196
1214
font = "Monospace" ,
1197
1215
font_size = 36 ,
1198
1216
color = self .colors [int (i % 11 )],
1217
+ weight = self .font_weight ,
1199
1218
)
1200
1219
authorText .move_to (
1201
1220
[(- 5 - offset ) if settings .reverse else (5 + offset ), - i , 0 ]
0 commit comments