コード例 #1
0
ファイル: _gwlobby.py プロジェクト: magmun/client
    def doLogin(self):
        """ login in the GW server 
            We are using the main login and session to check legitimity of the client.
        """

        self.progress.setLabelText("Gating in...")
        self.progress.reset()
        self.progress.show()

        logger.info("Attempting to gate as: " + str(self.client.login))
        self.state = ClientState.NONE

        self.send(
            dict(
                command="hello",
                version=util.VERSION_STRING,
                port=self.client.gamePort,
                login=self.client.login,
                session=self.client.session,
            )
        )

        while (not self.state) and self.progress.isVisible():
            QtGui.QApplication.processEvents()

        if self.progress.wasCanceled():
            logger.warn("Gating aborted by user.")
            return False

        self.progress.close()

        if self.state == ClientState.ACCEPTED:
            logger.info("Gating accepted.")
            self.progress.close()
            self.client.actionGalacticWar.triggered.connect(self.updateOptions)
            self.client.actionGalacticWar.setEnabled(True)
            return True
            # self.connected.emit()

        elif self.state == ClientState.REJECTED:
            logger.warning("Gating rejected.")
            return False
        else:
            # A more profound error has occurrect (cancellation or disconnection)
            return False
コード例 #2
0
ファイル: _gwlobby.py プロジェクト: tenconamei/client
    def doLogin(self):
        ''' login in the GW server 
            We are using the main login and session to check legitimity of the client.
        '''

        self.progress.setLabelText("Gating in...")
        self.progress.reset()
        self.progress.show()

        logger.info("Attempting to gate as: " + str(self.client.login))
        self.state = ClientState.NONE

        self.send(
            dict(command="hello",
                 version=util.VERSION_STRING,
                 port=self.client.gamePort,
                 login=self.client.login,
                 session=self.client.session))

        while (not self.state) and self.progress.isVisible():
            QtGui.QApplication.processEvents()

        if self.progress.wasCanceled():
            logger.warn("Gating aborted by user.")
            return False

        self.progress.close()

        if self.state == ClientState.ACCEPTED:
            logger.info("Gating accepted.")
            self.progress.close()
            self.client.actionGalacticWar.triggered.connect(self.updateOptions)
            self.client.actionGalacticWar.setEnabled(True)
            return True
            #self.connected.emit()

        elif self.state == ClientState.REJECTED:
            logger.warning("Gating rejected.")
            return False
        else:
            # A more profound error has occurrect (cancellation or disconnection)
            return False
コード例 #3
0
ファイル: _gwlobby.py プロジェクト: tenconamei/client
    def showEvent(self, event):
        if self.state != ClientState.ACCEPTED:
            fa.exe.check("gw")
            if self.doConnect():
                logger.info("connection done")
                self.doLogin()

        else:
            if not self.initDone:
                logger.info("init not done")
                self.doLogin()
            else:
                if self.faction == None:
                    logger.info("not faction")
                    self.doLogin()

        return BaseClass.showEvent(self, event)
コード例 #4
0
    def showEvent(self, event):
        if self.state != ClientState.ACCEPTED :
            fa.exe.check("gw")
            if self.doConnect():
                logger.info("connection done")
                self.doLogin()                   
        
        else :
            if not self.initDone :
                logger.info("init not done")
                self.doLogin()
            else :
                if self.faction == None :
                    logger.info("not faction")
                    self.doLogin()

        return BaseClass.showEvent(self, event)
コード例 #5
0
ファイル: _gwlobby.py プロジェクト: tenconamei/client
 def send(self, message):
     data = json.dumps(message)
     logger.info("Outgoing JSON Message: " + data)
     self.writeToServer(data)
コード例 #6
0
 def send(self, message):
     data = json.dumps(message)
     logger.info("Outgoing JSON Message: " + data)
     self.writeToServer(data)