Пример #1
0
def lookup_a_shipment(onhand):
    unit = Shipment.find_one_record(onhand)
    layout = [
        [sg.Text(f"Shipment: {unit.on_hand_number}", font=("Comic", 25))],
        [sg.Text(f"Client: {unit.client}", font=("Comic", 15))],
        [
            sg.Text(f"Dimensions: {unit.volume_weight()} kg/vol",
                    font=("Comic", 15))
        ],
        [sg.Text(f"Gross Weight: {unit.lbs_to_kg()} kg", font=("Comic", 15))],
        [sg.Text(f"Purpose: {unit.purpose}", font=("Comic", 15))],
        [sg.Text(f"Create Date: {unit.create_date}", font=("Comic", 15))],
        [sg.Text(f"Release Date: {unit.release_date}", font=("Comic", 15))],
        [
            sg.Button("Update", key="update"),
            sg.Button("Release", key="release")
        ],
        [sg.Button("View Shipments", key="view")],
    ]

    sg.change_look_and_feel("DarkBlue")

    window = sg.Window(f"Shipment {unit.on_hand_number}",
                       layout,
                       resizable=True)
    event, _ = window.read()

    window.close()

    if event == "update":
        return update_a_shipment(unit.on_hand_number)
    elif event == "release":
        return unit.release_shipment()
    elif event == "view":
        return view_shipments()
Пример #2
0
def update_a_shipment(onhand):
    unit = Shipment.find_one_record(onhand)
    layout = [
        [sg.Text(f"Shipment: {unit.on_hand_number}", font=("Comic", 25))],
        [
            sg.Text("Client:", font=("Comic", 15)),
            sg.InputText(f"{unit.client}", key="client"),
        ],
        [
            sg.Text("Width:", font=("Comic", 15)),
            sg.InputText(f"{unit.width}", key="width"),
        ],
        [
            sg.Text("Length:", font=("Comic", 15)),
            sg.InputText(f"{unit.length}", key="length"),
        ],
        [
            sg.Text("Height:", font=("Comic", 15)),
            sg.InputText(f"{unit.height}", key="height"),
        ],
        [
            sg.Text("Gross Weight:", font=("Comic", 15)),
            sg.InputText(f"{unit.gross_weight}", key="gw"),
        ],
        [
            sg.Text("Purpose:", font=("Comic", 15)),
            sg.InputText(f"{unit.purpose}", key="purpose"),
        ],
        [sg.Text(f"Create Date: {unit.create_date}", font=("Comic", 15))],
        [sg.Text(f"Release Date: {unit.release_date}", font=("Comic", 15))],
        [sg.Button("Update", key="update"),
         sg.Cancel()],
    ]

    sg.change_look_and_feel("DarkBlue")

    window = sg.Window(f"Update Shipment: {unit.on_hand_number}",
                       layout,
                       resizable=True)
    event, values = window.read()
    window.close()

    if event == "update":
        unit.update_shipment(*values.values())
        return f"Shipment {unit.on_hand_number} updated!"