Guest User

Untitled

a guest
Jun 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. import ui
  4.  
  5. def calculate(sender):
  6. result = 0.00
  7. total = sender.superview['total_label']
  8. result = switch_on_off(sender,result)
  9. total.text = str(result*1.08)
  10.  
  11. def reset(sender):
  12. result = 0.00
  13. total = sender.superview['total_label']
  14. total.text = str(result*1.08)
  15. switch11 = sender.superview['switch11']
  16. switch12 = sender.superview['switch12']
  17. switch13 = sender.superview['switch13']
  18. switch14 = sender.superview['switch14']
  19. switch15 = sender.superview['switch15']
  20. switch16 = sender.superview['switch16']
  21. switch11.value = 0
  22. switch12.value = 0
  23. switch13.value = 0
  24. switch14.value = 0
  25. switch15.value = 0
  26. switch16.value = 0
  27. switch21 = sender.superview['switch21']
  28. switch22 = sender.superview['switch22']
  29. switch23 = sender.superview['switch23']
  30. switch24 = sender.superview['switch24']
  31. switch25 = sender.superview['switch25']
  32. switch26 = sender.superview['switch26']
  33. switch21.value = 0
  34. switch22.value = 0
  35. switch23.value = 0
  36. switch24.value = 0
  37. switch25.value = 0
  38. switch26.value = 0
  39. switch31 = sender.superview['switch31']
  40. switch32 = sender.superview['switch32']
  41. switch33 = sender.superview['switch33']
  42. switch34 = sender.superview['switch34']
  43. switch35 = sender.superview['switch35']
  44. switch36 = sender.superview['switch36']
  45. switch31.value = 0
  46. switch32.value = 0
  47. switch33.value = 0
  48. switch34.value = 0
  49. switch35.value = 0
  50. switch36.value = 0
  51. switch41 = sender.superview['switch41']
  52. switch42 = sender.superview['switch42']
  53. switch43 = sender.superview['switch43']
  54. switch44 = sender.superview['switch44']
  55. switch45 = sender.superview['switch45']
  56. switch46 = sender.superview['switch46']
  57. switch41.value = 0
  58. switch42.value = 0
  59. switch43.value = 0
  60. switch44.value = 0
  61. switch45.value = 0
  62. switch46.value = 0
  63.  
  64. def switch_on_off(sender,result):
  65. #sswitch 1
  66. switch11 = sender.superview['switch11']
  67. switch12 = sender.superview['switch12']
  68. switch13 = sender.superview['switch13']
  69. switch14 = sender.superview['switch14']
  70. switch15 = sender.superview['switch15']
  71. switch16 = sender.superview['switch16']
  72. if switch11.value:
  73. result += 80.0
  74. if switch12.value:
  75. result += (80.0 * 2)
  76. #print_result(result,total)
  77. if switch13.value:
  78. result += (80.0 * 3)
  79. #print_result(result,total)
  80. if switch14.value:
  81. result += (80.0 * 4)
  82. #print_result(result,total)
  83. if switch15.value:
  84. result += (80.0 * 5)
  85. #print_result(result,total)
  86. if switch16.value:
  87. result += (80.0 * 6)
  88. #print_result(result,total)
  89. #sswitch 2
  90. switch21 = sender.superview['switch21']
  91. switch22 = sender.superview['switch22']
  92. switch23 = sender.superview['switch23']
  93. switch24 = sender.superview['switch24']
  94. switch25 = sender.superview['switch25']
  95. switch26 = sender.superview['switch26']
  96. if switch21.value:
  97. result += 100.0
  98. #print_result(result,total)
  99. if switch22.value:
  100. result += (100.0 * 2)
  101. #print_result(result,total)
  102. if switch23.value:
  103. result += (100.0 * 3)
  104. #print_result(result,total)
  105. if switch24.value:
  106. result += (100.0 * 4)
  107. #print_result(result,total)
  108. if switch25.value:
  109. result += (100.0 * 5)
  110. #print_result(result,total)
  111. if switch26.value:
  112. result += (100.0 * 6)
  113. #print_result(result,total)
  114. #sswitch 3
  115. switch31 = sender.superview['switch31']
  116. switch32 = sender.superview['switch32']
  117. switch33 = sender.superview['switch33']
  118. switch34 = sender.superview['switch34']
  119. switch35 = sender.superview['switch35']
  120. switch36 = sender.superview['switch36']
  121. if switch31.value:
  122. result += 140.0
  123. #print_result(result,total)
  124. if switch32.value:
  125. result += (140.0 * 2)
  126. #print_result(result,total)
  127. if switch33.value:
  128. result += (140.0 * 3)
  129. #print_result(result,total)
  130. if switch34.value:
  131. result += (140.0 * 4)
  132. #print_result(result,total)
  133. if switch35.value:
  134. result += (140.0 * 5)
  135. #print_result(result,total)
  136. if switch36.value:
  137. result += (140.0 * 6)
  138. #print_result(result,total)
  139. #sswitch 4
  140. switch41 = sender.superview['switch41']
  141. switch42 = sender.superview['switch42']
  142. switch43 = sender.superview['switch43']
  143. switch44 = sender.superview['switch44']
  144. switch45 = sender.superview['switch45']
  145. switch46 = sender.superview['switch46']
  146. if switch41.value:
  147. result += 170.0
  148. #print_result(result,total)
  149. if switch42.value:
  150. result += (170.0 * 2)
  151. #print_result(result,total)
  152. if switch43.value:
  153. result += (170.0 * 3)
  154. #print_result(result,total)
  155. if switch44.value:
  156. result += (170.0 * 4)
  157. #print_result(result,total)
  158. if switch45.value:
  159. result += (170.0 * 5)
  160. #print_result(result,total)
  161. if switch46.value:
  162. result += (170.0 * 6)
  163. #print_result(result,total)
  164. return result
  165.  
  166. v = ui.load_view('sushi')
  167. if min(ui.get_screen_size()) >= 768:
  168. # iPad
  169. v.frame = (0, 0, 480, 320)
  170. v.present('sheet')
  171. else:
  172. # iPhone
  173. v.present(orientations=['portrait'])
Add Comment
Please, Sign In to add comment