示例#1
0
def initiate():  #clear information from screen
    window.FindElement('_OUTPUT2_').Update('')
    window.FindElement('_OUTPUT4_').Update('')
    window.FindElement('_OUTPUT5_').Update('')
    window.FindElement('_OUTPUT6_').Update('')
    image_elem.Update(
        data=get_img_data('/home/pi/practice/order_101/lego.jpg'))
    image_elem2.Update(
        data=get_img_data('/home/pi/practice/order_101/grey.jpeg'))
    image_elem3.Update(
        data=get_img_data('/home/pi/practice/order_101/grey.jpeg'))
    window.Refresh()
def quan(value):  #show quantity as an image file
    Quantities = value
    if Quantities == 1:
        im = get_img_data('/home/pi/practice/order_101/1.jpg')
    elif Quantities == 2:
        im = get_img_data('/home/pi/practice/order_101/2.jpg')
    elif Quantities == 3:
        im = get_img_data('/home/pi/practice/order_101/3.jpg')
    elif Quantities == 4:
        im = get_img_data('/home/pi/practice/order_101/3.jpg')
    elif Quantities == 5:
        im = get_img_data('/home/pi/practice/order_101/5.jpg')
    return im
示例#3
0
def yellows():  #update info for 1x2 yellow brick
    window.FindElement('_OUTPUT4_').Update(1)
    image_elem2.Update(data=quan(Quantities[i]))
    window.FindElement('_OUTPUT6_').Update('Take brick from box 1')
    image_elem.Update(data=get_img_data(
        '/home/pi/practice/order_101/yellow_small.jpg'))  #printer image
    window.Refresh()
示例#4
0
def redl():  #update info for 2x4 red brick
    window.FindElement('_OUTPUT4_').Update(3)
    image_elem2.Update(data=quan(Quantities[i]))
    window.FindElement('_OUTPUT6_').Update('Take brick from box 5')
    image_elem.Update(data=get_img_data(
        '/home/pi/practice/order_101/red_large.jpg'))  # printer image
    window.Refresh()
示例#5
0
def Correct():  #if brick type is correct
    window.FindElement('_OUTPUT6_').Update('Correct Brick type put in box')
    image_elem3.Update(
        data=get_img_data('/home/pi/practice/order_101/box.jpg'))
    window.Refresh()
    sleep(3)
    button()
    wait_button()
示例#6
0
def yellowc():  #update info for 2x2 customised brick
    window.FindElement('_OUTPUT4_').Update(4)
    image_elem2.Update(data=quan(Quantities[i]))
    window.FindElement('_OUTPUT6_').Update('Take brick from box 5')
    image_elem.Update(data=get_img_data(
        '/home/pi/practice/order_101/yellow.jpg'))  # printer image
    window.Refresh()
    sleep(2)
示例#7
0
def Printer():  #print sticker
    window.FindElement('_OUTPUT6_').Update('Check Printer')
    image_elem3.Update(data=get_img_data(
        '/home/pi/practice/order_101/printer.jpg'))  #printer image
    window.Refresh()
    for i in range(Quantities[i]):
        os.system("clear")
        os.system(
            "lp -o orientation-requested=3 -o cpi=7 -o media=Custom.10x20mm printNameBadge.txt"
        )
示例#8
0
def button():
    window.FindElement('_OUTPUT6_').Update('Press black button when LED high')
    image_elem3.Update(
        data=get_img_data('/home/pi/practice/order_101/button.jpg'))
    window.Refresh()
示例#9
0
def trash():
    window.FindElement('_OUTPUT6_').Update('Put Order in trash')
    image_elem.Update(
        data=get_img_data('/home/pi/practice/order_101/trash.jpg'))
    window.Refresh()
示例#10
0
    finally:
        GPIO.cleanup()


#-----------------------------------------GUI Interface-----------------------------------------------------------------

window = sg.Window('Process Order',
                   return_keyboard_events=True,
                   location=(200, 200),
                   size=(900, 900),
                   use_default_focus=False,
                   auto_size_text=True,
                   font=("Helvetica", 20))
image_elem = sg.Image(
    data=get_img_data('/home/pi/practice/order_101/lego.jpg'), size=(300, 300))
image_elem2 = sg.Image(
    data=get_img_data('/home/pi/practice/order_101/grey.jpeg'),
    size=(200, 200))
image_elem3 = sg.Image(
    data=get_img_data('/home/pi/practice/order_101/grey.jpeg'),
    size=(300, 300))
col_1 = [[sg.T(' ' * 15)],
         [
             sg.Text('Press Initiate setup',
                     size=(24, 2),
                     font=("Helvetica", 20),
                     text_color=('blue'),
                     key='_OUTPUT6_')
         ], [sg.T(' ' * 15)], [sg.T(' ' * 15)], [sg.T(' ' * 15)],
         [sg.T(' ' * 15)], [sg.T(' ' * 15)],