-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
68 lines (58 loc) · 2.28 KB
/
main.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# External imports
from kivy.app import App
from kivy.properties import (
ObjectProperty,StringProperty,NumericProperty
)
from kivy.uix.widget import Widget
from kivy.uix.image import Image
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
# Project imports
from db_func import *
#Start up the Root window and set initial screen
#We'll change this based on user permissions later
class LARPyRoot(BoxLayout):
menu_list={}
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.show_menu(menu="admin") #create splash screen(will be login later)
def show_menu(self, **kwargs):
#This code should be moved to more appropriate places as they are
#created. It's likely we'll have multiple character "tabs" for example
#or possibly multiple "game" tabs with multiple user
if "menu" in kwargs:
if kwargs["menu"] == "admin":
if not "admin" in self.menu_list:
cur_menu=AdminPanel()
self.menu_list.update({"admin" : cur_menu})
else:
cur_menu=self.menu_list["admin"]
elif kwargs["menu"] == "user":
if not "user" in self.menu_list:
cur_menu=UserPanel()
self.menu_list.update({"user":cur_menu})
else:
cur_menu=self.menu_list["user"]
elif kwargs["menu"] == "character":
if not "character" in self.menu_list:
cur_menu=CharacterPanel()
self.menu_list.update({"character":cur_menu})
else:
cur_menu=self.menu_list["character"]
self.add_widget(cur_menu)
# This menu is the initial admin layout. This is going to be fix with
# choices of user mofification(Add, remove, reset), create/remove game,
# backup, at this time the whole backend hasn't been created
class AdminPanel(BoxLayout):
def game_create(self):
game_create()
# class Login(GridLayout):
# pass
class LARPyApp(App):
def build(self):
larpy_main=LARPyRoot()
return larpy_main
def quit(self):
quit()
if __name__ == "__main__":
LARPyApp().run()