-
Notifications
You must be signed in to change notification settings - Fork 8
/
HelpMenu.py
67 lines (53 loc) · 1.66 KB
/
HelpMenu.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
__author__ = 'oddBit'
from kivy.uix.carousel import Carousel
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.properties import StringProperty
from data.gameData import *
Builder.load_string('''
#:kivy 1.8.0
<Page>
orientation: 'vertical'
id: helpPage
BoxLayout:
Image:
source: root.current_image
allow_stretch: True
mipmap: False
keep_ratio: False
anim_delay: 0.5
<HelpMenu>
orientation: 'vertical'
BoxLayout:
size_hint: 1, 0.95
HelpMenuCarousel:
id: carousel
BoxLayout:
size_hint: 1.0, 0.05
Button:
id: backToMainMenu
text: 'Back'
on_release: root.back_to_main_menu()
background_normal: 'assets/graphics/ui/button_normal.png'
background_down: 'assets/graphics/ui/button_down.png'
''')
class Page(BoxLayout):
current_image = StringProperty()
def __init__(self, **kwargs):
super(Page, self).__init__(**kwargs)
def set_current_image(self, image):
self.current_image = image
class HelpMenuCarousel(Carousel):
def __init__(self, **kwargs):
super(HelpMenuCarousel, self).__init__(**kwargs)
for item in help_screens:
page = Page()
page.set_current_image('assets/graphics/ui/' + item + '.png')
self.add_widget(page)
class HelpMenu(BoxLayout):
def __init__(self, **kwargs):
super(HelpMenu, self).__init__(**kwargs)
self.carousel = self.children[1].children[0]
self.back_to_main = False
def back_to_main_menu(self):
self.back_to_main = True