Commit 790ff258 authored by cse's avatar cse
Browse files

Finished up the Canes ordering app

parent 1f0ddda5
from kivy.app import App
from kivy.modules import inspector # For inspection.
from kivy.core.window import Window # For inspection.
from kivy.properties import BooleanProperty, NumericProperty
__app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal'
......@@ -9,10 +11,86 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l
class OrderApp(App):
total = NumericProperty(0.00)
price_2_strips = NumericProperty(4.99)
price_3_strips = NumericProperty(6.50)
price_4_strips = NumericProperty(7.99)
price_6_strips = NumericProperty(10.99)
price_sandwitch = NumericProperty(7.99)
price_25_strips = NumericProperty(19.99)
price_50_strips = NumericProperty(38.99)
price_75_strips = NumericProperty(56.99)
price_100_strips = NumericProperty(69.99)
price_jug_of_lemonade = NumericProperty(2.99)
price_jug_of_icedtea = NumericProperty(2.99)
price_extra_sauce = NumericProperty(.99)
price_extra_drink = NumericProperty(2.39)
price_extra_fries = NumericProperty(2.99)
toast_no_slaw_disabled = BooleanProperty(False)
slaw_no_toast_disabled = BooleanProperty(False)
msg = 'Place Order \n Total: $'
def build(self):
inspector.create_inspector(Window, self) # For inspection (press control-e to toggle).
def two_strips(self):
self.total += self.price_2_strips
def three_strips(self):
self.total += self.price_3_strips
def four_strips(self):
self.total += self.price_4_strips
def six_strips(self):
self.total += self.price_6_strips
def sandwitch(self):
self.total += self.price_sandwitch
def twenty5_strips(self):
self.total += self.price_25_strips
def fifty_strips(self):
self.total += self.price_50_strips
def seventy5_strips(self):
self.total += self.price_75_strips
def hundred_strips(self):
self.total += self.price_100_strips
def lemonade(self):
self.total += self.price_jug_of_lemonade
def icedtea(self):
self.total += self.price_jug_of_icedtea
def sauce(self):
self.total += self.price_extra_sauce
def drink(self):
self.total += self.price_extra_drink
def fries(self):
self.total += self.price_extra_fries
def extra_toast(self):
self.slaw_no_toast_disabled = BooleanProperty(True)
def extra_slaw(self):
self.toast_no_slaw_disabled = BooleanProperty(True)
def reset(self):
self.total = 0.00
self.toast_no_slaw_disabled = False
self.slaw_no_toast_disabled = False
def placed_order(self):
pass #would actually place an order if this were a real thing
if __name__ == '__main__':
app = OrderApp()
app.run()
BoxLayout:
orientation: 'vertical'
Label:
text: '[Your meal-ordering GUI here]'
BoxLayout:
size_hint_y: .2
Label:
text: 'Canes Chicken'
font_size: '50sp'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Label:
font_size: '20sp'
text: 'Meals'
Button:
size_hint: (1, 0.6)
text: '2 Chicken Strips'
on_press: app.two_strips()
Button:
size_hint: (1, 0.6)
text: '3 Chicken Strips'
on_press: app.three_strips()
Button:
size_hint: (1, 0.6)
text: '4 Chicken Strips'
on_press: app.four_strips()
Button:
size_hint: (1, 0.6)
text: '6 Chicken Strips'
on_press: app.six_strips()
Button:
size_hint: (1, 0.6)
text: 'Chicken Strip Sandwitch'
on_press: app.sandwitch()
BoxLayout:
orientation: 'vertical'
Label:
font_size: '20sp'
text: 'Tailgating'
Button:
size_hint: (1, 0.6)
text: '25 Chicken Strips'
on_press: app.twenty5_strips()
Button:
size_hint: (1, 0.6)
text: '50 Chicken Strips'
on_press: app.fifty_strips()
Button:
size_hint: (1, 0.6)
text: '75 Chicken Strips'
on_press: app.seventy5_strips()
Button:
size_hint: (1, 0.6)
text: '100 Chicken Strips'
on_press: app.hundred_strips()
Button:
size_hint: (1, 0.3)
text: 'Jug of Lemonade'
on_press: app.lemonade()
Button:
size_hint: (1, 0.3)
text: 'Jug of Iced Tea'
on_press: app.icedtea()
BoxLayout:
orientation: 'vertical'
Label:
font_size: '20sp'
text: 'Extras'
Button:
size_hint: (1, 0.6)
text: 'Two coleslaw'
on_press: app.extra_slaw()
disabled: app.slaw_no_toast_disabled
Button:
size_hint: (1, 0.6)
text: 'Two pieces of toast'
disabled: app.toast_no_slaw_disabled
on_press: app.extra_toast()
Button:
size_hint: (1, 0.6)
text: 'Extra sauce'
on_press: app.sauce()
Button:
size_hint: (1, 0.6)
text: 'Extra drinks'
on_press: app.drink()
Button:
size_hint: (1, 0.6)
text: 'Extra fries'
on_press: app.fries()
BoxLayout:
size_hint: (1, 0.2)
orientation: 'horizontal'
Button:
text: 'Reset'
on_press: app.reset()
Button:
on_press: app.placed_order()
text: app.msg + str(app.total)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment