summaryrefslogtreecommitdiff
path: root/play.py
blob: 4b25e3290ba82945c60f0574e104828125e0cbd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import subprocess
import os

if not os.path.exists(os.path.join(os.getcwd(), 'games.db')): 
	subprocess.run(['python', 'crt_db.py'])

from load_nav import *

menu_tree = [None, None, mm_menu]

while True:

	# if next item is the previous item, remove next item and current item and load the previous item
	if menu_tree[-1] == menu_tree[-3]:
		menu_tree.pop(-1)
		menu_tree.pop(-1)

	if menu_tree[-1] == None:
		# quit program
		break
	elif type(menu_tree[-1]) is Launcher:
		menu_tree[-1].launch()
		menu_tree.pop(-1)
	elif type(menu_tree[-1]) is Menu:
		menu_tree[-1].open(prev_menu=menu_tree[-2])
		menu_tree[-1].clear()
		menu_tree.append(menu_tree[-1].next_item)