@@ -70,30 +70,46 @@ def add_details(self):
7070 font_size = 20 ,
7171 color = self .fontColor ,
7272 )
73- project_root_text .align_to (project_root , m .LEFT ).align_to (project_root , m .UP ).shift (m .RIGHT * 0.25 ).shift (m .DOWN * 0.25 )
73+ project_root_text .align_to (project_root , m .LEFT ).align_to (
74+ project_root , m .UP
75+ ).shift (m .RIGHT * 0.25 ).shift (m .DOWN * 0.25 )
7476
7577 dot_git_text = m .Text (
7678 ".git/" ,
7779 font = self .font ,
7880 font_size = 20 ,
7981 color = self .fontColor ,
8082 )
81- dot_git_text .align_to (project_root_text , m .UP ).shift (down_shift ).align_to (project_root_text , m .LEFT ).shift (m .RIGHT * 0.5 )
83+ dot_git_text .align_to (project_root_text , m .UP ).shift (down_shift ).align_to (
84+ project_root_text , m .LEFT
85+ ).shift (m .RIGHT * 0.5 )
8286
8387 config_text = m .Text (
8488 "config" ,
8589 font = self .font ,
8690 font_size = 20 ,
8791 color = self .fontColor ,
8892 )
89- config_text .align_to (dot_git_text , m .UP ).shift (down_shift ).align_to (dot_git_text , m .LEFT ).shift (m .RIGHT * 0.5 )
93+ config_text .align_to (dot_git_text , m .UP ).shift (down_shift ).align_to (
94+ dot_git_text , m .LEFT
95+ ).shift (m .RIGHT * 0.5 )
9096
9197 if settings .animate :
92- self .play (m .AddTextLetterByLetter (cmd_text , time_per_char = self .time_per_char ))
98+ self .play (
99+ m .AddTextLetterByLetter (cmd_text , time_per_char = self .time_per_char )
100+ )
93101 self .play (m .Create (project_root , time_per_char = self .time_per_char ))
94- self .play (m .AddTextLetterByLetter (project_root_text , time_per_char = self .time_per_char ))
95- self .play (m .AddTextLetterByLetter (dot_git_text , time_per_char = self .time_per_char ))
96- self .play (m .AddTextLetterByLetter (config_text , time_per_char = self .time_per_char ))
102+ self .play (
103+ m .AddTextLetterByLetter (
104+ project_root_text , time_per_char = self .time_per_char
105+ )
106+ )
107+ self .play (
108+ m .AddTextLetterByLetter (dot_git_text , time_per_char = self .time_per_char )
109+ )
110+ self .play (
111+ m .AddTextLetterByLetter (config_text , time_per_char = self .time_per_char )
112+ )
97113 else :
98114 self .add (cmd_text )
99115 self .add (project_root )
@@ -105,25 +121,60 @@ def add_details(self):
105121 if self .l :
106122 last_element = config_text
107123 for i , section in enumerate (config .sections ()):
108- section_text = m .Text (f"[{ section } ]" , font = self .font , color = self .fontColor , font_size = 20 ).align_to (last_element , m .UP ).shift (down_shift ).align_to (config_text , m .LEFT ).shift (m .RIGHT * 0.5 )
124+ section_text = (
125+ m .Text (
126+ f"[{ section } ]" ,
127+ font = self .font ,
128+ color = self .fontColor ,
129+ font_size = 20 ,
130+ )
131+ .align_to (last_element , m .UP )
132+ .shift (down_shift )
133+ .align_to (config_text , m .LEFT )
134+ .shift (m .RIGHT * 0.5 )
135+ )
109136 self .toFadeOut .add (section_text )
110137 if settings .animate :
111- self .play (m .AddTextLetterByLetter (section_text , time_per_char = self .time_per_char ))
138+ self .play (
139+ m .AddTextLetterByLetter (
140+ section_text , time_per_char = self .time_per_char
141+ )
142+ )
112143 else :
113144 self .add (section_text )
114145 last_element = section_text
115146 project_root = self .resize_rectangle (project_root , last_element )
116147 for j , option in enumerate (config .options (section )):
117148 if option != "__name__" :
118- option_text = m .Text (f"{ option } = { config .get_value (section , option )} " , font = self .font , color = self .fontColor , font_size = 20 ).align_to (last_element , m .UP ).shift (down_shift ).align_to (section_text , m .LEFT ).shift (m .RIGHT * 0.5 )
149+ option_text = (
150+ m .Text (
151+ f"{ option } = { config .get_value (section , option )} " ,
152+ font = self .font ,
153+ color = self .fontColor ,
154+ font_size = 20 ,
155+ )
156+ .align_to (last_element , m .UP )
157+ .shift (down_shift )
158+ .align_to (section_text , m .LEFT )
159+ .shift (m .RIGHT * 0.5 )
160+ )
119161 self .toFadeOut .add (option_text )
120162 last_element = option_text
121163 if settings .animate :
122- self .play (m .AddTextLetterByLetter (option_text , time_per_char = self .time_per_char ))
164+ self .play (
165+ m .AddTextLetterByLetter (
166+ option_text , time_per_char = self .time_per_char
167+ )
168+ )
123169 else :
124170 self .add (option_text )
125- if not (i == len (config .sections ()) - 1 and j == len (config .options (section )) - 1 ):
126- project_root = self .resize_rectangle (project_root , last_element )
171+ if not (
172+ i == len (config .sections ()) - 1
173+ and j == len (config .options (section )) - 1
174+ ):
175+ project_root = self .resize_rectangle (
176+ project_root , last_element
177+ )
127178 else :
128179 if not self .settings :
129180 print ("git-sim error: no config option specified" )
@@ -134,8 +185,8 @@ def add_details(self):
134185 elif "." not in self .settings [0 ]:
135186 print ("git-sim error: specify config option as 'section.option'" )
136187 sys .exit (1 )
137- section = self .settings [0 ][:self .settings [0 ].index ("." )]
138- option = self .settings [0 ][self .settings [0 ].index ("." ) + 1 :]
188+ section = self .settings [0 ][: self .settings [0 ].index ("." )]
189+ option = self .settings [0 ][self .settings [0 ].index ("." ) + 1 :]
139190 if len (self .settings ) == 1 :
140191 try :
141192 value = config .get_value (section , option )
@@ -144,13 +195,45 @@ def add_details(self):
144195 sys .exit (1 )
145196 elif len (self .settings ) == 2 :
146197 value = self .settings [1 ].strip ('"' ).strip ("'" ).strip ("\\ " )
147- section_text = m .Text (f"[{ self .trim_cmd (section , 50 )} ]" , font = self .font , color = self .fontColor , font_size = 20 , weight = m .BOLD ).align_to (config_text , m .UP ).shift (down_shift ).align_to (config_text , m .LEFT ).shift (m .RIGHT * 0.5 )
148- option_text = m .Text (f"{ self .trim_cmd (option , 40 )} = { self .trim_cmd (value , 40 )} " , font = self .font , color = self .fontColor , font_size = 20 , weight = m .BOLD ).align_to (section_text , m .UP ).shift (down_shift ).align_to (section_text , m .LEFT ).shift (m .RIGHT * 0.5 )
198+ section_text = (
199+ m .Text (
200+ f"[{ self .trim_cmd (section , 50 )} ]" ,
201+ font = self .font ,
202+ color = self .fontColor ,
203+ font_size = 20 ,
204+ weight = m .BOLD ,
205+ )
206+ .align_to (config_text , m .UP )
207+ .shift (down_shift )
208+ .align_to (config_text , m .LEFT )
209+ .shift (m .RIGHT * 0.5 )
210+ )
211+ option_text = (
212+ m .Text (
213+ f"{ self .trim_cmd (option , 40 )} = { self .trim_cmd (value , 40 )} " ,
214+ font = self .font ,
215+ color = self .fontColor ,
216+ font_size = 20 ,
217+ weight = m .BOLD ,
218+ )
219+ .align_to (section_text , m .UP )
220+ .shift (down_shift )
221+ .align_to (section_text , m .LEFT )
222+ .shift (m .RIGHT * 0.5 )
223+ )
149224 self .toFadeOut .add (section_text )
150225 self .toFadeOut .add (option_text )
151226 if settings .animate :
152- self .play (m .AddTextLetterByLetter (section_text , time_per_char = self .time_per_char ))
153- self .play (m .AddTextLetterByLetter (option_text , time_per_char = self .time_per_char ))
227+ self .play (
228+ m .AddTextLetterByLetter (
229+ section_text , time_per_char = self .time_per_char
230+ )
231+ )
232+ self .play (
233+ m .AddTextLetterByLetter (
234+ option_text , time_per_char = self .time_per_char
235+ )
236+ )
154237 else :
155238 self .add (section_text )
156239 self .add (option_text )
@@ -162,9 +245,16 @@ def add_details(self):
162245 self .toFadeOut .add (config_text )
163246
164247 def resize_rectangle (self , rect , last_element ):
165- if last_element .get_bottom ()[1 ] - 3 * last_element .height > rect .get_bottom ()[1 ]:
248+ if (
249+ last_element .get_bottom ()[1 ] - 3 * last_element .height
250+ > rect .get_bottom ()[1 ]
251+ ):
166252 return rect
167- new_rect = m .Rectangle (width = rect .width , height = rect .height + 2 * last_element .height , color = rect .color )
253+ new_rect = m .Rectangle (
254+ width = rect .width ,
255+ height = rect .height + 2 * last_element .height ,
256+ color = rect .color ,
257+ )
168258 new_rect .align_to (rect , m .UP )
169259 self .toFadeOut .remove (rect )
170260 self .toFadeOut .add (new_rect )
0 commit comments