コード例 #1
0
def show_item_details(id_item, len_items):
    if id_item in range(1, len_items + 1):
        item = register.data.get_by_id(id_item)
        Console.print_item_details(item)
        return True
    else:
        Console.notification("input", "isn't exist", "")
        return False
コード例 #2
0
ファイル: app.py プロジェクト: windyludev/StoreInventory
def show_item_details(id_item, len_items):
    if id_item in range(1, len_items + 1):
        item = register.data.get_by_id(id_item)
        Console.print_item_details(item)
        return True
    else:
        Console.notification("input", "isn't exist", "")
        return False
コード例 #3
0
ファイル: app.py プロジェクト: windyludev/StoreInventory
def validate_to_show_item(user_input, len_items):
    try:
        id_item = int(user_input)
    except ValueError:
        Console.notification("input", "isn't valid", "")
        return
    else:
        if show_item_details(id_item, len_items):
            go_through_items(id_item, len_items)
コード例 #4
0
def validate_to_show_item(user_input, len_items):
    try:
        id_item = int(user_input)
    except ValueError:
        Console.notification("input", "isn't valid", "")
        return
    else:
        if show_item_details(id_item, len_items):
            go_through_items(id_item, len_items)
コード例 #5
0
def prompt_menu():
    actions = OrderedDict([('v', view_item), ('a', add_entry),
                           ('b', make_backup), ('q', quit_menu)])
    quit_ = False
    while not quit_:
        Console.print_banner("M E N U", '<>')
        Console.print_menu(actions)
        answer = input("> ").lower()
        if answer in actions:
            quit_ = actions[answer]()
            continue
        Console.notification("input", "not correct")
コード例 #6
0
ファイル: app.py プロジェクト: windyludev/StoreInventory
def prompt_menu():
    actions = OrderedDict([
        ('v', view_item),
        ('a', add_entry),
        ('b', make_backup),
        ('q', quit_menu)
    ])
    quit_ = False
    while not quit_:
        Console.print_banner("M E N U", '<>')
        Console.print_menu(actions)
        answer = input("> ").lower()
        if answer in actions:
            quit_ = actions[answer]()
            continue
        Console.notification("input", "not correct")       
コード例 #7
0
ファイル: app.py プロジェクト: windyludev/StoreInventory
def add_entry():
    """ Add a new product to database """
    item = {}
    for field_key in register.fileds:
        Console.print_banner("A D D   E N T R Y", "~")
        Console.print_field_added(item)
        if field_key == "date_updated":
            continue
        if field_key == "product_price":
            Console.field_key_note()
        item[field_key] = wait_valid_input(field_key)
    try:
        register.fill_records([item])
    except ValueError:
        Console.notification("product", "not added")
    else:
        Console.notification("product", "added successfully")
コード例 #8
0
def add_entry():
    """ Add a new product to database """
    item = {}
    for field_key in register.fileds:
        Console.print_banner("A D D   E N T R Y", "~")
        Console.print_field_added(item)
        if field_key == "date_updated":
            continue
        if field_key == "product_price":
            Console.field_key_note()
        item[field_key] = wait_valid_input(field_key)
    try:
        register.fill_records([item])
    except ValueError:
        Console.notification("product", "not added")
    else:
        Console.notification("product", "added successfully")
コード例 #9
0
ファイル: app.py プロジェクト: windyludev/StoreInventory
def make_backup():
    """ Make a backup of the entire inventory """
    if register.make_a_backup():
        Console.notification("backup", "created")
    else:
        Console.notification("backup", "not created")
コード例 #10
0
def make_backup():
    """ Make a backup of the entire inventory """
    if register.make_a_backup():
        Console.notification("backup", "created")
    else:
        Console.notification("backup", "not created")