def login(self): self.setWindowTitle("Logging in...") doLogin_return = login.startLogin() dialog = QtWidgets.QDialog(None, QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowTitleHint) dialog.setWindowIcon(QtGui.QIcon(path("icon.png", True))) dialog_ui = Ui_Dialog(dialog) dialog_ui.setupUi() if doLogin_return == "Fail": self.setWindowTitle("Login") dialog_ui.label.setText("Login failed. Please try again.") dialog.exec_() dialog.show() elif doLogin_return == "Empty Fail": self.setWindowTitle("Login") dialog_ui.label.setText("Please enter your login details and try again.") dialog.exec_() dialog.show() elif doLogin_return == "Connection Fail": self.setWindowTitle("Login") dialog_ui.label.setText("Failed to establish a connection. Please check your network settings and the status of SEMS Intranet.") dialog.exec_() dialog.show() else: data = login.format_data(doLogin_return) dialog.close() self.close() file = open(path("data"), "wb") pickle.dump(datetime.datetime.today(), file) pickle.dump(data, file) file.close() open_main_window(data)
def login(self): self.setWindowTitle("Logging in...") doLogin_return = login.startLogin() dialog = QtWidgets.QDialog( None, QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowTitleHint) dialog.setWindowIcon(QtGui.QIcon(path("icon.png", True))) dialog_ui = Ui_Dialog() dialog_ui.setupUi(dialog) if doLogin_return == "Fail": self.setWindowTitle("Login") dialog_ui.label.setText("Login failed. Please try again.") dialog.exec_() dialog.show() elif doLogin_return == "Empty Fail": self.setWindowTitle("Login") dialog_ui.label.setText( "Please enter your login details and try again.") dialog.exec_() dialog.show() elif doLogin_return == "Connection Fail": self.setWindowTitle("Login") dialog_ui.label.setText( "Failed to establish a connection. Please check your network settings and the status of SEMS Intranet." ) dialog.exec_() dialog.show() else: data = login.FormatData(doLogin_return) dialog.close() self.close() import main file = open(path("data"), "wb") main.pickle.dump(main.datetime.datetime.today(), file) main.pickle.dump(data, file) file.close() open_main_window(data)
def sair(): MainWindow.close() login.startLogin()
__author__ = 'harry' import login import argparse import getpass if __name__ == "__main__": parser = argparse.ArgumentParser(description="start AWS.") parser.add_argument('--username', '-u', help='Username for GUI-less login') parser.add_argument('--password', '-p', help='Password for GUI-less login') args = vars(parser.parse_args()) if args['username'] == None: login.startLogin() elif args['password'] == None: args['password'] = getpass.getpass()