diff --git a/main.py b/main.py index da72251b42c107f3a6068a25195221c752d0d2cc..7ba0e79b74a0b560593c97927525f3ccfadf5c51 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ 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' @@ -12,6 +13,21 @@ class OrderApp(App): def build(self): inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). + price = NumericProperty(11.00) + cheese_price = NumericProperty(0.00) + + def meat_topping(self): + self.price += 1.75 + + def topping(self): + self.price += 1.25 + + def update_cheese(self): + if self.root.ids.cheese_slider.value > 50: + self.cheese_price = 1.50 + else: + self.cheese_price = 0.00 + if __name__ == '__main__': app = OrderApp() diff --git a/order.kv b/order.kv index d23f9746383fbed94ff3e43c6245d396bfd765a5..b48a69b06df93ec354253bf705c89b76daad9829 100644 --- a/order.kv +++ b/order.kv @@ -1,4 +1,85 @@ BoxLayout: orientation: 'vertical' Label: - text: '[Your meal-ordering GUI here]' + text: 'Online Pizza Order' + size_hint: (1, 0.25) + color: (1, 0, 0, 1) + font_size: '32sp' + BoxLayout: + orientation: 'vertical' + Label: + text: 'Cheese' + BoxLayout: + orientation: 'horizontal' + Label: + text: 'Less' + Slider: + range: (0, 100) + value: 50 + id: cheese_slider + on_value_pos: app.update_cheese() + Label: + text: 'More' + Label: + id: cheese_label + text: str(int(cheese_slider.value)) + '%' + BoxLayout: + orientation: 'vertical' + size_hint: (1, 0.3) + Label: + text: 'Sauce' + font_size: '24sp' + BoxLayout: + orientation: 'vertical' + BoxLayout: + orientation: 'horizontal' + CheckBox: + group: 'sauce' + Label: + text: 'Marinara' + BoxLayout: + orientation: 'horizontal' + CheckBox: + group: 'sauce' + Label: + text: 'Barbecue' + BoxLayout: + orientation: 'vertical' + Label: + text: 'Toppings' + font_size: '24sp' + BoxLayout: + orientation: 'horizontal' + Button: + on_press: app.meat_topping() + text: 'Pepperoni' + BoxLayout: + orientation: 'horizontal' + Button: + on_press: app.topping() + text: 'Pineapple' + BoxLayout: + orientation: 'horizontal' + Button: + on_press: app.topping() + text: 'Mushrooms' + BoxLayout: + orientation: 'horizontal' + Button: + on_press: app.topping() + text: 'Olives' + BoxLayout: + orientation: 'horizontal' + Button: + on_press: app.meat_topping() + text: 'Bacon' + BoxLayout: + orientation: 'horizontal' + size_hint: (1, 0.25) + BoxLayout: + Label: + text: '$' + str(app.price + app.cheese_price) + Button: + text: 'Order Now' + font_size: '18sp' + color: (0.25, 0.5, 1, 1)