ViewManager/ViewManager.py

changeset 155
375e3c884874
parent 128
13e96bd0f5a5
child 156
478787b5607e
equal deleted inserted replaced
154:25d288e43a6c 155:375e3c884874
139 self.autosaveTimer.setSingleShot(True) 139 self.autosaveTimer.setSingleShot(True)
140 self.connect(self.autosaveTimer, SIGNAL('timeout()'), self.__autosave) 140 self.connect(self.autosaveTimer, SIGNAL('timeout()'), self.__autosave)
141 141
142 # initialize the APIs manager 142 # initialize the APIs manager
143 self.apisManager = APIsManager(parent = self) 143 self.apisManager = APIsManager(parent = self)
144
145 self.__cooperationClient = None
144 146
145 def setReferences(self, ui, dbs): 147 def setReferences(self, ui, dbs):
146 """ 148 """
147 Public method to set some references needed later on. 149 Public method to set some references needed later on.
148 150
4919 """ 4921 """
4920 Public method to get a reference to the APIs manager. 4922 Public method to get a reference to the APIs manager.
4921 @return the APIs manager object (eric5.QScintilla.APIsManager) 4923 @return the APIs manager object (eric5.QScintilla.APIsManager)
4922 """ 4924 """
4923 return self.apisManager 4925 return self.apisManager
4926
4927 #######################################################################
4928 ## Cooperation related methods
4929 #######################################################################
4930
4931 def send(self, fileName, message):
4932 """
4933 Public method to send an editor command to remote editors.
4934
4935 @param fileName file name of the editor (string)
4936 @param message command message to be sent (string)
4937 """
4938 project = e5App().getObject("Project")
4939 if project.isProjectFile(fileName):
4940 if self.__cooperationClient is None:
4941 self.__cooperationClient = e5App().getObject("Cooperation").getClient()
4942 self.__cooperationClient.editorCommand.connect(
4943 self.__receive)
4944 self.__cooperationClient.sendEditorCommand(
4945 project.getHash(),
4946 project.getRelativeUniversalPath(fileName),
4947 message
4948 )
4949
4950 def __receive(self, hash, fileName, command):
4951 """
4952 Private slot to handle received editor commands.
4953
4954 @param hash hash of the project (string)
4955 @param fileName project relative file name of the editor (string)
4956 @param command command string (string)
4957 """
4958 project = e5App().getObject("Project")
4959 if hash == project.getHash():
4960 fn = project.getAbsoluteUniversalPath(fileName)
4961 editor = self.getOpenEditor(fn)
4962 if editor:
4963 editor.receive(command)

eric ide

mercurial