Advertisement
Guest User

kv file

a guest
May 11th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. #: import FadeTransition kivy.uix.screenmanager.FadeTransition
  2.  
  3. #:kivy 1.9.1
  4. # main.py
  5.  
  6. ScreenManagement:
  7. transition: FadeTransition()
  8.  
  9. MainScreen:
  10. CategorySelectScreen:
  11. DictScreen:
  12.  
  13. ## GŁÓWNY EKRAN
  14. <MainScreen>:
  15. name: "main"
  16. canvas:
  17. ## RYSOWANIE BIAŁEGO TŁA ##
  18. Color:
  19. rgb: (1, 1, 1)
  20. Rectangle:
  21. pos: self.pos
  22. size: self.size
  23.  
  24. ## PRZYCISK START
  25. Button:
  26. background_color: (1.0, 0.0, 0.0, 1.0)
  27. text: "Start"
  28. on_release: app.root.current = "categoryscreen"
  29. size_hint: .2, .1
  30. pos_hint: {"center_x":.5, 'center_y':.5}
  31.  
  32. ## EKRAN WYBORU KATEGORII
  33. <CategorySelectScreen>:
  34. name: "categoryscreen"
  35.  
  36. canvas:
  37. ## RYSOWANIE BIAŁEGO TŁA ##
  38. Color:
  39. rgb: (1, 1, 1)
  40. Rectangle:
  41. pos: self.pos
  42. size: self.size
  43.  
  44. BoxLayout:
  45. orientation:"vertical"
  46. Label:
  47. id: category_screen_title_label
  48. text:"Wybierz kategorię"
  49. color: 0,0,0,1
  50. size_hint: 1, 0.1
  51. font_size: sp(25)
  52.  
  53. ## SPORT ##
  54. Button:
  55. background_color: (1.0, 0.0, 0.0, 1.0)
  56. text: "Sport"
  57. on_release:
  58. root.selected = "Sport"
  59. app.root.current = "dict"
  60. size_hint: None,None
  61. pos_hint: {"center_x":.5, 'center_y':.5}
  62.  
  63. ## FOOD ##
  64. Button:
  65. background_color: (1.0, 0.0, 0.0, 1.0)
  66. text: "Food"
  67. on_release:
  68. root.selected = "Food"
  69. app.root.current = "dict"
  70. size_hint: None,None
  71. pos_hint: {"center_x":.5, 'center_y':.5}
  72.  
  73. ## EKRAN SŁOWNIKA
  74. <DictScreen>:
  75. name: "dict"
  76. canvas:
  77. ## RYSOWANIE BIAŁEGO TŁA ##
  78. Color:
  79. rgb: (1, 1, 1)
  80. Rectangle:
  81. pos: self.pos
  82. size: self.size
  83.  
  84. ## wybrana kategoria
  85. current_category:root.manager.get_screen('categoryscreen').selected
  86. selected_objects:root.CategorySelect(root.objects,root.current_category)
  87.  
  88. BoxLayout: ## główny kontener
  89. orientation:'vertical'
  90.  
  91. ## KATEGORIA
  92. Label:
  93. id: categoryname_label
  94. text:root.ChangeCategory(root.selected_objects,root.index)
  95. color: 0,0,0,1
  96. size_hint: 1, 0.2
  97. font_size: sp(50)
  98.  
  99. ## OBRAZEK
  100. Image:
  101. id: item_image
  102. source: root.ChangeImage(root.selected_objects,root.index)
  103. keep_ratio: True
  104. allow_stretch: True
  105. pos_hint: {"center_x":.5}
  106. size_hint: 0.9, 0.8
  107.  
  108. ## NAZWA
  109. Label:
  110. id: name_label
  111. text:root.ChangeLabel(root.selected_objects,root.index)
  112. color: 0,0,0,1
  113. size_hint: 1, 0.1
  114. font_size: sp(25)
  115.  
  116. ## LICZNIK
  117. Label:
  118. id: counter_label
  119. text:"("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
  120. color: 0,0,0,1
  121. size_hint: 1, 0.1
  122. font_size: sp(15)
  123.  
  124. ## DOLNY PANEL Z PRZYCISKAMI
  125. BoxLayout:
  126. size_hint: 1,0.2
  127. orientation:'horizontal'
  128. FloatLayout:
  129. pos_hint:{"right":1}
  130. ## COFNIJ DO MENU
  131. Button:
  132. id: back_button
  133. background_normal:'data/img/leftarrow.png'
  134. background_down:'data/img/leftarrow.png'
  135. background_color:1,0,0,1
  136. border: 1,1,1,1
  137. on_release: app.root.current = "main"
  138. size_hint: 0.1,.5
  139.  
  140. BoxLayout:
  141. pos_hint:{"right":1}
  142. size_hint:0.2,.5
  143. orientation:'horizontal'
  144. ## POPRZEDNI ELEMENT
  145. Button:
  146. id: prev_button
  147. on_release:
  148. root.index=root.PrevItem(root.selected_objects,root.index)
  149. item_image.source=root.ChangeImage(root.selected_objects,root.index)
  150. name_label.text=root.ChangeLabel(root.selected_objects,root.index)
  151. categoryname_label.text=root.ChangeCategory(root.selected_objects,root.index)
  152. counter_label.text="("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
  153. background_normal:'data/img/leftarrow.png'
  154. background_down:'data/img/leftarrow.png'
  155. border: 1,1,1,1
  156.  
  157. ## NASTĘPNY ELEMENT
  158. Button:
  159. id: next_button
  160. on_release:
  161. root.index=root.NextItem(root.selected_objects,root.index)
  162. item_image.source=root.ChangeImage(root.selected_objects,root.index)
  163. name_label.text=root.ChangeLabel(root.selected_objects,root.index)
  164. categoryname_label.text=root.ChangeCategory(root.selected_objects,root.index)
  165. counter_label.text="("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
  166. background_normal:'data/img/rightarrow.png'
  167. background_down:'data/img/rightarrow.png'
  168. border: 1,1,1,1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement