Guest User

paint.kv

a guest
Mar 19th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. #:import C kivy.utils.get_color_from_hex
  2. #: import FadeTransition kivy.uix.screenmanager.FadeTransition
  3.  
  4. AppScreenManager:
  5. transition: FadeTransition()
  6. LoginScreen:
  7. ActivitySelectScreen:
  8. PaintApp:
  9.  
  10. <LoginScreen>:
  11. name: "LoginScreen"
  12. BoxLayout:
  13. orientation: 'vertical'
  14. padding: [200,75,200,75]
  15. spacing: 20
  16. Label:
  17. text:"Username:"
  18. font_size:25
  19. TextInput:
  20. id:username
  21. font_size:35
  22. Label:
  23. text:"Password:"
  24. font_size:25
  25. TextInput:
  26. id:password
  27. font_size:35
  28. password:True
  29. BoxLayout:
  30. orientation: 'horizontal'
  31. Button:
  32. border: (3, 3, 3, 3)
  33. spacing: 20
  34. text:"Login"
  35. font_size:25
  36. bold: True
  37. on_release: root.autheciate()
  38. Button:
  39. text:"Create Account"
  40. border: (3, 3, 3, 3)
  41. font_size:25
  42. spacing: 20
  43. bold: True
  44. on_release: root.create_account()
  45. <ActivitySelectScreen>:
  46. name:"ActivitySelectScreen"
  47. BoxLayout:
  48. orientation: 'vertical'
  49. padding: [225,200,225,200]
  50. spacing: 10
  51. orientation: 'vertical'
  52. Button:
  53. border: (3, 3, 3, 3)
  54. text:"Start Server"
  55. font_size:25
  56. height: 70
  57. bold: True
  58. on_release: app.root.current= 'PaintApp';app.root.get_screen('PaintApp').ids.canvas_widget.start_server()
  59. Button:
  60. border: (3, 3, 3, 3)
  61. text:"Connect to Server"
  62. font_size:25
  63. height: 40
  64. bold: True
  65. on_release: app.root.current= 'PaintApp';app.root.get_screen('PaintApp').ids.canvas_widget.server_username_popup()
  66. Button:
  67. border: (3, 3, 3, 3)
  68. text:"Back"
  69. font_size:25
  70. height: 40
  71. bold: True
  72. on_release: app.root.current= 'LoginScreen'
  73.  
  74.  
  75. <RadioButton>
  76. border: (3, 3, 3, 3)
  77.  
  78.  
  79. <ColorButton@RadioButton>:
  80. group: 'color'
  81. background_normal: 'color_button_normal.png'
  82. background_down: 'color_button_down.png'
  83.  
  84.  
  85. <LineWidthButton@RadioButton>:
  86. group: 'line_width'
  87.  
  88. <PaintApp>:
  89. name: "PaintApp"
  90. BoxLayout:
  91. orientation:'vertical'
  92. CanvasWidget:
  93. id: canvas_widget
  94. size_hint_y:.95
  95. BoxLayout:
  96. size_hint:(1,None)
  97. size_hint_y:.05
  98. orientation: 'horizontal'
  99. Button:
  100. text: 'Exit'
  101. on_release: canvas_widget.delete_server();app.stop()
  102. right: root.right -80
  103. top: root.top
  104. width: 80
  105. height: 40
  106. Button:
  107. text: 'Save'
  108. on_release: canvas_widget.save()
  109. right: root.right
  110. top: root.top
  111. width: 80
  112. height: 40
  113.  
  114. LineWidthButton:
  115. text: 'Thin'
  116. on_release:canvas_widget.line_width=1
  117. LineWidthButton:
  118. text: 'Normal'
  119. state: 'down'
  120. on_release:canvas_widget.line_width=2
  121. LineWidthButton:
  122. text: 'Thick'
  123. on_release:canvas_widget.line_width=4
  124.  
  125. ColorButton:
  126. background_color: C('#2980b9')
  127.  
  128. on_release: canvas_widget.set_color(self.background_color)
  129.  
  130. ColorButton:
  131. background_color: C('#16a085')
  132. state: 'down'
  133. on_release: canvas_widget.set_color(self.background_color)
  134.  
  135. ColorButton:
  136. background_color: C('#27ae60')
  137. on_release: canvas_widget.set_color(self.background_color)
  138.  
  139. ColorButton:
  140. background_color: C('#f39c12')
  141. on_release: canvas_widget.set_color(self.background_color)
  142.  
  143. ColorButton:
  144. background_color: C('#d35400')
  145. on_release: canvas_widget.set_color(self.background_color)
  146.  
  147. ColorButton:
  148. background_color: C('#c0392b')
  149. on_release: canvas_widget.set_color(self.background_color)
  150.  
  151. ColorButton:
  152. background_color: C('#8e44ad')
  153. on_release: canvas_widget.set_color(self.background_color)
  154.  
  155. ColorButton:
  156. background_color: C('#bdc3c7')
  157. on_release: canvas_widget.set_color(self.background_color)
  158.  
  159. ColorButton:
  160. background_color: C('#7f8c8d')
  161. on_release: canvas_widget.set_color(self.background_color)
  162.  
  163. ColorButton:
  164. background_color: C('#2c3e50')
  165. on_release: canvas_widget.set_color(self.background_color)
  166.  
  167. Button:
  168. text: 'Delete'
  169. on_release: canvas_widget.clear_canvas()
  170. right: root.right
  171. top: root.top
  172. width: 80
  173. height: 40
Add Comment
Please, Sign In to add comment