本文整理汇总了Python中lexer.Lexer.applyLanguage方法的典型用法代码示例。如果您正苦于以下问题:Python Lexer.applyLanguage方法的具体用法?Python Lexer.applyLanguage怎么用?Python Lexer.applyLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.applyLanguage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Editor
# 需要导入模块: from lexer import Lexer [as 别名]
# 或者: from lexer.Lexer import applyLanguage [as 别名]
#.........这里部分代码省略.........
def eolMode(self):
"""Line end mode of the file
"""
return self._eolMode
def setEolMode(self, mode):
"""Set line end mode of the file
"""
self.qscintilla.setEolMode(self._EOL_CONVERTOR_TO_QSCI[mode])
self.qscintilla.convertEols(self._EOL_CONVERTOR_TO_QSCI[mode])
self._eolMode = mode
def indentWidth(self):
"""Indentation width in symbol places (spaces)
"""
return self.qscintilla.indentationWidth()
def _applyIndentWidth(self, width):
"""Set indentation width in symbol places (spaces)
"""
return self.qscintilla.setIndentationWidth(width)
def indentUseTabs(self):
"""Indentation uses Tabs instead of Spaces
"""
return self.qscintilla.indentationsUseTabs()
def _applyIndentUseTabs(self, use):
"""Set iindentation mode (Tabs or spaces)
"""
return self.qscintilla.setIndentationsUseTabs(use)
def _applyLanguage(self, language):
"""Set programming language of the file.
Called Only by :mod:`enki.plugins.associations` to select syntax highlighting language.
"""
self.lexer.applyLanguage(language)
def text(self):
"""Contents of the editor
"""
if self._cachedText is not None:
return self._cachedText
self._cachedText = self.qscintilla.text()
if self._eolMode == r'\r\n':
self._cachedText = self._cachedText.replace('\r\n', '\n')
elif self._eolMode == r'\r':
self._cachedText = self._cachedText.replace('\r', '\n')
return self._cachedText
def setText(self, text):
"""Set text in the QScintilla, clear modified flag, update line numbers bar
"""
self.qscintilla.setText(text)
self.qscintilla.linesChanged.emit()
self._setModified(False)
def selectedText(self):
"""Get selected text
"""
return self.qscintilla.selectedText()