Skip to content

Commit

Permalink
(station) Divide station demos into sub-categories
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Oct 20, 2024
1 parent 18d24b3 commit f063f53
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
24 changes: 13 additions & 11 deletions station/lib/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,21 @@ def gen_docs(string_manager, metastations):
file=f,
)

with open(os.path.join(prefix, f"{metastation_label}_layouts.md"), "w") as f:
print(
f"""---
for demoi, (demok, demov) in enumerate(metastation.demos.items()):
os.makedirs(os.path.join(prefix, "img", metastation_label, "layouts", demok), exist_ok=True)
with open(os.path.join(prefix, f"{metastation_label}_{demok}.md"), "w") as f:
print(
f"""---
layout: default
title: Sample Layouts
title: {demok}
parent: {translation}
grand_parent: "CNS Addon: Wuhu"
nav_order: 5
nav_order: {5+demoi}
---
""",
file=f,
)
for i, demo in enumerate(metastation.demos):
img = demo.graphics(4, 32).crop().resize(1920, 1080).to_pil_image()
img.save(os.path.join(prefix, "img", f"{metastation_label}/layouts/{i}.png"))
print(f"## {demo.title}\n\n![](img/{metastation_label}/layouts/{i}.png)", file=f)
file=f,
)
for i, demo in enumerate(demov):
img = demo.graphics(4, 32).crop().resize(1920, 1080).to_pil_image()
img.save(os.path.join(prefix, "img", f"{metastation_label}/layouts/{demok}/{i}.png"))
print(f"## {demo.title}\n\n![](img/{metastation_label}/layouts/{demok}/{i}.png)", file=f)
2 changes: 2 additions & 0 deletions station/lib/metastation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def __init__(self, stations, class_label, categories, demos, road_stops=None, ob
self.stations = stations
self.class_label = class_label
self.categories = categories
if isinstance(demos, list):
demos = {"Sample Layouts": demos}
self.demos = demos
self.road_stops = road_stops or []
self.objects = objects or []
Expand Down
41 changes: 21 additions & 20 deletions station/stations/dovemere_2018.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,26 @@
+ [b"\xF0"]
+ [b"R", b"Z"]
],
[
demos.normal_demo,
demos.big_demo,
demos.big_half_demo,
demos.real_yard_demo,
demos.semi_auto_demo,
demos.semi_np_auto_demo,
demos.full_auto_demo,
demos.full_np_auto_demo,
demos.side_auto_demo,
demos.side_np_auto_demo,
demos.side_third_auto_demo,
demos.side_third_np_auto_demo,
demos.special_demo_g,
demos.special_demo_p,
demos.special_demo_cn,
demos.special_demo_sa,
demos.special_demo_cp,
demos.special_demo_aq,
],
{
"Realistic Layouts": [demos.normal_demo, demos.big_demo, demos.big_half_demo, demos.real_yard_demo],
"Template Showcases": [
demos.semi_auto_demo,
demos.semi_np_auto_demo,
demos.full_auto_demo,
demos.full_np_auto_demo,
demos.side_auto_demo,
demos.side_np_auto_demo,
demos.side_third_auto_demo,
demos.side_third_np_auto_demo,
],
"Diverse Designs": [
demos.special_demo_g,
demos.special_demo_p,
demos.special_demo_cn,
demos.special_demo_sa,
demos.special_demo_cp,
demos.special_demo_aq,
],
},
road_stops=roadstops,
)

0 comments on commit f063f53

Please sign in to comment.