--- a/RefactoringRope/JsonServer.py Sun Sep 24 19:28:31 2017 +0200 +++ b/RefactoringRope/JsonServer.py Sun Sep 24 19:36:17 2017 +0200 @@ -53,7 +53,7 @@ self.__hostAddress = '::1' self.listen(QHostAddress(self.__hostAddress)) - self.newConnection.connect(self.__handleNewConnection) + self.newConnection.connect(self.handleNewConnection) port = self.serverPort() ## Note: Need the port if started external in debugger: @@ -61,9 +61,9 @@ # __IGNORE_WARNING__ @pyqtSlot() - def __handleNewConnection(self): + def handleNewConnection(self): """ - Private slot for new incoming connections from a client. + Public slot for new incoming connections from a client. """ connection = self.nextPendingConnection() if not connection.isValid(): @@ -88,8 +88,6 @@ lambda: self.__receiveJson(idString)) connection.disconnected.connect( lambda: self.__handleDisconnect(idString)) - - self.sendJson("GetConfig", {}) @pyqtSlot() def __handleDisconnect(self, idString): @@ -150,20 +148,6 @@ self.handleCall(method, params) - def handleCall(self, method, params): - """ - Public method to handle a method call from the client. - - Note: This is an empty implementation that must be overridden in - derived classes. - - @param method requested method name - @type str - @param params dictionary with method specific parameters - @type dict - """ - pass - def sendJson(self, command, params, flush=False, idString=""): """ Public method to send a single command to a client. @@ -249,3 +233,21 @@ if self.__clientProcess is not None: self.__clientProcess.close() self.__clientProcess = None + + ####################################################################### + ## The following methods should be overridden by derived classes + ####################################################################### + + def handleCall(self, method, params): + """ + Public method to handle a method call from the client. + + Note: This is an empty implementation that must be overridden in + derived classes. + + @param method requested method name + @type str + @param params dictionary with method specific parameters + @type dict + """ + pass