Exemple #1
0
 def f_pg():
     nonlocal create_loop, ferm_cr, screen, add_prompt, fadd_head
     create_loop = True
     can_write = ferm_cr.get_grav()
     misc.cls()
     if can_write:
         screen = format_list(fadd_head, ferm_cr.body, add_prompt)
     else:
         screen = format_list('Potential/Specific Gravity Requires a Type',
                              ferm_cr.body, add_prompt)
Exemple #2
0
 def f_pc():
     nonlocal create_loop, ferm_cr, screen, add_prompt, fadd_head
     create_loop = True
     can_write = ferm_cr.get_pc()
     misc.cls()
     if can_write:
         screen = format_list(fadd_head, ferm_cr.body, add_prompt)
     else:
         screen = format_list(
             'Protein Content Requires Type "Base Malt", "Specialty Malt", or "Adjunct"',
             ferm_cr.body, add_prompt)
Exemple #3
0
 def m_up():
     nonlocal next_screen, hs_db, raw_data
     misc.cls()
     add_val = input("Additional Quantity: ")
     add_val = Decimal(add_val)
     new_val = add_val + raw_data[5]
     next_screen = raw_data
     db_curs = hs_db.cursor()
     db_curs.execute(
         'UPDATE misc SET misc_qty = {} WHERE misc_id = {}'.format(
             new_val, next_screen[0]))
     hs_db.commit()
     db_curs.close()
Exemple #4
0
 def m_save():
     nonlocal create_loop, msc_cr, screen, hs_db, next_screen, add_prompt
     success = msc_cr.save(hs_db)
     if success[0]:
         create_loop = False
         next_screen = 'msc'
     else:
         create_loop = True
         if success[1] == 'name':
             temp_head = 'Name Required'
         else:
             temp_head = 'Invalid data. Double check price and quantity.'
         misc.cls()
         screen = format_list(temp_head, msc_cr.body, add_prompt)
Exemple #5
0
 def w_save():
     nonlocal create_loop, wat_cr, screen, hs_db, next_screen, add_prompt
     success = wat_cr.save(hs_db)
     if success[0]:
         create_loop = False
         next_screen = 'wat'
     else:
         create_loop = True
         if success[1] == 'name':
             temp_head = 'Name Required'
         else:
             temp_head = 'Invalid data. Double check all values.'
         misc.cls()
         screen = format_list(temp_head, wat_cr.body, add_prompt)
Exemple #6
0
 def f_save():
     nonlocal create_loop, ferm_cr, screen, hs_db, next_screen, add_prompt
     success = ferm_cr.save(hs_db)
     if success[0]:
         create_loop = False
         next_screen = 'ferm'
     else:
         create_loop = True
         if success[1] == 'name':
             temp_head = 'Name Required'
         else:
             temp_head = 'Invalid data. Double check potential/specific gravity, colour, diastatic power, protein content, price, and quantity.'
         misc.cls()
         screen = format_list(temp_head, ferm_cr.body, add_prompt)
Exemple #7
0
 def m_notes():
     nonlocal create_loop, msc_cr, screen, add_prompt, madd_head
     create_loop = True
     msc_cr.get_notes()
     misc.cls()
     screen = format_list(madd_head, msc_cr.body, add_prompt)
Exemple #8
0
 def w_notes():
     nonlocal create_loop, wat_cr, screen, add_prompt, wadd_head
     create_loop = True
     wat_cr.get_notes()
     misc.cls()
     screen = format_list(wadd_head, wat_cr.body, add_prompt)
Exemple #9
0
 def f_notes():
     nonlocal create_loop, ferm_cr, screen, add_prompt, fadd_head
     create_loop = True
     ferm_cr.get_notes()
     misc.cls()
     screen = format_list(fadd_head, ferm_cr.body, add_prompt)
Exemple #10
0
 def y_notes():
     nonlocal create_loop, yst_cr, screen, add_prompt, yadd_head
     create_loop = True
     yst_cr.get_notes()
     misc.cls()
     screen = format_list(yadd_head, yst_cr.body, add_prompt)
Exemple #11
0
 def h_notes():
     nonlocal create_loop, hop_cr, screen, add_prompt, hadd_head
     create_loop = True
     hop_cr.get_notes()
     misc.cls()
     screen = format_list(hadd_head, hop_cr.body, add_prompt)
Exemple #12
0
            next_screen, det_head, next_det,
            '1. Return\n2. Add Inventory\n3. Delete\n\nSelect Option: '
        ]


