Exemplo n.º 1
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(ManagerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=2, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(ManagerSignIn))
        sign_out_button.grid(row=0, column=4, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=6)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=6)
        title2 = ttk.Label(self, text="Manger Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=6)

        # ----Display Seat GUI----
        seats = f.get_seats()
        r = 4
        c = 0
        for i in range(len(seats)):
            if seats[i] == 'None':
                color = 'green'
            else:
                color = 'red'
            s = ttk.Label(self, text=f.get_seat_number(i), foreground=color)
            s.grid(row=r, column=c, padx=1, pady=1)
            c += 1
            if c == 6:
                c = 0
                r += 1
Exemplo n.º 2
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=5, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=7)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=7)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=7)

        if controller.USER != '' and controller.USERTYPE == "customer":
            # ----Seat View----
            f = Flight()
            seats = f.get_seats()
            r = 4
            c = 0
            for i in range(len(seats)):
                if seats[i] == controller.USER:
                    color = 'green'
                else:
                    color = 'black'
                s = ttk.Label(self,
                              text=f.get_seat_number(i),
                              foreground=color)
                s.grid(row=r, column=c, padx=1, pady=1)
                c += 1
                if c == 6:
                    c = 0
                    r += 1
            # ----Ticket Info----
            c = Customer(controller.USER)

            num, tType, seat_list = c.get_ticket_info()

            f_string = "Flight #" + num
            flight_label = ttk.Label(self, text=f_string)
            flight_label.grid(row=4, column=6, pady=1)

            type_string = "Traveler: " + tType
            type_label = ttk.Label(self, text=type_string)
            type_label.grid(row=5, column=6, pady=1)

            seat_string = "Seats: "
            for seat in seat_list:
                seat_string += f.get_seat_number(seat) + ", "
            seat_label = ttk.Label(self, text=seat_string)
            seat_label.grid(row=6, column=6, pady=1)
Exemplo n.º 3
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=1, pady=5)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=2, pady=5)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=3)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=3)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=2, columnspan=3)

        # ----Display Ticket Info----
        title3 = ttk.Label(self, text="Ticket(s) Confirmed!")
        title3.grid(row=4, column=0, padx=30, pady=2, columnspan=3)

        if controller.USER != '' and controller.USERTYPE == "customer":
            user = Customer(controller.USER)

            name_string = "Name: " + user.username
            name_label = ttk.Label(self, text=name_string)
            name_label.grid(row=5, column=0, pady=10, columnspan=3)

            num, t, seat_list = user.get_ticket_info()

            flight_string = "Flight #" + num
            flight_label = ttk.Label(self, text=flight_string)
            flight_label.grid(row=6, column=0, pady=10, columnspan=3)

            type_string = "Traveler Type: " + t
            type_label = ttk.Label(self, text=type_string)
            type_label.grid(row=7, column=0, pady=10, columnspan=3)

            seat_string = "Seats: "
            for seat in seat_list:
                seat_string += f.get_seat_number(seat)
                if seat != seat_list[len(seat_list) - 1]:
                    seat_string += ", "

            seats = ttk.Label(self, text=seat_string)
            seats.grid(row=8, column=0, columnspan=3)