def apply(self, document): """Replace the current line with the populated template. IN: document: <IDocument> The edited document. OUT: None. """ self.vars['newline'] = PyAction.getDelimiter(document) sNewCode = self.template % self.vars # Move to insert point: iStartLineOffset = self.selection.getLineOffset() iEndLineOffset = iStartLineOffset + len(self.current_line) self.editor.setSelection(iEndLineOffset, 0) self.selection = PySelection(self.editor) # Replace the old code with the new assignment expression: self.selection.replaceLineContentsToSelection(sNewCode) #mark the value so that the user can change it selection = PySelection(self.editor) absoluteCursorOffset = selection.getAbsoluteCursorOffset() val = self.vars['value'] self.editor.selectAndReveal(absoluteCursorOffset - len(val), len(val))
def apply(self, document): """Replace the current line with the populated template. IN: document: <IDocument> The edited document. OUT: None. """ self.vars['newline'] = PyAction.getDelimiter(document) sNewCode = self.template % self.vars # Move to insert point: iStartLineOffset = self.selection.getLineOffset() iEndLineOffset = iStartLineOffset + len(self.current_line) self.editor.setSelection(iEndLineOffset, 0) self.selection = PySelection(self.editor) # Replace the old code with the new assignment expression: self.selection.replaceLineContentsToSelection(sNewCode) #mark the value so that the user can change it selection = PySelection(self.editor) absoluteCursorOffset = selection.getAbsoluteCursorOffset() val = self.vars['value'] self.editor.selectAndReveal(absoluteCursorOffset-len(val),len(val))
def getNewLineDelim(self): if not hasattr(self, '_sNewline'): self._sNewline = PyAction.getDelimiter(self.editor.getDocument()) return self._sNewline
def getNewLineDelim(self): if not hasattr(self, "_sNewline"): self._sNewline = PyAction.getDelimiter(self.editor.getDocument()) return self._sNewline