Fri, 26 Mar 2010 15:43:36 +0000
Added code to transmit selections to remote editors.
--- a/APIs/Python3/eric5.api Thu Mar 25 18:29:33 2010 +0000 +++ b/APIs/Python3/eric5.api Fri Mar 26 15:43:36 2010 +0000 @@ -1,15 +1,18 @@ eric5.Cooperation.ChatWidget.ChatWidget.appendMessage?4(from_, message) +eric5.Cooperation.ChatWidget.ChatWidget.getClient?4() eric5.Cooperation.ChatWidget.ChatWidget.on_connectButton_clicked?4() eric5.Cooperation.ChatWidget.ChatWidget.on_hostEdit_textChanged?4(host) eric5.Cooperation.ChatWidget.ChatWidget.on_serverButton_clicked?4() eric5.Cooperation.ChatWidget.ChatWidget.preferencesChanged?4() eric5.Cooperation.ChatWidget.ChatWidget?1(port = -1, parent = None) +eric5.Cooperation.Connection.Connection.Editor?7 eric5.Cooperation.Connection.Connection.GetParticipants?7 eric5.Cooperation.Connection.Connection.Greeting?7 eric5.Cooperation.Connection.Connection.Participants?7 eric5.Cooperation.Connection.Connection.Ping?7 eric5.Cooperation.Connection.Connection.PlainText?7 eric5.Cooperation.Connection.Connection.Pong?7 +eric5.Cooperation.Connection.Connection.ProtocolEditor?7 eric5.Cooperation.Connection.Connection.ProtocolGetParticipants?7 eric5.Cooperation.Connection.Connection.ProtocolGreeting?7 eric5.Cooperation.Connection.Connection.ProtocolMessage?7 @@ -20,11 +23,13 @@ eric5.Cooperation.Connection.Connection.ReadyForUse?7 eric5.Cooperation.Connection.Connection.Undefined?7 eric5.Cooperation.Connection.Connection.WaitingForGreeting?7 +eric5.Cooperation.Connection.Connection.editorCommand?7 eric5.Cooperation.Connection.Connection.getParticipants?7 eric5.Cooperation.Connection.Connection.name?4() eric5.Cooperation.Connection.Connection.newMessage?7 eric5.Cooperation.Connection.Connection.participants?7 eric5.Cooperation.Connection.Connection.readyForUse?7 +eric5.Cooperation.Connection.Connection.sendEditorCommand?4(projectHash, filename, message) eric5.Cooperation.Connection.Connection.sendGetParticipants?4() eric5.Cooperation.Connection.Connection.sendMessage?4(message) eric5.Cooperation.Connection.Connection.sendParticipants?4(participants) @@ -41,12 +46,14 @@ eric5.Cooperation.CooperationClient.CooperationClient.connectToHost?4(host, port) eric5.Cooperation.CooperationClient.CooperationClient.connectionError?7 eric5.Cooperation.CooperationClient.CooperationClient.disconnectConnections?4() +eric5.Cooperation.CooperationClient.CooperationClient.editorCommand?7 eric5.Cooperation.CooperationClient.CooperationClient.hasConnection?4(senderIp, senderPort = -1) eric5.Cooperation.CooperationClient.CooperationClient.hasConnections?4() eric5.Cooperation.CooperationClient.CooperationClient.newMessage?7 eric5.Cooperation.CooperationClient.CooperationClient.newParticipant?7 eric5.Cooperation.CooperationClient.CooperationClient.nickName?4() eric5.Cooperation.CooperationClient.CooperationClient.participantLeft?7 +eric5.Cooperation.CooperationClient.CooperationClient.sendEditorCommand?4(projectHash, filename, message) eric5.Cooperation.CooperationClient.CooperationClient.sendMessage?4(message) eric5.Cooperation.CooperationClient.CooperationClient.server?4() eric5.Cooperation.CooperationClient.CooperationClient?1() @@ -3901,6 +3908,7 @@ eric5.Project.Project.Project.deleteDirectory?4(dn) eric5.Project.Project.Project.deleteFile?4(fn) eric5.Project.Project.Project.deleteLanguageFile?4(langFile) +eric5.Project.Project.Project.getAbsoluteUniversalPath?4(fn) eric5.Project.Project.Project.getActions?4() eric5.Project.Project.Project.getData?4(category, key) eric5.Project.Project.Project.getDebugProperty?4(key) @@ -4172,6 +4180,8 @@ eric5.QScintilla.Editor.Editor.MethodID?7 eric5.QScintilla.Editor.Editor.MethodPrivateID?7 eric5.QScintilla.Editor.Editor.MethodProtectedID?7 +eric5.QScintilla.Editor.Editor.SelectionToken?7 +eric5.QScintilla.Editor.Editor.Separator?7 eric5.QScintilla.Editor.Editor.TemplateImageID?7 eric5.QScintilla.Editor.Editor.addClone?4(editor) eric5.QScintilla.Editor.Editor.addedToProject?4() @@ -4276,6 +4286,7 @@ eric5.QScintilla.Editor.Editor.projectLexerAssociationsChanged?4() eric5.QScintilla.Editor.Editor.readFile?4(fn, createIt = False) eric5.QScintilla.Editor.Editor.readSettings?4() +eric5.QScintilla.Editor.Editor.receive?4(command) eric5.QScintilla.Editor.Editor.redo?4() eric5.QScintilla.Editor.Editor.refresh?4() eric5.QScintilla.Editor.Editor.removeClone?4(editor) @@ -4284,6 +4295,7 @@ eric5.QScintilla.Editor.Editor.saveFileAs?4(path = None) eric5.QScintilla.Editor.Editor.selectCurrentWord?4() eric5.QScintilla.Editor.Editor.selectWord?4(line, index) +eric5.QScintilla.Editor.Editor.send?4(token, args) eric5.QScintilla.Editor.Editor.setAutoCompletionEnabled?4(enable) eric5.QScintilla.Editor.Editor.setAutoCompletionHook?4(func) eric5.QScintilla.Editor.Editor.setAutoSpellChecking?4() @@ -5681,6 +5693,7 @@ eric5.ViewManager.ViewManager.ViewManager.saveEditorEd?4(ed) eric5.ViewManager.ViewManager.ViewManager.saveEditorToProjectEd?4(ed) eric5.ViewManager.ViewManager.ViewManager.saveEditorsList?4(editors) +eric5.ViewManager.ViewManager.ViewManager.send?4(fileName, message) eric5.ViewManager.ViewManager.ViewManager.setEditorName?4(editor, newName) eric5.ViewManager.ViewManager.ViewManager.setFileLine?4(fn, line, error = False, syntaxError = False) eric5.ViewManager.ViewManager.ViewManager.setReferences?4(ui, dbs)
--- a/Cooperation/ChatWidget.py Thu Mar 25 18:29:33 2010 +0000 +++ b/Cooperation/ChatWidget.py Fri Mar 26 15:43:36 2010 +0000 @@ -237,3 +237,9 @@ self.serverPortSpin.setValue(Preferences.getCooperation("ServerPort")) if Preferences.getCooperation("AutoStartServer"): self.on_serverButton_clicked() + + def getClient(self): + """ + Public method to get a reference to the cooperation client. + """ + return self.__client
--- a/Cooperation/Connection.py Thu Mar 25 18:29:33 2010 +0000 +++ b/Cooperation/Connection.py Fri Mar 26 15:43:36 2010 +0000 @@ -38,6 +38,7 @@ Greeting = 3 GetParticipants = 4 Participants = 5 + Editor = 6 Undefined = 99 ProtocolMessage = "MESSAGE" @@ -46,11 +47,13 @@ ProtocolGreeting = "GREETING" ProtocolGetParticipants = "GET_PARTICIPANTS" ProtocolParticipants = "PARTICIPANTS" + ProtocolEditor = "EDITOR" readyForUse = pyqtSignal() newMessage = pyqtSignal(str, str) getParticipants = pyqtSignal() participants = pyqtSignal(list) + editorCommand = pyqtSignal(str, str, str) def __init__(self, parent = None): """ @@ -267,6 +270,8 @@ self.__currentDataType = Connection.GetParticipants elif self.__buffer == Connection.ProtocolParticipants: self.__currentDataType = Connection.Participants + elif self.__buffer == Connection.ProtocolEditor: + self.__currentDataType = Connection.Editor else: self.__currentDataType = Connection.Undefined self.abort() @@ -320,6 +325,9 @@ else: participantsList = msg.split(SeparatorToken) self.participants.emit(participantsList[:]) + elif self.__currentDataType == Connection.Editor: + hash, fn, msg = str(self.__buffer, encoding = "utf-8").split(SeparatorToken) + self.editorCommand.emit(hash, fn, msg) self.__currentDataType = Connection.Undefined self.__numBytesForCurrentDataType = 0 @@ -347,3 +355,18 @@ data = QByteArray("{0}{1}{2}{1}".format( Connection.ProtocolParticipants, SeparatorToken, msg.size())) + msg self.write(data) + + def sendEditorCommand(self, projectHash, filename, message): + """ + Public method to send an editor command. + + @param projectHash hash of the project (string) + @param filename project relative universal file name of + the sending editor (string) + @param message editor command to be sent (string) + """ + msg = QByteArray("{0}{1}{2}{1}{3}".format( + projectHash, SeparatorToken, filename, message).encode("utf-8")) + data = QByteArray("{0}{1}{2}{1}".format( + Connection.ProtocolEditor, SeparatorToken, msg.size())) + msg + self.write(data)
--- a/Cooperation/CooperationClient.py Thu Mar 25 18:29:33 2010 +0000 +++ b/Cooperation/CooperationClient.py Fri Mar 26 15:43:36 2010 +0000 @@ -25,12 +25,15 @@ @signal participantLeft(nickname) emitted after a participant left (string) @signal connectionError(message) emitted when a connection error occurs (string) @signal cannotConnect() emitted, if the initial connection fails + @signal editorCommand(hash, filename, message) emitted when an editor command + has been received (string, string, string) """ newMessage = pyqtSignal(str, str) newParticipant = pyqtSignal(str) participantLeft = pyqtSignal(str) connectionError = pyqtSignal(str) cannotConnect = pyqtSignal() + editorCommand = pyqtSignal(str, str, str) def __init__(self): """ @@ -203,6 +206,7 @@ connection.newMessage.connect(self.newMessage) connection.getParticipants.connect(self.__getParticipants) + connection.editorCommand.connect(self.editorCommand) self.__peers[connection.peerAddress()].append(connection) nick = connection.name() @@ -256,3 +260,16 @@ connection = Connection(self) self.__newConnection(connection) connection.connectToHost(host, port) + + def sendEditorCommand(self, projectHash, filename, message): + """ + Public method to send an editor command. + + @param projectHash hash of the project (string) + @param filename project relative universal file name of + the sending editor (string) + @param message editor command to be sent (string) + """ + for connectionList in self.__peers.values(): + for connection in connectionList: + connection.sendEditorCommand(projectHash, filename, message)
--- a/Documentation/Help/source.qhp Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Help/source.qhp Fri Mar 26 15:43:36 2010 +0000 @@ -3191,6 +3191,7 @@ <keyword name="ChatWidget.__setConnected" id="ChatWidget.__setConnected" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.__setConnected" /> <keyword name="ChatWidget.__showErrorMessage" id="ChatWidget.__showErrorMessage" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.__showErrorMessage" /> <keyword name="ChatWidget.appendMessage" id="ChatWidget.appendMessage" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.appendMessage" /> + <keyword name="ChatWidget.getClient" id="ChatWidget.getClient" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.getClient" /> <keyword name="ChatWidget.on_connectButton_clicked" id="ChatWidget.on_connectButton_clicked" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.on_connectButton_clicked" /> <keyword name="ChatWidget.on_hostEdit_textChanged" id="ChatWidget.on_hostEdit_textChanged" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.on_hostEdit_textChanged" /> <keyword name="ChatWidget.on_serverButton_clicked" id="ChatWidget.on_serverButton_clicked" ref="eric5.Cooperation.ChatWidget.html#ChatWidget.on_serverButton_clicked" /> @@ -3207,6 +3208,7 @@ <keyword name="Connection.__sendGreetingMessage" id="Connection.__sendGreetingMessage" ref="eric5.Cooperation.Connection.html#Connection.__sendGreetingMessage" /> <keyword name="Connection.__sendPing" id="Connection.__sendPing" ref="eric5.Cooperation.Connection.html#Connection.__sendPing" /> <keyword name="Connection.name" id="Connection.name" ref="eric5.Cooperation.Connection.html#Connection.name" /> + <keyword name="Connection.sendEditorCommand" id="Connection.sendEditorCommand" ref="eric5.Cooperation.Connection.html#Connection.sendEditorCommand" /> <keyword name="Connection.sendGetParticipants" id="Connection.sendGetParticipants" ref="eric5.Cooperation.Connection.html#Connection.sendGetParticipants" /> <keyword name="Connection.sendMessage" id="Connection.sendMessage" ref="eric5.Cooperation.Connection.html#Connection.sendMessage" /> <keyword name="Connection.sendParticipants" id="Connection.sendParticipants" ref="eric5.Cooperation.Connection.html#Connection.sendParticipants" /> @@ -3233,6 +3235,7 @@ <keyword name="CooperationClient.hasConnection" id="CooperationClient.hasConnection" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.hasConnection" /> <keyword name="CooperationClient.hasConnections" id="CooperationClient.hasConnections" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.hasConnections" /> <keyword name="CooperationClient.nickName" id="CooperationClient.nickName" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.nickName" /> + <keyword name="CooperationClient.sendEditorCommand" id="CooperationClient.sendEditorCommand" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.sendEditorCommand" /> <keyword name="CooperationClient.sendMessage" id="CooperationClient.sendMessage" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.sendMessage" /> <keyword name="CooperationClient.server" id="CooperationClient.server" ref="eric5.Cooperation.CooperationClient.html#CooperationClient.server" /> <keyword name="ViewManager (Package)" id="ViewManager (Package)" ref="index-eric5.ViewManager.html" /> @@ -3327,6 +3330,7 @@ <keyword name="ViewManager.__quickSearchMarkOccurrences" id="ViewManager.__quickSearchMarkOccurrences" ref="eric5.ViewManager.ViewManager.html#ViewManager.__quickSearchMarkOccurrences" /> <keyword name="ViewManager.__quickSearchPrev" id="ViewManager.__quickSearchPrev" ref="eric5.ViewManager.ViewManager.html#ViewManager.__quickSearchPrev" /> <keyword name="ViewManager.__quickSearchText" id="ViewManager.__quickSearchText" ref="eric5.ViewManager.ViewManager.html#ViewManager.__quickSearchText" /> + <keyword name="ViewManager.__receive" id="ViewManager.__receive" ref="eric5.ViewManager.ViewManager.html#ViewManager.__receive" /> <keyword name="ViewManager.__replace" id="ViewManager.__replace" ref="eric5.ViewManager.ViewManager.html#ViewManager.__replace" /> <keyword name="ViewManager.__replaceFiles" id="ViewManager.__replaceFiles" ref="eric5.ViewManager.ViewManager.html#ViewManager.__replaceFiles" /> <keyword name="ViewManager.__saveRecent" id="ViewManager.__saveRecent" ref="eric5.ViewManager.ViewManager.html#ViewManager.__saveRecent" /> @@ -3433,6 +3437,7 @@ <keyword name="ViewManager.saveEditorEd" id="ViewManager.saveEditorEd" ref="eric5.ViewManager.ViewManager.html#ViewManager.saveEditorEd" /> <keyword name="ViewManager.saveEditorToProjectEd" id="ViewManager.saveEditorToProjectEd" ref="eric5.ViewManager.ViewManager.html#ViewManager.saveEditorToProjectEd" /> <keyword name="ViewManager.saveEditorsList" id="ViewManager.saveEditorsList" ref="eric5.ViewManager.ViewManager.html#ViewManager.saveEditorsList" /> + <keyword name="ViewManager.send" id="ViewManager.send" ref="eric5.ViewManager.ViewManager.html#ViewManager.send" /> <keyword name="ViewManager.setEditorName" id="ViewManager.setEditorName" ref="eric5.ViewManager.ViewManager.html#ViewManager.setEditorName" /> <keyword name="ViewManager.setFileLine" id="ViewManager.setFileLine" ref="eric5.ViewManager.ViewManager.html#ViewManager.setFileLine" /> <keyword name="ViewManager.setReferences" id="ViewManager.setReferences" ref="eric5.ViewManager.ViewManager.html#ViewManager.setReferences" /> @@ -4473,6 +4478,7 @@ <keyword name="Project.deleteDirectory" id="Project.deleteDirectory" ref="eric5.Project.Project.html#Project.deleteDirectory" /> <keyword name="Project.deleteFile" id="Project.deleteFile" ref="eric5.Project.Project.html#Project.deleteFile" /> <keyword name="Project.deleteLanguageFile" id="Project.deleteLanguageFile" ref="eric5.Project.Project.html#Project.deleteLanguageFile" /> + <keyword name="Project.getAbsoluteUniversalPath" id="Project.getAbsoluteUniversalPath" ref="eric5.Project.Project.html#Project.getAbsoluteUniversalPath" /> <keyword name="Project.getActions" id="Project.getActions" ref="eric5.Project.Project.html#Project.getActions" /> <keyword name="Project.getData" id="Project.getData" ref="eric5.Project.Project.html#Project.getData" /> <keyword name="Project.getDebugProperty" id="Project.getDebugProperty" ref="eric5.Project.Project.html#Project.getDebugProperty" /> @@ -5531,6 +5537,7 @@ <keyword name="Editor.__newViewNewSplit" id="Editor.__newViewNewSplit" ref="eric5.QScintilla.Editor.html#Editor.__newViewNewSplit" /> <keyword name="Editor.__normalizedEncoding" id="Editor.__normalizedEncoding" ref="eric5.QScintilla.Editor.html#Editor.__normalizedEncoding" /> <keyword name="Editor.__printPreview" id="Editor.__printPreview" ref="eric5.QScintilla.Editor.html#Editor.__printPreview" /> + <keyword name="Editor.__processSelectionCommand" id="Editor.__processSelectionCommand" ref="eric5.QScintilla.Editor.html#Editor.__processSelectionCommand" /> <keyword name="Editor.__projectPropertiesChanged" id="Editor.__projectPropertiesChanged" ref="eric5.QScintilla.Editor.html#Editor.__projectPropertiesChanged" /> <keyword name="Editor.__registerImages" id="Editor.__registerImages" ref="eric5.QScintilla.Editor.html#Editor.__registerImages" /> <keyword name="Editor.__removeFromSpellingDictionary" id="Editor.__removeFromSpellingDictionary" ref="eric5.QScintilla.Editor.html#Editor.__removeFromSpellingDictionary" /> @@ -5539,6 +5546,7 @@ <keyword name="Editor.__restoreBreakpoints" id="Editor.__restoreBreakpoints" ref="eric5.QScintilla.Editor.html#Editor.__restoreBreakpoints" /> <keyword name="Editor.__selectAll" id="Editor.__selectAll" ref="eric5.QScintilla.Editor.html#Editor.__selectAll" /> <keyword name="Editor.__selectPygmentsLexer" id="Editor.__selectPygmentsLexer" ref="eric5.QScintilla.Editor.html#Editor.__selectPygmentsLexer" /> + <keyword name="Editor.__selectionChanged" id="Editor.__selectionChanged" ref="eric5.QScintilla.Editor.html#Editor.__selectionChanged" /> <keyword name="Editor.__setAutoCompletion" id="Editor.__setAutoCompletion" ref="eric5.QScintilla.Editor.html#Editor.__setAutoCompletion" /> <keyword name="Editor.__setCallTips" id="Editor.__setCallTips" ref="eric5.QScintilla.Editor.html#Editor.__setCallTips" /> <keyword name="Editor.__setEolMode" id="Editor.__setEolMode" ref="eric5.QScintilla.Editor.html#Editor.__setEolMode" /> @@ -5677,6 +5685,7 @@ <keyword name="Editor.projectLexerAssociationsChanged" id="Editor.projectLexerAssociationsChanged" ref="eric5.QScintilla.Editor.html#Editor.projectLexerAssociationsChanged" /> <keyword name="Editor.readFile" id="Editor.readFile" ref="eric5.QScintilla.Editor.html#Editor.readFile" /> <keyword name="Editor.readSettings" id="Editor.readSettings" ref="eric5.QScintilla.Editor.html#Editor.readSettings" /> + <keyword name="Editor.receive" id="Editor.receive" ref="eric5.QScintilla.Editor.html#Editor.receive" /> <keyword name="Editor.redo" id="Editor.redo" ref="eric5.QScintilla.Editor.html#Editor.redo" /> <keyword name="Editor.refresh" id="Editor.refresh" ref="eric5.QScintilla.Editor.html#Editor.refresh" /> <keyword name="Editor.removeClone" id="Editor.removeClone" ref="eric5.QScintilla.Editor.html#Editor.removeClone" /> @@ -5685,6 +5694,7 @@ <keyword name="Editor.saveFileAs" id="Editor.saveFileAs" ref="eric5.QScintilla.Editor.html#Editor.saveFileAs" /> <keyword name="Editor.selectCurrentWord" id="Editor.selectCurrentWord" ref="eric5.QScintilla.Editor.html#Editor.selectCurrentWord" /> <keyword name="Editor.selectWord" id="Editor.selectWord" ref="eric5.QScintilla.Editor.html#Editor.selectWord" /> + <keyword name="Editor.send" id="Editor.send" ref="eric5.QScintilla.Editor.html#Editor.send" /> <keyword name="Editor.setAutoCompletionEnabled" id="Editor.setAutoCompletionEnabled" ref="eric5.QScintilla.Editor.html#Editor.setAutoCompletionEnabled" /> <keyword name="Editor.setAutoCompletionHook" id="Editor.setAutoCompletionHook" ref="eric5.QScintilla.Editor.html#Editor.setAutoCompletionHook" /> <keyword name="Editor.setAutoSpellChecking" id="Editor.setAutoSpellChecking" ref="eric5.QScintilla.Editor.html#Editor.setAutoSpellChecking" />
--- a/Documentation/Source/eric5.Cooperation.ChatWidget.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.Cooperation.ChatWidget.html Fri Mar 26 15:43:36 2010 +0000 @@ -78,6 +78,9 @@ <td><a href="#ChatWidget.appendMessage">appendMessage</a></td> <td>Public slot to append a message to the display.</td> </tr><tr> +<td><a href="#ChatWidget.getClient">getClient</a></td> +<td>Public method to get a reference to the cooperation client.</td> +</tr><tr> <td><a href="#ChatWidget.on_connectButton_clicked">on_connectButton_clicked</a></td> <td>Private slot initiating the connection.</td> </tr><tr> @@ -167,7 +170,12 @@ <dd> message to be appended (string) </dd> -</dl><a NAME="ChatWidget.on_connectButton_clicked" ID="ChatWidget.on_connectButton_clicked"></a> +</dl><a NAME="ChatWidget.getClient" ID="ChatWidget.getClient"></a> +<h4>ChatWidget.getClient</h4> +<b>getClient</b>(<i></i>) +<p> + Public method to get a reference to the cooperation client. +</p><a NAME="ChatWidget.on_connectButton_clicked" ID="ChatWidget.on_connectButton_clicked"></a> <h4>ChatWidget.on_connectButton_clicked</h4> <b>on_connectButton_clicked</b>(<i></i>) <p>
--- a/Documentation/Source/eric5.Cooperation.Connection.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.Cooperation.Connection.html Fri Mar 26 15:43:36 2010 +0000 @@ -66,7 +66,7 @@ QTcpSocket <h3>Class Attributes</h3> <table> -<tr><td>GetParticipants</td></tr><tr><td>Greeting</td></tr><tr><td>Participants</td></tr><tr><td>Ping</td></tr><tr><td>PlainText</td></tr><tr><td>Pong</td></tr><tr><td>ProtocolGetParticipants</td></tr><tr><td>ProtocolGreeting</td></tr><tr><td>ProtocolMessage</td></tr><tr><td>ProtocolParticipants</td></tr><tr><td>ProtocolPing</td></tr><tr><td>ProtocolPong</td></tr><tr><td>ReadingGreeting</td></tr><tr><td>ReadyForUse</td></tr><tr><td>Undefined</td></tr><tr><td>WaitingForGreeting</td></tr><tr><td>getParticipants</td></tr><tr><td>newMessage</td></tr><tr><td>participants</td></tr><tr><td>readyForUse</td></tr> +<tr><td>Editor</td></tr><tr><td>GetParticipants</td></tr><tr><td>Greeting</td></tr><tr><td>Participants</td></tr><tr><td>Ping</td></tr><tr><td>PlainText</td></tr><tr><td>Pong</td></tr><tr><td>ProtocolEditor</td></tr><tr><td>ProtocolGetParticipants</td></tr><tr><td>ProtocolGreeting</td></tr><tr><td>ProtocolMessage</td></tr><tr><td>ProtocolParticipants</td></tr><tr><td>ProtocolPing</td></tr><tr><td>ProtocolPong</td></tr><tr><td>ReadingGreeting</td></tr><tr><td>ReadyForUse</td></tr><tr><td>Undefined</td></tr><tr><td>WaitingForGreeting</td></tr><tr><td>editorCommand</td></tr><tr><td>getParticipants</td></tr><tr><td>newMessage</td></tr><tr><td>participants</td></tr><tr><td>readyForUse</td></tr> </table> <h3>Methods</h3> <table> @@ -101,6 +101,9 @@ <td><a href="#Connection.name">name</a></td> <td>Public method to get the connection name.</td> </tr><tr> +<td><a href="#Connection.sendEditorCommand">sendEditorCommand</a></td> +<td>Public method to send an editor command.</td> +</tr><tr> <td><a href="#Connection.sendGetParticipants">sendGetParticipants</a></td> <td>Public method to request a list of participants.</td> </tr><tr> @@ -205,6 +208,23 @@ <dd> connection name (string) </dd> +</dl><a NAME="Connection.sendEditorCommand" ID="Connection.sendEditorCommand"></a> +<h4>Connection.sendEditorCommand</h4> +<b>sendEditorCommand</b>(<i>projectHash, filename, message</i>) +<p> + Public method to send an editor command. +</p><dl> +<dt><i>projectHash</i></dt> +<dd> +hash of the project (string) +</dd><dt><i>filename</i></dt> +<dd> +project relative universal file name of + the sending editor (string) +</dd><dt><i>message</i></dt> +<dd> +editor command to be sent (string) +</dd> </dl><a NAME="Connection.sendGetParticipants" ID="Connection.sendGetParticipants"></a> <h4>Connection.sendGetParticipants</h4> <b>sendGetParticipants</b>(<i></i>)
--- a/Documentation/Source/eric5.Cooperation.CooperationClient.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.Cooperation.CooperationClient.html Fri Mar 26 15:43:36 2010 +0000 @@ -52,6 +52,10 @@ </dd><dt>connectionError(message)</dt> <dd> emitted when a connection error occurs (string) +</dd><dt>editorCommand(hash, filename, message)</dt> +<dd> +emitted when an editor command + has been received (string, string, string) </dd><dt>newMessage(user, message)</dt> <dd> emitted after a new message has @@ -68,7 +72,7 @@ QObject <h3>Class Attributes</h3> <table> -<tr><td>cannotConnect</td></tr><tr><td>connectionError</td></tr><tr><td>newMessage</td></tr><tr><td>newParticipant</td></tr><tr><td>participantLeft</td></tr> +<tr><td>cannotConnect</td></tr><tr><td>connectionError</td></tr><tr><td>editorCommand</td></tr><tr><td>newMessage</td></tr><tr><td>newParticipant</td></tr><tr><td>participantLeft</td></tr> </table> <h3>Methods</h3> <table> @@ -112,6 +116,9 @@ <td><a href="#CooperationClient.nickName">nickName</a></td> <td>Public method to get the nick name.</td> </tr><tr> +<td><a href="#CooperationClient.sendEditorCommand">sendEditorCommand</a></td> +<td>Public method to send an editor command.</td> +</tr><tr> <td><a href="#CooperationClient.sendMessage">sendMessage</a></td> <td>Public method to send a message.</td> </tr><tr> @@ -235,6 +242,23 @@ <dd> nick name (string) </dd> +</dl><a NAME="CooperationClient.sendEditorCommand" ID="CooperationClient.sendEditorCommand"></a> +<h4>CooperationClient.sendEditorCommand</h4> +<b>sendEditorCommand</b>(<i>projectHash, filename, message</i>) +<p> + Public method to send an editor command. +</p><dl> +<dt><i>projectHash</i></dt> +<dd> +hash of the project (string) +</dd><dt><i>filename</i></dt> +<dd> +project relative universal file name of + the sending editor (string) +</dd><dt><i>message</i></dt> +<dd> +editor command to be sent (string) +</dd> </dl><a NAME="CooperationClient.sendMessage" ID="CooperationClient.sendMessage"></a> <h4>CooperationClient.sendMessage</h4> <b>sendMessage</b>(<i>message</i>)
--- a/Documentation/Source/eric5.Project.Project.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.Project.Project.html Fri Mar 26 15:43:36 2010 +0000 @@ -391,6 +391,9 @@ <td><a href="#Project.deleteLanguageFile">deleteLanguageFile</a></td> <td>Public slot to delete a translation from the project directory.</td> </tr><tr> +<td><a href="#Project.getAbsoluteUniversalPath">getAbsoluteUniversalPath</a></td> +<td>Public method to convert a project relative file path with universal separators to an absolute file path.</td> +</tr><tr> <td><a href="#Project.getActions">getActions</a></td> <td>Public method to get a list of all actions.</td> </tr><tr> @@ -1362,6 +1365,22 @@ <dd> the translation file to be removed (string) </dd> +</dl><a NAME="Project.getAbsoluteUniversalPath" ID="Project.getAbsoluteUniversalPath"></a> +<h4>Project.getAbsoluteUniversalPath</h4> +<b>getAbsoluteUniversalPath</b>(<i>fn</i>) +<p> + Public method to convert a project relative file path with universal + separators to an absolute file path. +</p><dl> +<dt><i>fn</i></dt> +<dd> +file or directory name to convert (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +absolute path (string) +</dd> </dl><a NAME="Project.getActions" ID="Project.getActions"></a> <h4>Project.getActions</h4> <b>getActions</b>(<i></i>)
--- a/Documentation/Source/eric5.QScintilla.Editor.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.QScintilla.Editor.html Fri Mar 26 15:43:36 2010 +0000 @@ -117,7 +117,7 @@ QsciScintillaCompat <h3>Class Attributes</h3> <table> -<tr><td>AttributeID</td></tr><tr><td>AttributePrivateID</td></tr><tr><td>AttributeProtectedID</td></tr><tr><td>ClassID</td></tr><tr><td>ClassPrivateID</td></tr><tr><td>ClassProtectedID</td></tr><tr><td>EnumID</td></tr><tr><td>FromDocumentID</td></tr><tr><td>MethodID</td></tr><tr><td>MethodPrivateID</td></tr><tr><td>MethodProtectedID</td></tr><tr><td>TemplateImageID</td></tr> +<tr><td>AttributeID</td></tr><tr><td>AttributePrivateID</td></tr><tr><td>AttributeProtectedID</td></tr><tr><td>ClassID</td></tr><tr><td>ClassPrivateID</td></tr><tr><td>ClassProtectedID</td></tr><tr><td>EnumID</td></tr><tr><td>FromDocumentID</td></tr><tr><td>MethodID</td></tr><tr><td>MethodPrivateID</td></tr><tr><td>MethodProtectedID</td></tr><tr><td>SelectionToken</td></tr><tr><td>Separator</td></tr><tr><td>TemplateImageID</td></tr> </table> <h3>Methods</h3> <table> @@ -353,6 +353,9 @@ <td><a href="#Editor.__printPreview">__printPreview</a></td> <td>Private slot to generate a print preview.</td> </tr><tr> +<td><a href="#Editor.__processSelectionCommand">__processSelectionCommand</a></td> +<td>Private slot to process a remote selection command</td> +</tr><tr> <td><a href="#Editor.__projectPropertiesChanged">__projectPropertiesChanged</a></td> <td>Private slot to handle changes of the project properties.</td> </tr><tr> @@ -377,6 +380,9 @@ <td><a href="#Editor.__selectPygmentsLexer">__selectPygmentsLexer</a></td> <td>Private method to select a specific pygments lexer.</td> </tr><tr> +<td><a href="#Editor.__selectionChanged">__selectionChanged</a></td> +<td>Private slot to handle a change of the selection.</td> +</tr><tr> <td><a href="#Editor.__setAutoCompletion">__setAutoCompletion</a></td> <td>Private method to configure the autocompletion function.</td> </tr><tr> @@ -791,6 +797,9 @@ <td><a href="#Editor.readSettings">readSettings</a></td> <td>Public slot to read the settings into our lexer.</td> </tr><tr> +<td><a href="#Editor.receive">receive</a></td> +<td>Public slot to handle received editor commands.</td> +</tr><tr> <td><a href="#Editor.redo">redo</a></td> <td>Public method to redo the last recorded change.</td> </tr><tr> @@ -815,6 +824,9 @@ <td><a href="#Editor.selectWord">selectWord</a></td> <td>Public method to select the word at a position.</td> </tr><tr> +<td><a href="#Editor.send">send</a></td> +<td>Public method to send an editor command to remote editors.</td> +</tr><tr> <td><a href="#Editor.setAutoCompletionEnabled">setAutoCompletionEnabled</a></td> <td>Public method to enable/disable autocompletion.</td> </tr><tr> @@ -1526,6 +1538,16 @@ <dd> reference to the printer object (QScintilla.Printer.Printer) </dd> +</dl><a NAME="Editor.__processSelectionCommand" ID="Editor.__processSelectionCommand"></a> +<h4>Editor.__processSelectionCommand</h4> +<b>__processSelectionCommand</b>(<i>argsString</i>) +<p> + Private slot to process a remote selection command +</p><dl> +<dt><i>argsString</i></dt> +<dd> +string containing the selection parameters (string) +</dd> </dl><a NAME="Editor.__projectPropertiesChanged" ID="Editor.__projectPropertiesChanged"></a> <h4>Editor.__projectPropertiesChanged</h4> <b>__projectPropertiesChanged</b>(<i></i>) @@ -1576,7 +1598,12 @@ <dd> name of the selected pygments lexer (string) </dd> -</dl><a NAME="Editor.__setAutoCompletion" ID="Editor.__setAutoCompletion"></a> +</dl><a NAME="Editor.__selectionChanged" ID="Editor.__selectionChanged"></a> +<h4>Editor.__selectionChanged</h4> +<b>__selectionChanged</b>(<i></i>) +<p> + Private slot to handle a change of the selection. +</p><a NAME="Editor.__setAutoCompletion" ID="Editor.__setAutoCompletion"></a> <h4>Editor.__setAutoCompletion</h4> <b>__setAutoCompletion</b>(<i></i>) <p> @@ -2729,7 +2756,17 @@ <b>readSettings</b>(<i></i>) <p> Public slot to read the settings into our lexer. -</p><a NAME="Editor.redo" ID="Editor.redo"></a> +</p><a NAME="Editor.receive" ID="Editor.receive"></a> +<h4>Editor.receive</h4> +<b>receive</b>(<i>command</i>) +<p> + Public slot to handle received editor commands. +</p><dl> +<dt><i>command</i></dt> +<dd> +command string (string) +</dd> +</dl><a NAME="Editor.redo" ID="Editor.redo"></a> <h4>Editor.redo</h4> <b>redo</b>(<i></i>) <p> @@ -2807,6 +2844,19 @@ <dd> position to look at (int) </dd> +</dl><a NAME="Editor.send" ID="Editor.send"></a> +<h4>Editor.send</h4> +<b>send</b>(<i>token, args</i>) +<p> + Public method to send an editor command to remote editors. +</p><dl> +<dt><i>token</i></dt> +<dd> +command token (string) +</dd><dt><i>args</i></dt> +<dd> +arguments for the command (string) +</dd> </dl><a NAME="Editor.setAutoCompletionEnabled" ID="Editor.setAutoCompletionEnabled"></a> <h4>Editor.setAutoCompletionEnabled</h4> <b>setAutoCompletionEnabled</b>(<i>enable</i>)
--- a/Documentation/Source/eric5.ViewManager.ViewManager.html Thu Mar 25 18:29:33 2010 +0000 +++ b/Documentation/Source/eric5.ViewManager.ViewManager.html Fri Mar 26 15:43:36 2010 +0000 @@ -416,6 +416,9 @@ <td><a href="#ViewManager.__quickSearchText">__quickSearchText</a></td> <td>Private slot to handle the textChanged signal of the quicksearch edit.</td> </tr><tr> +<td><a href="#ViewManager.__receive">__receive</a></td> +<td>Private slot to handle received editor commands.</td> +</tr><tr> <td><a href="#ViewManager.__replace">__replace</a></td> <td>Private method to handle the replace action.</td> </tr><tr> @@ -734,6 +737,9 @@ <td><a href="#ViewManager.saveEditorsList">saveEditorsList</a></td> <td>Public slot to save a list of editors.</td> </tr><tr> +<td><a href="#ViewManager.send">send</a></td> +<td>Public method to send an editor command to remote editors.</td> +</tr><tr> <td><a href="#ViewManager.setEditorName">setEditorName</a></td> <td>Public method to change the displayed name of the editor.</td> </tr><tr> @@ -1275,7 +1281,23 @@ <b>__quickSearchText</b>(<i></i>) <p> Private slot to handle the textChanged signal of the quicksearch edit. -</p><a NAME="ViewManager.__replace" ID="ViewManager.__replace"></a> +</p><a NAME="ViewManager.__receive" ID="ViewManager.__receive"></a> +<h4>ViewManager.__receive</h4> +<b>__receive</b>(<i>hash, fileName, command</i>) +<p> + Private slot to handle received editor commands. +</p><dl> +<dt><i>hash</i></dt> +<dd> +hash of the project (string) +</dd><dt><i>fileName</i></dt> +<dd> +project relative file name of the editor (string) +</dd><dt><i>command</i></dt> +<dd> +command string (string) +</dd> +</dl><a NAME="ViewManager.__replace" ID="ViewManager.__replace"></a> <h4>ViewManager.__replace</h4> <b>__replace</b>(<i></i>) <p> @@ -2346,6 +2368,19 @@ <dd> list of editors to be saved </dd> +</dl><a NAME="ViewManager.send" ID="ViewManager.send"></a> +<h4>ViewManager.send</h4> +<b>send</b>(<i>fileName, message</i>) +<p> + Public method to send an editor command to remote editors. +</p><dl> +<dt><i>fileName</i></dt> +<dd> +file name of the editor (string) +</dd><dt><i>message</i></dt> +<dd> +command message to be sent (string) +</dd> </dl><a NAME="ViewManager.setEditorName" ID="ViewManager.setEditorName"></a> <h4>ViewManager.setEditorName</h4> <b>setEditorName</b>(<i>editor, newName</i>)
--- a/Project/Project.py Thu Mar 25 18:29:33 2010 +0000 +++ b/Project/Project.py Fri Mar 26 15:43:36 2010 +0000 @@ -3186,6 +3186,18 @@ """ return Utilities.fromNativeSeparators(fn.replace(self.ppath + os.sep, "")) + def getAbsoluteUniversalPath(self, fn): + """ + Public method to convert a project relative file path with universal + separators to an absolute file path. + + @param fn file or directory name to convert (string) + @return absolute path (string) + """ + if not os.path.isabs(fn): + fn = os.path.join(self.ppath, Utilities.toNativeSeparators(fn)) + return fn + def isProjectFile(self, fn): """ Public method used to check, if the passed in filename belongs to the project.
--- a/QScintilla/Editor.py Thu Mar 25 18:29:33 2010 +0000 +++ b/QScintilla/Editor.py Fri Mar 26 15:43:36 2010 +0000 @@ -77,6 +77,7 @@ @signal encodingChanged(encoding) emitted when the editors encoding was set. The encoding name is passed as a parameter. """ + # Autocompletion icon definitions ClassID = 1 ClassProtectedID = 2 ClassPrivateID = 3 @@ -92,6 +93,11 @@ TemplateImageID = 100 + # Cooperation related definitions + Separator = "@@@" + + SelectionToken = "SELECT" + def __init__(self, dbs, fn = None, vm = None, filetype = "", editor = None, tv = None): """ @@ -168,7 +174,7 @@ self.clearAlternateKeys() self.clearKeys() - # initialise the mark occurrences timer + # initialize the mark occurrences timer self.__markOccurrencesTimer = QTimer(self) self.__markOccurrencesTimer.setSingleShot(True) self.__markOccurrencesTimer.setInterval( @@ -177,11 +183,14 @@ self.__markOccurrences) self.__markedText = "" - # initialise some spellchecking stuff + # initialize some spellchecking stuff self.spell = None self.lastLine = 0 self.lastIndex = 0 + # initialize some cooperation stuff + self.__lastSelection = (-1, -1, -1, -1) + self.connect(self, SIGNAL('modificationChanged(bool)'), self.__modificationChanged) self.connect(self, SIGNAL('cursorPositionChanged(int,int)'), @@ -190,6 +199,8 @@ self.__modificationReadOnly) self.connect(self, SIGNAL('userListActivated(int, const QString)'), self.__completionListSelected) + self.connect(self, SIGNAL('selectionChanged()'), + self.__selectionChanged) # margins layout if QSCINTILLA_VERSION() >= 0x020301: @@ -5463,3 +5474,55 @@ self.spell.ignoreAlways(word) if Preferences.getEditor("AutoSpellCheckingEnabled"): self.spell.checkDocumentIncrementally() + + ####################################################################### + ## Cooperation related methods + ####################################################################### + + def send(self, token, args): + """ + Public method to send an editor command to remote editors. + + @param token command token (string) + @param args arguments for the command (string) + """ + msg = "" + if token == Editor.SelectionToken: + msg = "{0}{1}{2} {3} {4} {5}".format( + token, + Editor.Separator, + *args + ) + + self.vm.send(self.fileName, msg) + + def receive(self, command): + """ + Public slot to handle received editor commands. + + @param command command string (string) + """ + token, argsString = command.split(Editor.Separator) + if token == Editor.SelectionToken: + self.__processSelectionCommand(argsString) + + def __selectionChanged(self): + """ + Private slot to handle a change of the selection. + """ + sel = self.getSelection() + if sel != self.__lastSelection: + self.send(Editor.SelectionToken, args = sel) + self.__lastSelection = sel + + def __processSelectionCommand(self, argsString): + """ + Private slot to process a remote selection command + + @param argsString string containing the selection parameters (string) + """ + self.selectionChanged.disconnect(self.__selectionChanged) + args = argsString.split() + self.setSelection(int(args[0]), int(args[1]), int(args[2]), int(args[3])) + self.ensureLineVisible(int(args[0])) + self.selectionChanged.connect(self.__selectionChanged)
--- a/ViewManager/ViewManager.py Thu Mar 25 18:29:33 2010 +0000 +++ b/ViewManager/ViewManager.py Fri Mar 26 15:43:36 2010 +0000 @@ -142,6 +142,8 @@ # initialize the APIs manager self.apisManager = APIsManager(parent = self) + self.__cooperationClient = None + def setReferences(self, ui, dbs): """ Public method to set some references needed later on. @@ -4921,3 +4923,41 @@ @return the APIs manager object (eric5.QScintilla.APIsManager) """ return self.apisManager + + ####################################################################### + ## Cooperation related methods + ####################################################################### + + def send(self, fileName, message): + """ + Public method to send an editor command to remote editors. + + @param fileName file name of the editor (string) + @param message command message to be sent (string) + """ + project = e5App().getObject("Project") + if project.isProjectFile(fileName): + if self.__cooperationClient is None: + self.__cooperationClient = e5App().getObject("Cooperation").getClient() + self.__cooperationClient.editorCommand.connect( + self.__receive) + self.__cooperationClient.sendEditorCommand( + project.getHash(), + project.getRelativeUniversalPath(fileName), + message + ) + + def __receive(self, hash, fileName, command): + """ + Private slot to handle received editor commands. + + @param hash hash of the project (string) + @param fileName project relative file name of the editor (string) + @param command command string (string) + """ + project = e5App().getObject("Project") + if hash == project.getHash(): + fn = project.getAbsoluteUniversalPath(fileName) + editor = self.getOpenEditor(fn) + if editor: + editor.receive(command)