Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- import ui
- def calculate(sender):
- result = 0.00
- total = sender.superview['total_label']
- result = switch_on_off(sender,result)
- total.text = str(result*1.08)
- def reset(sender):
- result = 0.00
- total = sender.superview['total_label']
- total.text = str(result*1.08)
- switch11 = sender.superview['switch11']
- switch12 = sender.superview['switch12']
- switch13 = sender.superview['switch13']
- switch14 = sender.superview['switch14']
- switch15 = sender.superview['switch15']
- switch16 = sender.superview['switch16']
- switch11.value = 0
- switch12.value = 0
- switch13.value = 0
- switch14.value = 0
- switch15.value = 0
- switch16.value = 0
- switch21 = sender.superview['switch21']
- switch22 = sender.superview['switch22']
- switch23 = sender.superview['switch23']
- switch24 = sender.superview['switch24']
- switch25 = sender.superview['switch25']
- switch26 = sender.superview['switch26']
- switch21.value = 0
- switch22.value = 0
- switch23.value = 0
- switch24.value = 0
- switch25.value = 0
- switch26.value = 0
- switch31 = sender.superview['switch31']
- switch32 = sender.superview['switch32']
- switch33 = sender.superview['switch33']
- switch34 = sender.superview['switch34']
- switch35 = sender.superview['switch35']
- switch36 = sender.superview['switch36']
- switch31.value = 0
- switch32.value = 0
- switch33.value = 0
- switch34.value = 0
- switch35.value = 0
- switch36.value = 0
- switch41 = sender.superview['switch41']
- switch42 = sender.superview['switch42']
- switch43 = sender.superview['switch43']
- switch44 = sender.superview['switch44']
- switch45 = sender.superview['switch45']
- switch46 = sender.superview['switch46']
- switch41.value = 0
- switch42.value = 0
- switch43.value = 0
- switch44.value = 0
- switch45.value = 0
- switch46.value = 0
- def switch_on_off(sender,result):
- #sswitch 1
- switch11 = sender.superview['switch11']
- switch12 = sender.superview['switch12']
- switch13 = sender.superview['switch13']
- switch14 = sender.superview['switch14']
- switch15 = sender.superview['switch15']
- switch16 = sender.superview['switch16']
- if switch11.value:
- result += 80.0
- if switch12.value:
- result += (80.0 * 2)
- #print_result(result,total)
- if switch13.value:
- result += (80.0 * 3)
- #print_result(result,total)
- if switch14.value:
- result += (80.0 * 4)
- #print_result(result,total)
- if switch15.value:
- result += (80.0 * 5)
- #print_result(result,total)
- if switch16.value:
- result += (80.0 * 6)
- #print_result(result,total)
- #sswitch 2
- switch21 = sender.superview['switch21']
- switch22 = sender.superview['switch22']
- switch23 = sender.superview['switch23']
- switch24 = sender.superview['switch24']
- switch25 = sender.superview['switch25']
- switch26 = sender.superview['switch26']
- if switch21.value:
- result += 100.0
- #print_result(result,total)
- if switch22.value:
- result += (100.0 * 2)
- #print_result(result,total)
- if switch23.value:
- result += (100.0 * 3)
- #print_result(result,total)
- if switch24.value:
- result += (100.0 * 4)
- #print_result(result,total)
- if switch25.value:
- result += (100.0 * 5)
- #print_result(result,total)
- if switch26.value:
- result += (100.0 * 6)
- #print_result(result,total)
- #sswitch 3
- switch31 = sender.superview['switch31']
- switch32 = sender.superview['switch32']
- switch33 = sender.superview['switch33']
- switch34 = sender.superview['switch34']
- switch35 = sender.superview['switch35']
- switch36 = sender.superview['switch36']
- if switch31.value:
- result += 140.0
- #print_result(result,total)
- if switch32.value:
- result += (140.0 * 2)
- #print_result(result,total)
- if switch33.value:
- result += (140.0 * 3)
- #print_result(result,total)
- if switch34.value:
- result += (140.0 * 4)
- #print_result(result,total)
- if switch35.value:
- result += (140.0 * 5)
- #print_result(result,total)
- if switch36.value:
- result += (140.0 * 6)
- #print_result(result,total)
- #sswitch 4
- switch41 = sender.superview['switch41']
- switch42 = sender.superview['switch42']
- switch43 = sender.superview['switch43']
- switch44 = sender.superview['switch44']
- switch45 = sender.superview['switch45']
- switch46 = sender.superview['switch46']
- if switch41.value:
- result += 170.0
- #print_result(result,total)
- if switch42.value:
- result += (170.0 * 2)
- #print_result(result,total)
- if switch43.value:
- result += (170.0 * 3)
- #print_result(result,total)
- if switch44.value:
- result += (170.0 * 4)
- #print_result(result,total)
- if switch45.value:
- result += (170.0 * 5)
- #print_result(result,total)
- if switch46.value:
- result += (170.0 * 6)
- #print_result(result,total)
- return result
- v = ui.load_view('sushi')
- if min(ui.get_screen_size()) >= 768:
- # iPad
- v.frame = (0, 0, 480, 320)
- v.present('sheet')
- else:
- # iPhone
- v.present(orientations=['portrait'])
Add Comment
Please, Sign In to add comment