Ejemplo n.º 1
0
    def _create_server(self, try_remove=True):
        """
        Attempt to create a new local server and start listening.
        """
        if not self._server:
            self._server = QLocalServer(self)
            self._server.newConnection.connect(self._new_connection)

        if self._server.isListening():
            return True

        # If desired, remove the old server file.
        if try_remove:
            QLocalServer.removeServer(self._app_id)

        # Now, attempt to listen and return the success of that.
        return self._server.listen(self._app_id)