-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNavBar.py
More file actions
49 lines (40 loc) · 1.87 KB
/
NavBar.py
File metadata and controls
49 lines (40 loc) · 1.87 KB
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
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
class NavBar(BoxLayout):
def __init__(self, sm, **kwargs):
super().__init__(**kwargs)
self.__setattr__("size_hint",[1,0.1])
self.sm = sm
def main_navbar(self,lst):
calendar_button = Button(text="Calendar")
calendar_button.bind(on_release=self.switch_to(lst[0].create_page()))
calendar_button.bind(on_release=lst[0].update)
character_button = Button(text="Character")
character_button.bind(on_release=self.switch_to(lst[1]))
character_button.bind(on_release=lst[1].refresh_widget)
journal_button = Button(text="Journal")
journal_button.bind(on_release=self.switch_to(lst[2]))
quest_button = Button(text="Quest")
quest_button.bind(on_release=self.switch_to(lst[3]))
shop_button = Button(text="Shop")
shop_button.bind(on_release=self.switch_to(lst[4]))
self.add_widget(calendar_button)
self.add_widget(character_button)
self.add_widget(journal_button)
self.add_widget(quest_button)
self.add_widget(shop_button)
return self
def calender_navbar(self, page):
box_layout = BoxLayout(size_hint=[1, 0.1])
new_event_btn = Button(text="+", pos_hint={'right': 1}, size_hint=[0.15, 1])
new_event_btn.bind(on_release=self.switch_to(page))
box_layout.add_widget(Button(text="<", pos_hint={'left': 1}, size_hint=[0.15, 1]))
box_layout.add_widget(Label(text="What week are we in?", pos_hint={'center': 1}))
box_layout.add_widget(new_event_btn)
box_layout.add_widget(Button(text=">", pos_hint={'right': 1}, size_hint=[0.15, 1]))
return box_layout
def switch_to(self,arg):
def callback(instance):
self.sm.switch_to(arg)
return callback