# main program
db_con = None
outer_loop = True
cur_screen = 'main'
cur_head = 'Main Menu'
cur_body = [(None, 'Inventory'), (None, 'Recipes'), (None, 'Shopping Lists'),
            (None, 'Ingredients'), (None, 'Log Out'), (None, 'Exit')]
cur_prompt = 'Select Menu: '

while outer_loop == True:
    misc.cls()
    username = '******'  #input("Enter Username: "******"Enter Password: "******"Unable to Connect: {}".format(e))
        for i in range(3):
            time.sleep(1)
            print(".")
Exemple #13
0
def get_next(current, selection, list_lngth, raw, cur_data):
    if current == 'main':
        if selection == '1':
            go_next = 'inv'
        elif selection == '2':
            go_next = 'rec'
        elif selection == '3':
            go_next = 'shop'
        elif selection == '4':
            go_next = 'ing'
        elif selection == '5':
            go_next = 'log'
        elif selection == '6':
            go_next = 'exit'
        else:
            misc.cls()
            go_next = None
    elif current == 'ing':
        if selection == '1':
            go_next = 'hop'
        elif selection == '2':
            go_next = 'yst'
        elif selection == '3':
            go_next = 'ferm'
        elif selection == '4':
            go_next = 'wat'
        elif selection == '5':
            go_next = 'msc'
        elif selection == '6':
            go_next = 'main'
        else:
            misc.cls()
            go_next = None
    elif current == 'hop':
        try:
            if int(selection) <= (list_lngth - 4) and int(selection) > 0:
                go_next = [raw[int(selection) - 1][0]]
            elif int(selection) == list_lngth - 3:
                go_next = 'ing'
            elif int(selection) == list_lngth - 2:
                go_next = 'main'
            elif int(selection) == list_lngth - 1:
                go_next = 'hop_add'
            elif int(selection) == list_lngth:
                go_next = 'hop_srch'
            else:
                misc.cls()
                go_next = None
        except ValueError:
            misc.cls()
            go_next = None
    elif current == 'hop_srch':
        if int(selection) <= (list_lngth - 3) and int(selection) > 0:
            go_next = [raw[int(selection) - 1][0]]
        elif int(selection) == list_lngth - 2:
            go_next = 'ing'
        elif int(selection) == list_lngth - 1:
            go_next = 'main'
        elif int(selection) == list_lngth:
            go_next = 'hop'
        else:
            misc.cls()
            go_next = None
    elif current == 'hop_det':
        if selection == '1':
            go_next = 'hop'
        elif selection == '2':
            go_next = 'hop_update'
        elif selection == '3':
            misc.cls()
            loop = True
            while loop == True:
                misc.cls()
                print("Delete " + raw[1] + "? Y/N")
                verify = input()
                if verify.lower() == 'y':
                    go_next = 'hop_del'
                    loop = False
                elif verify.lower() == 'n':
                    go_next = [raw[0]]
                    loop = False
                else:
                    loop = True
        else:
            misc.cls()
            go_next = None
    elif current == 'hop_add':
        if selection == '1':
            go_next = 'hop_name'
        elif selection == '2':
            go_next = 'hop_origin'
        elif selection == '3':
            go_next = 'hop_type'
        elif selection == '4':
            go_next = 'hop_alpha'
        elif selection == '5':
            go_next = 'hop_beta'
        elif selection == '6':
            go_next = 'hop_price'
        elif selection == '7':
            go_next = 'hop_qty'
        elif selection == '8':
            go_next = 'hop_notes'
        elif selection == '9':
            go_next = 'hop_save'
        elif selection == '10':
            go_next = 'hop'
        else:
            misc.cls()
            go_next = None
    elif current == 'yst':
        try:
            if int(selection) <= (list_lngth - 4) and int(selection) > 0:
                go_next = [raw[int(selection) - 1][0]]
            elif int(selection) == list_lngth - 3:
                go_next = 'ing'
            elif int(selection) == list_lngth - 2:
                go_next = 'main'
            elif int(selection) == list_lngth - 1:
                go_next = 'yst_add'
            elif int(selection) == list_lngth:
                go_next = 'yst_srch'
            else:
                misc.cls()
                go_next = None
        except ValueError:
            misc.cls()
            go_next = None
    elif current == 'yst_srch':
        if int(selection) <= (list_lngth - 3) and int(selection) > 0:
            go_next = [raw[int(selection) - 1][0]]
        elif int(selection) == list_lngth - 2:
            go_next = 'ing'
        elif int(selection) == list_lngth - 1:
            go_next = 'main'
        elif int(selection) == list_lngth:
            go_next = 'yst'
        else:
            misc.cls()
            go_next = None
    elif current == 'yst_det':
        if selection == '1':
            go_next = 'yst'
        elif selection == '2':
            go_next = 'yst_update'
        elif selection == '3':
            misc.cls()
            loop = True
            while loop == True:
                misc.cls()
                print("Delete " + raw[1] + "? Y/N")
                verify = input()
                if verify.lower() == 'y':
                    go_next = 'yst_del'
                    loop = False
                elif verify.lower() == 'n':
                    go_next = [raw[0]]
                    loop = False
                else:
                    loop = True
        else:
            misc.cls()
            go_next = None
    elif current == 'yst_add':
        if selection == '1':
            go_next = 'yst_name'
        elif selection == '2':
            go_next = 'yst_ar'
        elif selection == '3':
            go_next = 'yst_prid'
        elif selection == '4':
            go_next = 'yst_lab'
        elif selection == '5':
            go_next = 'yst_type'
        elif selection == '6':
            go_next = 'yst_alc'
        elif selection == '7':
            go_next = 'yst_floc'
        elif selection == '8':
            go_next = 'yst_minatt'
        elif selection == '9':
            go_next = 'yst_maxatt'
        elif selection == '10':
            go_next = 'yst_mintmp'
        elif selection == '11':
            go_next = 'yst_maxtmp'
        elif selection == '12':
            go_next = 'yst_price'
        elif selection == '13':
            go_next = 'yst_qty'
        elif selection == '14':
            go_next = 'yst_notes'
        elif selection == '15':
            go_next = 'yst_save'
        elif selection == '16':
            go_next = 'yst'
        else:
            misc.cls()
            go_next = None
    elif current == 'ferm':
        try:
            if int(selection) <= (list_lngth - 4) and int(selection) > 0:
                go_next = [raw[int(selection) - 1][0]]
            elif int(selection) == list_lngth - 3:
                go_next = 'ing'
            elif int(selection) == list_lngth - 2:
                go_next = 'main'
            elif int(selection) == list_lngth - 1:
                go_next = 'ferm_add'
            elif int(selection) == list_lngth:
                go_next = 'ferm_srch'
            else:
                misc.cls()
                go_next = None
        except ValueError:
            misc.cls()
            go_next = None
    elif current == 'ferm_srch':
        if int(selection) <= (list_lngth - 3) and int(selection) > 0:
            go_next = [raw[int(selection) - 1][0]]
        elif int(selection) == list_lngth - 2:
            go_next = 'ing'
        elif int(selection) == list_lngth - 1:
            go_next = 'main'
        elif int(selection) == list_lngth:
            go_next = 'ferm'
        else:
            misc.cls()
            go_next = None
    elif current == 'ferm_det':
        if selection == '1':
            go_next = 'ferm'
        elif selection == '2':
            go_next = 'ferm_update'
        elif selection == '3':
            misc.cls()
            loop = True
            while loop == True:
                misc.cls()
                print("Delete " + raw[1] + "? Y/N")
                verify = input()
                if verify.lower() == 'y':
                    go_next = 'ferm_del'
                    loop = False
                elif verify.lower() == 'n':
                    go_next = [raw[0]]
                    loop = False
                else:
                    loop = True
        else:
            misc.cls()
            go_next = None
    elif current == 'ferm_add':
        if selection == '1':
            go_next = 'ferm_name'
        elif selection == '2':
            go_next = 'ferm_origin'
        elif selection == '3':
            go_next = 'ferm_type'
        elif selection == '4':
            go_next = 'ferm_pg'
        elif selection == '5':
            go_next = 'ferm_col'
        elif selection == '6':
            go_next = 'ferm_dp'
        elif selection == '7':
            go_next = 'ferm_pc'
        elif selection == '8':
            go_next = 'ferm_price'
        elif selection == '9':
            go_next = 'ferm_qty'
        elif selection == '10':
            go_next = 'ferm_notes'
        elif selection == '11':
            go_next = 'ferm_save'
        elif selection == '12':
            go_next = 'ferm'
        else:
            misc.cls()
            go_next = None
    elif current == 'wat':
        try:
            if int(selection) <= (list_lngth - 4) and int(selection) > 0:
                go_next = [raw[int(selection) - 1][0]]
            elif int(selection) == list_lngth - 3:
                go_next = 'ing'
            elif int(selection) == list_lngth - 2:
                go_next = 'main'
            elif int(selection) == list_lngth - 1:
                go_next = 'wat_add'
            elif int(selection) == list_lngth:
                go_next = 'wat_srch'
            else:
                misc.cls()
                go_next = None
        except ValueError:
            misc.cls()
            go_next = None
    elif current == 'wat_srch':
        if int(selection) <= (list_lngth - 3) and int(selection) > 0:
            go_next = [raw[int(selection) - 1][0]]
        elif int(selection) == list_lngth - 2:
            go_next = 'ing'
        elif int(selection) == list_lngth - 1:
            go_next = 'main'
        elif int(selection) == list_lngth:
            go_next = 'wat'
        else:
            misc.cls()
            go_next = None
    elif current == 'wat_det':
        if selection == '1':
            go_next = 'wat'
        elif selection == '2':
            go_next = 'wat_update'
        elif selection == '3':
            misc.cls()
            loop = True
            while loop == True:
                misc.cls()
                print("Delete " + raw[1] + "? Y/N")
                verify = input()
                if verify.lower() == 'y':
                    go_next = 'wat_del'
                    loop = False
                elif verify.lower() == 'n':
                    go_next = [raw[0]]
                    loop = False
                else:
                    loop = True
        else:
            misc.cls()
            go_next = None
    elif current == 'wat_add':
        if selection == '1':
            go_next = 'wat_name'
        elif selection == '2':
            go_next = 'wat_ph'
        elif selection == '3':
            go_next = 'wat_ca'
        elif selection == '4':
            go_next = 'wat_mg'
        elif selection == '5':
            go_next = 'wat_na'
        elif selection == '6':
            go_next = 'wat_so4'
        elif selection == '7':
            go_next = 'wat_cl'
        elif selection == '8':
            go_next = 'wat_hco3'
        elif selection == '9':
            go_next = 'wat_price'
        elif selection == '10':
            go_next = 'wat_qty'
        elif selection == '11':
            go_next = 'wat_notes'
        elif selection == '12':
            go_next = 'wat_save'
        elif selection == '13':
            go_next = 'wat'
        else:
            misc.cls()
            go_next = None
    elif current == 'msc':
        try:
            if int(selection) <= (list_lngth - 4) and int(selection) > 0:
                go_next = [raw[int(selection) - 1][0]]
            elif int(selection) == list_lngth - 3:
                go_next = 'ing'
            elif int(selection) == list_lngth - 2:
                go_next = 'main'
            elif int(selection) == list_lngth - 1:
                go_next = 'msc_add'
            elif int(selection) == list_lngth:
                go_next = 'msc_srch'
            else:
                misc.cls()
                go_next = None
        except ValueError:
            misc.cls()
            go_next = None
    elif current == 'msc_srch':
        if int(selection) <= (list_lngth - 3) and int(selection) > 0:
            go_next = [raw[int(selection) - 1][0]]
        elif int(selection) == list_lngth - 2:
            go_next = 'ing'
        elif int(selection) == list_lngth - 1:
            go_next = 'main'
        elif int(selection) == list_lngth:
            go_next = 'msc'
        else:
            misc.cls()
            go_next = None
    elif current == 'msc_det':
        if selection == '1':
            go_next = 'msc'
        elif selection == '2':
            go_next = 'msc_update'
        elif selection == '3':
            misc.cls()
            loop = True
            while loop == True:
                misc.cls()
                print("Delete " + raw[1] + "? Y/N")
                verify = input()
                if verify.lower() == 'y':
                    go_next = 'msc_del'
                    loop = False
                elif verify.lower() == 'n':
                    go_next = [raw[0]]
                    loop = False
                else:
                    loop = True
        else:
            misc.cls()
            go_next = None
    elif current == 'msc_add':
        if selection == '1':
            go_next = 'msc_name'
        elif selection == '2':
            go_next = 'msc_unit'
        elif selection == '3':
            go_next = 'msc_type'
        elif selection == '4':
            go_next = 'msc_price'
        elif selection == '5':
            go_next = 'msc_qty'
        elif selection == '6':
            go_next = 'msc_notes'
        elif selection == '7':
            go_next = 'msc_save'
        elif selection == '8':
            go_next = 'msc'
        else:
            misc.cls()
            go_next = None

    return go_next