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
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)
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, 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=3) 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) def display_business(pos): r = 4 c = 0 for i in range(len(seats)): if i == options[pos]: color = 'green' elif seats[i] != 'None': color = 'red' 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 def display_group(pos): r = 4 c = 0 for i in range(len(seats)): for j in options[pos]: if i == j: color = 'green' break if seats[i] != 'None': color = 'red' elif seats[i] == 'None': if i not in options[pos]: 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 # ----Show Seat Options & New/Confirm Button---- global index index = 0 if controller.USER != '' and controller.USERTYPE == "customer": seats = f.get_seats() user = Customer(controller.USER) if user.type != "None": options = [] if user.type == "BT-BS": options = f.add_business(True) # display seats display_business(index) elif user.type == "BT-N": options = f.add_business(False) display_business(index) elif user.type == "TT": options = f.add_tourist() display_group(index) elif user.type == "FT-1": options = f.add_family(1) display_group(index) elif user.type == "FT-2": options = f.add_family(2) display_group(index) elif user.type == "FT-3": options = f.add_family(3) display_group(index) def confirm(): if user.type == "BT-BS" or user.type == "BT-N": f.confirm([options[index]], controller.USER) else: f.confirm(options[index], controller.USER) controller.refresh_user(controller.USER, "customer") controller.show_frame(TicketGenerated) def next(): global index index += 1 if index == len(options): index = 0 # display seats if user.type == "BT-BS" or user.type == "BT-N": display_business(index) else: display_group(index) new_button = ttk.Button(self, text="New", command=lambda: next()) new_button.grid(row=4, column=6, padx=2, rowspan=4) confirm_button = ttk.Button(self, text="Confirm", command=lambda: confirm()) confirm_button.grid(row=8, column=6, padx=2, rowspan=4)