示例#1
0
def submit_weight(weight_submitted):  # Method called when weight submitted
    global productInfo
    productInfo[2] = weight_submitted  # Update tracker with weight

    helper.get_container().show_frame(
        ConfirmAdditionFrame.__name__)  # Show confirmation page
    helper.get_container().get_frame(ConfirmAdditionFrame.__name__).set_row(
        create_row())  # Update GUI row to show selection
示例#2
0
def remove_item(batch_number):  # Called when asked to remove item
    result = global_var.database.remove_item(batch_number)  # Remove item from db

    if result:  # If success
        helper.get_container().show_frame(SuccessRemoveFrame.__name__)
        container = helper.get_container().get_frame(SuccessRemoveFrame.__name__).get_container()  # Show success frame
        tk.Label(container, text=helper.format_batch(batch_number),
                 font=global_var.FONT_HUGE).pack()  # Add label with product number
    else:
        raise (Exception("Unable to complete database operation"))  # If failed raise Exception
示例#3
0
def button_main_call(index):  # Method called when main meat type selected
    global productInfo

    productInfo[0] = meats[index]  # Update tracker

    if (len(productInfo[0][1])) != 0:
        helper.get_container().show_frame(
            ButtonSecondFrame.__name__
        )  # If meat has sub meat go to sub meat page
    else:
        helper.get_container().show_frame(
            WeightFrame.__name__)  # Else go to enter weight page
示例#4
0
    def __init__(self, master=None):
        super().__init__(master)

        self.add_button_to_frame(helper.get_container().go_up,
                                 global_var.images["back"])  # Back button

        self.add_button_to_frame(helper.get_container().go_home,
                                 global_var.images["home"])  # Home button

        self.add_button_to_frame(
            lambda: helper.get_container().show_frame(
                frame_name=frames.mainframes.TurnOffFrame.__name__),
            global_var.images["power"])
示例#5
0
    def __init__(self, master=None):
        super().__init__(master)
        self.previousFrame = self.__class__.__name__

        self.add_button_to_frame(text="Add new item",
                                 command=lambda: helper.get_container().show_frame(
                                     frames.additem.ButtonMainFrame.__name__),
                                 image=global_var.images["add"], spacer=False)  # Add item button

        self.add_button_to_frame(text="Remove item",
                                 command=lambda: helper.get_container().show_frame(
                                     frames.removeitem.RemoveItemFrame.__name__),
                                 image=global_var.images["remove"])  # Remove item button

        self.add_button_to_frame(text="View database", image=global_var.images["eye"],
                                 command=helper.view_in_excel)  # View in excel button
示例#6
0
    def __init__(self, master=None):
        super().__init__(master,
                         title="Add the following item to freezer?",
                         command_no=helper.get_container().go_home,
                         command_yes=add_product)
        self.previousFrame = WeightFrame.__name__

        self.rowFrame = None  # Frame where the data is displayed
示例#7
0
def submit_batch_number(number):
    global idNumber
    idNumber = number

    row = global_var.database.get_info(number)  # Get row object for batch number

    if row == global_var.ERROR_NO_SUCH_ITEM:
        helper.get_container().show_frame(NoItemFrame.__name__)  # If no such row show no item frame
    elif row == global_var.ERROR_ITEM_REMOVED:
        helper.get_container().show_frame(AlreadyRemovedFrame.__name__)  # If row already removed show frame
    else:
        helper.get_container().show_frame(ItemInfoFrame.__name__)  # Else show confirm frame
        helper.get_container().get_frame(ItemInfoFrame.__name__).set_row(row)  # And display data
示例#8
0
def add_product():  # Method called when confirmed object removal
    # Add product to database
    if productInfo[1] is None:
        batch_id = global_var.database.add_item(
            backend.Row(category=productInfo[0][0],
                        weight=productInfo[2]))  # If product has no sub type
    else:
        batch_id = global_var.database.add_item(
            backend.Row(category=productInfo[0][0],
                        subcategory=productInfo[1],
                        weight=productInfo[2]))  # If product has sub type

    if batch_id == -1:
        raise Exception("Could not add to database")

    helper.get_container().show_frame(
        SuccessMessage.__name__)  # Show success frame

    container = helper.get_container().get_frame(
        SuccessMessage.__name__).get_container()  # Container for batch number
    tk.Label(container,
             text=helper.format_batch(batch_id),
             font=global_var.FONT_HUGE).pack()  # Add batch number to container
示例#9
0
def button_second_call(index):  # Method called when sub meat type selected
    global productInfo
    productInfo[1] = productInfo[0][1][index]  # Update tracker

    helper.get_container().show_frame(
        WeightFrame.__name__)  # Go to weight page
示例#10
0
    def __init__(self, master=None):
        super().__init__(master, title="Remove the following item", command_no=helper.get_container().go_home,
                         command_yes=lambda: remove_item(idNumber))
        self.previousFrame = RemoveItemFrame.__name__

        self.rowFrame = None
示例#11
0
 def __init__(self, master):
     super().__init__(master, title="Are you sure you want to quit?", command_yes=helper.turn_off,
                      command_no=helper.get_container().go_up)