def main_screen(): """ Main application will start here, with two related processes; Registeration and Login """ window = AppWindow(title="Main Window", w=450, h=350) # set the root AppWindow.original_window = window Button(window, text='Register', command=lambda: auth.user_register()).place(x=160, y=150, width=120, height=50) Button(window, text='Login', command=lambda: auth.user_login()).place(x=160, y=80, width=120, height=50) window.mainloop()
class LoginWindow(QtWidgets.QMainWindow, Ui_LoginWindow): def __init__(self): super().__init__() self.setupUi(self) # buttons self.btn_back.clicked.connect(self.go_back) self.btn_login.clicked.connect(self.go_app) def go_app(self): self.go_app_win = AppWindow() self.go_app_win.show() self.hide() def go_back(self): # initialization of switchable windows self.go_start_win = start.StartWindow() self.go_start_win.show() self.hide()
def customer_screen(): # Now this will be the original window window_customer_screen = AppWindow(title='User Screen', w=350, h=300) # Set this now as the application root AppWindow.original_window = window_customer_screen print(AppWindow.original_window) Button(window_customer_screen, text='Sign Out', command=lambda: auth.user_signout()).place(x=127, y=250, width=80, height=25) Button(window_customer_screen, text='Return Bike', command=lambda: retrn()).place(x=80, y=80, width=80, height=50) Button(window_customer_screen, text='Rent a Bike', command=lambda: rent()).place(x=170, y=80, width=80, height=50) Button(window_customer_screen, text='Report', command=lambda: report() ).place(x=80, y=140, width=80, height=50) Button(window_customer_screen, text='My Account', command=lambda: account()).place(x=170, y=140, width=80, height=50)
def user_signout(): AppWindow.original_window.destroy() window = AppWindow(title="Main Window", w=450, h=350) # set the root AppWindow.original_window = window Button(window, text='Register', command=lambda: user_register()).place(x=160, y=150, width=120, height=50) Button(window, text='Login', command=lambda: user_login()).place(x=160, y=80, width=120, height=50)
def manager_screen(): # Now this will be the original window window_manager_screen = AppWindow(title='Manager Screen', w=350, h=300) # Set this now as the application root AppWindow.original_window = window_manager_screen Button(window_manager_screen, text='Visualization', command=m_function.visualization).place(x=125, y=125, width=100, height=50) Button(window_manager_screen, text='Sign Out', command=lambda: auth.user_signout()).place(x=130, y=250, width=80, height=25)
def operator_screen(): # Now this will be the original window window_operator_screen = AppWindow(title='Operator Screen', w=350, h=300) # Set this now as the application root AppWindow.original_window = window_operator_screen print(AppWindow.original_window) Button(window_operator_screen, text='Track Bike', command=lambda: track()).place(x=80, y=80, width=80, height=50) Button(window_operator_screen, text='Repair Bike', command=lambda: repair()).place(x=170, y=80, width=80, height=50) Button(window_operator_screen, text='Move Bike', command=lambda: move()).place(x=80, y=140, width=80, height=50) Button(window_operator_screen, text='Sign Out', command=lambda: auth.user_signout()).place(x=127, y=250, width=80, height=25)
def go_app(self): self.go_app_win = AppWindow() self.go_app_win.show() self.hide()
if __name__ == '__main__': # HiDPI Support QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) # Application register QtCore.QCoreApplication.setOrganizationName("Btz") QtCore.QCoreApplication.setOrganizationDomain("bentuzi.com") QtCore.QCoreApplication.setApplicationName(configurations.get("name")) QtCore.QCoreApplication.setApplicationVersion(configurations.get("version")) # Create application and initialize tr1 = QtCore.QTranslator() tr2 = QtCore.QTranslator() tr3 = QtCore.QTranslator() tr1.load(QtCore.QLocale(), "window_app", ".", ResourcePath("assets/languages"), ".qm") tr2.load(QtCore.QLocale(), "app", ".", ResourcePath("assets/languages"), ".qm") tr3.load(QtCore.QLocale(), "dialog_donate", ".", ResourcePath("assets/languages"), ".qm") app = QApplication(sys.argv) app.installTranslator(tr1) app.installTranslator(tr2) app.installTranslator(tr3) window = AppWindow() # Running window.show() sys.exit(app.exec_())