def start(self): # Start a timer to allow for ctrl+c handling self.timer = QTimer() self.timer.start(500) self.timer.timeout.connect(lambda: None) # Show the login window and get the nick nick = QLoginWindow.getNick(QWidget(), self.nick) # If the nick is None, the user closed the window so we should quit the app if nick is None: qtUtils.exitApp() else: self.nick = str(nick) # Show the chat window self.chatWindow = QChatWindow(self.restart) self.chatWindow.show() self.__connectToServer() # Don't start the event loop again if it's already running if not self.isEventLoopRunning: self.isEventLoopRunning = True self.exec_()
def start(self): self.timer = QTimer() self.timer.start(500) self.timer.timeout.connect(lambda: None) # Show mode dialog if a mode wasn't given if self.mode is None: self.mode = QModeDialog.getMode(self.isLightTheme) # If the user closed the mode dialog by not selected a mode, stop the app if self.mode is None: qtUtils.exitApp() # Show the chat window self.chatWindow = QChatWindow(None, None, self.isLightTheme) self.chatWindow.show() self.__loadOrGenerateKepair() if self.mode == constants.MODE_SERVER: self.__startServer() self.__waitForClient() elif self.mode == constants.MODE_CLIENT: # Get the host if not given if self.host is None: self.host, ok = QInputDialog.getText(self.chatWindow, "Hostname", "Host:") if not ok: self.__restart() return self.__connectToServer() if not self.isEventLoopRunning: self.isEventLoopRunning = True self.exec_()
def __exit(self): qtUtils.exitApp()
def __exit(self): if QMessageBox.Yes == QMessageBox.question(self, "Confirm Exit", "Are you sure you want to exit?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No): qtUtils.exitApp()