Commit f23cee32 authored by Nathan Robert Carlson's avatar Nathan Robert Carlson
Browse files

finished app version 1.00

parent 1f0ddda5
from kivy.app import App
from kivy.modules import inspector # For inspection.
from kivy.properties import BooleanProperty, ListProperty, NumericProperty, StringProperty
from kivy.core.window import Window # For inspection.
from kivy.uix.behaviors import ToggleButtonBehavior
from kivy.uix.screenmanager import ScreenManager, Screen
__app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal'
__version__ = '0.1'
__flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=landscape']
class OrderApp(App):
pepperoni = BooleanProperty(False)
sausage = BooleanProperty(False)
hamburger = BooleanProperty(False)
bacon = BooleanProperty(False)
onions = BooleanProperty(False)
black_olives = BooleanProperty(False)
mushrooms = BooleanProperty(False)
green_peppers = BooleanProperty(False)
printStatement = StringProperty("")
def pepperoniSwitch(self):
self.pepperoni = not self.pepperoni
def sausageSwitch(self):
self.sausage = not self.sausage
def hamburgerSwitch(self):
self.hamburger = not self.hamburger
def baconSwitch(self):
self.bacon = not self.bacon
def onionSwitch(self):
self.onions = not self.onions
def oliveSwitch(self):
self.black_olives = not self.black_olives
def mushroomSwitch(self):
self.mushrooms = not self.mushrooms
def pepperSwitch(self):
self.green_peppers = not self.green_peppers
def build(self):
inspector.create_inspector(Window, self) # For inspection (press control-e to toggle).
def clickPepperonis(self):
if self.pepperoni == False : self.pepperoni = True
else : self.pepperoni = True
def printOrder(self):
pepperoni=""
sausage=""
hamburger=""
bacon=""
onions=""
olives=""
mushrooms=""
peppers=""
if self.pepperoni == True : pepperoni = " pepperoni"
if self.sausage == True : sausage = " sausage"
if self.hamburger == True : hamburger = " hamburger"
if self.bacon == True : bacon = " bacon"
if self.onions == True : onions = " onion"
if self.black_olives == True : olives = " olive"
if self.mushrooms == True : mushrooms = " mushroom"
if self.green_peppers == True : peppers = " green pepper"
self.printStatement = "Your order for a"+pepperoni+sausage+hamburger+bacon+onions+olives+mushrooms+peppers+" cheese pizza has been processed."
if __name__ == '__main__':
app = OrderApp()
......
BoxLayout:
orientation: 'vertical'
Label:
text: '[Your meal-ordering GUI here]'
BoxLayout:
orientation: 'vertical'
Label:
font_size: '85sp'
text: 'Pizza Place'
BoxLayout:
orientation: 'horizontal'
Label:
font_size: '30sp'
color: [100, 0, 0, 1]
text: 'Meats'
ToggleButton:
text: 'Pepperoni'
on_press: app.pepperoniSwitch()
ToggleButton:
text: 'Sausage'
on_press: app.sausageSwitch()
ToggleButton:
text: 'Hamburger'
on_press: app.hamburgerSwitch()
ToggleButton:
text: 'Bacon'
on_press: app.baconSwitch()
BoxLayout:
orientation: 'horizontal'
Label:
font_size: '25sp'
color: [0, 100, 0, 1]
text: 'Vegetables'
ToggleButton:
text: 'Onions'
on_press: app.onionSwitch()
ToggleButton:
text: 'Black olives'
on_press: app.oliveSwitch()
ToggleButton:
text: 'Mushrooms'
on_press: app.mushroomSwitch()
ToggleButton:
text: 'Green peppers'
on_press: app.pepperSwitch()
BoxLayout:
orientation: 'horizontal'
Button:
bold: True
font_size: '40sp'
on_press: app.printOrder()
text: 'Submit order'
BoxLayout:
orientation: 'horizontal'
Label:
font_size: '14sp'
color: [0, 100, 0, 1]
text: str(app.printStatement)
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