E4XML/SessionWriter.py

changeset 6
52e8c820d0dd
parent 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
5:fa319c01b604 6:52e8c820d0dd
70 70
71 # step 1: save all open (project) filenames and the active window 71 # step 1: save all open (project) filenames and the active window
72 allOpenFiles = self.vm.getOpenFilenames() 72 allOpenFiles = self.vm.getOpenFilenames()
73 self._write(" <Filenames>") 73 self._write(" <Filenames>")
74 for of in allOpenFiles: 74 for of in allOpenFiles:
75 if isGlobal or unicode(of).startswith(self.project.ppath): 75 if isGlobal or of.startswith(self.project.ppath):
76 ed = self.vm.getOpenEditor(of) 76 ed = self.vm.getOpenEditor(of)
77 if ed is not None: 77 if ed is not None:
78 line, index = ed.getCursorPosition() 78 line, index = ed.getCursorPosition()
79 folds = ','.join([str(i + 1) for i in ed.getFolds()]) 79 folds = ','.join([str(i + 1) for i in ed.getFolds()])
80 else: 80 else:
83 self._write(' <Filename cline="%d" cindex="%d" folds="%s">%s</Filename>' % \ 83 self._write(' <Filename cline="%d" cindex="%d" folds="%s">%s</Filename>' % \
84 (line, index, folds, of)) 84 (line, index, folds, of))
85 self._write(" </Filenames>") 85 self._write(" </Filenames>")
86 86
87 aw = self.vm.getActiveName() 87 aw = self.vm.getActiveName()
88 if aw and unicode(aw).startswith(self.project.ppath): 88 if aw and aw.startswith(self.project.ppath):
89 ed = self.vm.getOpenEditor(aw) 89 ed = self.vm.getOpenEditor(aw)
90 if ed is not None: 90 if ed is not None:
91 line, index = ed.getCursorPosition() 91 line, index = ed.getCursorPosition()
92 else: 92 else:
93 line, index = 0, 0 93 line, index = 0, 0
187 self._write(" </DebugInfo>") 187 self._write(" </DebugInfo>")
188 188
189 # step 4: save bookmarks of all open (project) files 189 # step 4: save bookmarks of all open (project) files
190 self._write(" <Bookmarks>") 190 self._write(" <Bookmarks>")
191 for of in allOpenFiles: 191 for of in allOpenFiles:
192 if isGlobal or unicode(of).startswith(self.project.ppath): 192 if isGlobal or of.startswith(self.project.ppath):
193 editor = self.vm.getOpenEditor(of) 193 editor = self.vm.getOpenEditor(of)
194 for bookmark in editor.getBookmarks(): 194 for bookmark in editor.getBookmarks():
195 self._write(" <Bookmark>") 195 self._write(" <Bookmark>")
196 self._write(" <BmFilename>%s</BmFilename>" % of) 196 self._write(" <BmFilename>%s</BmFilename>" % of)
197 self._write(' <Linenumber value="%d" />' % bookmark) 197 self._write(' <Linenumber value="%d" />' % bookmark)

eric ide

mercurial