@@ -370,6 +370,13 @@ def make_libraries(libraries, position):
370
370
triangle_icon = triangle_icon ,
371
371
)
372
372
373
+ def make_sd_dir (position ):
374
+ make_line (
375
+ "sd" ,
376
+ position ,
377
+ triangle_icon = right_triangle ,
378
+ )
379
+
373
380
final_list_to_render = sort_libraries (libs )
374
381
if settings_required (final_list_to_render ):
375
382
context ["added_settings_toml" ] = True
@@ -388,6 +395,7 @@ def make_libraries(libraries, position):
388
395
+ len (final_list_to_render ) * LINE_SPACING
389
396
+ (project_files_count ) * LINE_SPACING
390
397
+ (1 if context ["added_settings_toml" ] else 0 ) * LINE_SPACING
398
+ + 1 * LINE_SPACING # /sd/ dir
391
399
)
392
400
img = Image .new ("RGB" , (OUT_WIDTH , image_height ), "#303030" )
393
401
draw = ImageDraw .Draw (img )
@@ -396,15 +404,23 @@ def make_libraries(libraries, position):
396
404
7
397
405
+ len (final_list_to_render )
398
406
+ project_files_count
399
- + (1 if context ["added_settings_toml" ] else 0 ),
407
+ + (1 if context ["added_settings_toml" ] else 0 )
408
+ + 1 , # for /sd/ dir
400
409
offset = (PADDING , PADDING ),
401
410
)
402
411
print (f"fltr: { final_list_to_render } " )
403
412
make_header ((PADDING , PADDING ), project_files , final_list_to_render )
404
- make_libraries (
405
- final_list_to_render ,
406
- ( PADDING , PADDING + (LINE_SPACING * (7 + project_files_count ) )),
413
+ _libraries_position = (
414
+ PADDING ,
415
+ PADDING + (LINE_SPACING * (7 + project_files_count )),
407
416
)
417
+ make_libraries (final_list_to_render , _libraries_position )
418
+ _sd_dir_position = (
419
+ 76 ,
420
+ PADDING
421
+ + (LINE_SPACING * (7 + project_files_count + len (final_list_to_render ))),
422
+ )
423
+ make_sd_dir (_sd_dir_position )
408
424
409
425
img .save ("generated_images/{}.png" .format (image_name ))
410
426
@@ -440,13 +456,20 @@ def cli(ctx):
440
456
441
457
442
458
@cli .command ()
443
- def learn ():
459
+ @click .option (
460
+ "-g" , "--guide" , help = "Guide Name of a single Learn Guide to generate an image for."
461
+ )
462
+ def learn (guide = None ):
444
463
"""Generate images for a learn-style repo"""
445
- with Pool () as pool :
446
- for _ in pool .imap (
447
- generate_learn_requirement_image , get_learn_guide_cp_projects ()
448
- ):
449
- pass
464
+ if guide is None :
465
+ with Pool () as pool :
466
+ for _ in pool .imap (
467
+ generate_learn_requirement_image , get_learn_guide_cp_projects ()
468
+ ):
469
+ pass
470
+ else :
471
+ print (f"generating image for single guide: { guide } " )
472
+ generate_learn_requirement_image (guide )
450
473
451
474
452
475
@cli .command ()
0 commit comments