def main(): app = QApplication(sys.argv) login = LoginDialog() # test = 1 # while True: login.exec_() if login.login_success: mainwindow = MainWindow(login) mainwindow.show() login = LoginDialog(mainwindow) login.exec_()
def handle_operator(self, card): print 'operator', card if not self.disconnect_from_signal(self.executor.new_operator, self.handle_operator): return if self.session is None: login_dialog = LoginDialog(card, parent=self) if login_dialog.exec_() == QDialog.Accepted: self.executor.begin_session(card) elif self.session == card.sn or card.type == Card.ADMIN: login_dialog = LogoffDialog(card, self.executor) if login_dialog.exec_() == QDialog.Accepted: self.executor.end_session() self.executor.new_operator.connect(self.handle_operator)
def getAccount(self): loginDialog=LoginDialog(self) if loginDialog.exec_(): user,pwd=loginDialog.getRetValue() return user,pwd else: logging.info("Exit....") sys.exit(0)
def On_ShowSetting(self): dlg = LoginDialog(self) if not dlg.exec_(): return self.isAutoDetect = False self.tabSetting.setCurrentIndex(1) self.pbtabDryrun.setStyleSheet('''background-color: rgb(255, 255, 255);color: rgb(0, 0, 0);''') self.pbtabSetting.setStyleSheet('''background-color: rgb(255, 255, 255);color: rgb(0, 255, 0);''') self.pbtabProfile.setStyleSheet('''background-color: rgb(255, 255, 255);color: rgb(0, 0, 0);''') self.leStationID.setText(self.config["stationid"] if 'stationid' in self.config else '1') self.isProfilestatus = True self._saveConfigFile()
import sys from PyQt5 import QtWidgets, QtGui from login import LoginDialog from main_app import MainWindow def resource_path(relative_path): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative_path) return os.path.join(os.path.abspath('..'), relative_path) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) login = LoginDialog() login.setWindowIcon(QtGui.QIcon(resource_path('dc1.png'))) if login.exec_() != QtWidgets.QDialog.Accepted: sys.exit(-1) window = MainWindow() window.setWindowIcon(QtGui.QIcon(resource_path('dc1.png'))) window.setGeometry(500, 150, 800, 500) window.tab(login.credentials()) window.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow from PyQt5.QtGui import QIcon from login import LoginDialog import resources import config import Tetris if __name__ == "__main__": app = QApplication(sys.argv) app.setStyleSheet(config.global_qss) login_widget = LoginDialog() if login_widget.exec_() == QDialog.Accepted: # main_window = QMainWindow() # main_window.show() # icon = QIcon("/Resources/bg.jpg") # # main_window.setWindowIcon(icon) tetris = Tetris.Tetris() else: sys.exit(0) sys.exit(app.exec_())