|
@@ -294,59 +294,24 @@ def printProjectsMenu():
|
294
|
294
|
|
295
|
295
|
print("</ul>")
|
296
|
296
|
|
297
|
|
-def print3DPrintingMenu():
|
298
|
|
- mpages = [p for p in pages if p.get("parent", "") == "3d-printing" and p.lang == "en"]
|
299
|
|
- mpages.sort(key=lambda p: int(p["position"]))
|
300
|
|
-
|
301
|
|
- print("<ul id='menulist'>")
|
302
|
|
- for p in mpages:
|
303
|
|
- printMenuItem(p, False, True, True)
|
304
|
|
- print("</ul>")
|
305
|
|
-
|
306
|
|
-def printInputDevicesMenu():
|
307
|
|
- mpages = [p for p in pages if p.get("parent", "") == "input_devices" and p.lang == "en"]
|
308
|
|
- mpages.sort(key=lambda p: [p.get("date", "9999-01-01")], reverse = True)
|
309
|
|
-
|
310
|
|
- print("<ul id='menulist'>")
|
311
|
|
- for p in mpages:
|
312
|
|
- printMenuItem(p, False, True, True)
|
313
|
|
- print("</ul>")
|
314
|
|
-
|
315
|
|
-def printInputDevicesRelatedMenu():
|
316
|
|
- mpages = [p for p in pages if p.get("show_in_input_devices", "false") == "true"]
|
317
|
|
- mpages.sort(key=lambda p: [p.get("date", "9999-01-01")], reverse = True)
|
318
|
|
-
|
319
|
|
- print("<ul id='menulist'>")
|
320
|
|
- for p in mpages:
|
321
|
|
- printMenuItem(p, False, True, True)
|
322
|
|
- print("</ul>")
|
323
|
|
-
|
324
|
|
-def printSmarthomeMenu():
|
325
|
|
- mpages = [p for p in pages if p.get("parent", "") == "smarthome" and p.lang == "en"]
|
326
|
|
- mpages.sort(key=lambda p: int(p["position"]))
|
327
|
|
-
|
328
|
|
- print("<ul id='menulist'>")
|
329
|
|
- for p in mpages:
|
330
|
|
- printMenuItem(p, False, True, True)
|
331
|
|
- print("</ul>")
|
332
|
|
-
|
333
|
|
-def printQuadcopterMenu():
|
334
|
|
- mpages = [p for p in pages if p.get("parent", "") == "quadcopters" and p.lang == "en"]
|
335
|
|
- mpages.sort(key=lambda p: int(p["position"]))
|
336
|
|
-
|
337
|
|
- print("<ul id='menulist'>")
|
338
|
|
- for p in mpages:
|
339
|
|
- printMenuItem(p, False, True, True)
|
340
|
|
- print("</ul>")
|
341
|
|
-
|
342
|
|
-def printQuadcopterRelatedMenu():
|
343
|
|
- mpages = [p for p in pages if p.get("show_in_quadcopters", "false") == "true"]
|
344
|
|
- mpages.sort(key=lambda p: [p.get("date", "9999-01-01")], reverse = True)
|
345
|
|
-
|
346
|
|
- print("<ul id='menulist'>")
|
347
|
|
- for p in mpages:
|
348
|
|
- printMenuItem(p, False, True, True)
|
349
|
|
- print("</ul>")
|
|
297
|
+def printMenu(mpages = None, sortKey = None, sortReverse = True):
|
|
298
|
+ if mpages == None:
|
|
299
|
+ mpages = [p for p in pages if p.get("parent", "__none__") == page["child-id"] and p.lang == "en"]
|
|
300
|
+ if sortKey != None:
|
|
301
|
+ mpages.sort(key = sortKey, reverse = sortReverse)
|
|
302
|
+
|
|
303
|
+ if len(mpages) > 0:
|
|
304
|
+ print("<ul id='menulist'>")
|
|
305
|
+ for p in mpages:
|
|
306
|
+ printMenuItem(p, False, True, True)
|
|
307
|
+ print("</ul>")
|
|
308
|
+
|
|
309
|
+def printMenuDate(mpages = None, sortReverse = True):
|
|
310
|
+ sortKey = lambda p: p["date"]
|
|
311
|
+ printMenu(mpages, sortKey, sortReverse)
|
|
312
|
+
|
|
313
|
+def printMenuPositional(mpages = None):
|
|
314
|
+ printMenu(mpages, lambda p: int(p["position"]), False)
|
350
|
315
|
|
351
|
316
|
def printRobotMenuEnglish():
|
352
|
317
|
mpages = [p for p in pages if p.get("parent", "") == "xyrobot" and p.lang == "en"]
|