Skip to content

Commit f1d41ca

Browse files
committed
Configure step image
1 parent 39149a6 commit f1d41ca

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

term_timer/server/app.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from term_timer.cheers import generate_solve_cheers
4444
from term_timer.config import CUBE_METHOD
4545
from term_timer.config import CUBE_ORIENTATION
46+
from term_timer.config import CUBE_PALETTE
4647
from term_timer.constants import CUBE_SIZES
4748
from term_timer.constants import MS_TO_NS_FACTOR
4849
from term_timer.constants import PAUSE_FACTOR
@@ -1223,8 +1224,9 @@ class CubeImageView(View):
12231224
"""View for displaying a cube in SVG."""
12241225

12251226
def __init__(self, algorithm: str, case: str, # noqa: PLR0913, PLR0917
1226-
size: str, cube_size: str, rotation: str,
1227-
orientation: str) -> None:
1227+
size: str, cube_size: str,
1228+
view: str, mask: str,
1229+
rotation: str, orientation: str) -> None:
12281230
"""
12291231
Initialize algorithm image view.
12301232
@@ -1243,6 +1245,8 @@ def __init__(self, algorithm: str, case: str, # noqa: PLR0913, PLR0917
12431245

12441246
self.size = (size and int(size)) or 200
12451247
self.cube_size = (cube_size and int(cube_size)) or 3
1248+
self.view = view or '3d'
1249+
self.mask = mask
12461250
self.rotation = rotation or 'y45x-34'
12471251
self.orientation = orientation or CUBE_ORIENTATION
12481252

@@ -1264,7 +1268,10 @@ def as_view(self, _debug: bool) -> str: # noqa: FBT001
12641268
self.algorithm,
12651269
size=self.size,
12661270
cube_size=self.cube_size,
1271+
view=self.view,
1272+
mask=self.mask,
12671273
rotation=self.rotation,
1274+
palette_name=CUBE_PALETTE,
12681275
)
12691276

12701277

@@ -1284,24 +1291,32 @@ class AcademyView(View):
12841291
'First Two Layers - '
12851292
'Solve cross and first two layers simultaneously'
12861293
),
1294+
'view': '3d',
1295+
'mask': 'f2l',
12871296
},
12881297
'OLL': {
12891298
'description': (
12901299
'Orientation of Last Layer - '
12911300
'Orient all pieces on the last layer'
12921301
),
1302+
'view': 'top',
1303+
'mask': 'oll',
12931304
},
12941305
'PLL': {
12951306
'description': (
12961307
'Permutation of Last Layer - '
12971308
'Permute all pieces on the last layer'
12981309
),
1310+
'view': 'top',
1311+
'mask': 'pll',
12991312
},
13001313
'AF2L': {
13011314
'description': (
13021315
'Advanced First Two Layers - '
13031316
'Solve first two layers with advanced techniques.'
13041317
),
1318+
'view': '3d',
1319+
'mask': 'af2l',
13051320
},
13061321
},
13071322
},
@@ -1317,12 +1332,16 @@ class AcademyView(View):
13171332
'Corners of last layer - '
13181333
'Solve of corner orientations and permutations'
13191334
),
1335+
'view': '3d',
1336+
'mask': '',
13201337
},
13211338
'LSE': {
13221339
'description': (
13231340
'Last Six Edges - '
13241341
'Solve M-slice centers and edges together'
13251342
),
1343+
'view': '3d',
1344+
'mask': '',
13261345
},
13271346
},
13281347
},
@@ -1337,12 +1356,16 @@ class AcademyView(View):
13371356
'Orientation of Last Layer - '
13381357
'Orient all pieces on the last layer'
13391358
),
1359+
'view': 'top',
1360+
'mask': 'oll',
13401361
},
13411362
'PBL': {
13421363
'description': (
13431364
'Permutation of Both Layers - '
13441365
'Orient all pieces on all layers'
13451366
),
1367+
'view': '3d',
1368+
'mask': '',
13461369
},
13471370
},
13481371
},
@@ -1632,6 +1655,8 @@ def cube_image() -> str:
16321655
request.GET.case,
16331656
request.GET.size,
16341657
request.GET.cube_size,
1658+
request.GET.view,
1659+
request.GET.mask,
16351660
request.GET.rotation,
16361661
request.GET.o,
16371662
).as_view(debug)

term_timer/server/templates/academy/step.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h3>
4848
</div>
4949

5050
<div class="case-img">
51-
<img src="/cube/?case={{ case.main_algorithm }}&o={{ orientation_faces }}">
51+
<img src="/cube/?case={{ case.main_algorithm }}&cube_size={{ cube_size }}&o={{ orientation_faces }}&view={{ step_info.view }}&mask={{ step_info.mask }}">
5252
</div>
5353

5454
<div class="case-algorithm">

0 commit comments

Comments
 (0)