Esempio n. 1
0
    def __connectToServer(self):
        # Create the connection manager to manage all communcation to the server
        self.connectionManager = ConnectionManager(self.nick, (self.turn, self.port), self.chatWindow.postMessage, self.chatWindow.newClient, self.chatWindow.clientReady, self.chatWindow.smpRequest, self.chatWindow.handleError)
        self.chatWindow.connectionManager = self.connectionManager

        # Start the connect thread
        self.connectThread = qtThreads.QtServerConnectThread(self.connectionManager, self.__postConnect, self.__connectFailure)
        self.connectThread.start()

        # Show the waiting dialog
        self.waitingDialog = QWaitingDialog(self.chatWindow, "Connecting to server...")
        self.waitingDialog.show()
Esempio n. 2
0
    def __connectToServer(self):
        # Create the connection manager to manage all communication to the server
        self.connectionManager = ConnectionManager(self.nick, (self.turn, self.port), self.postMessage, self.newClient, self.clientReady, self.smpRequest, self.handleError)

        dialogWindow = CursesDialog(self.screen, "Connecting to server...", "", False)
        dialogWindow.show()
        try:
            # TODO: push this to it's own thread
            self.connectionManager.connectToServer()
        except exceptions.GenericError as ge:
            dialogWindow.hide()
            CursesDialog(self.screen, str(ge), "Error connecting to server", isError=True, isFatal=True, isBlocking=True).show()
            self.__quitApp()

        dialogWindow.hide()
Esempio n. 3
0
    def __init__(self, nick, remoteNick):
        Thread.__init__(self)

        self.nick = nick
        self.remoteNick = remoteNick
        self.exceptions = []

        self.message1 = 'message 1'
        self.message2 = 'message 2'

        self.smpQuestion = 'when do we attack?'
        self.smpAnswer = 'at dawn'

        self.recvMessageCallback = WaitingMock()
        self.newClientCallback = WaitingMock()
        self.handshakeDoneCallback = WaitingMock()
        self.smpRequestCallback = WaitingMock()
        self.errorCallback = WaitingMock()

        self.connectionManager = ConnectionManager(self.nick, ('localhost', constants.DEFAULT_PORT),
            self.recvMessageCallback, self.newClientCallback, self.handshakeDoneCallback, self.smpRequestCallback, self.errorCallback)