本文整理汇总了Python中qutepart.Qutepart.centerCursor方法的典型用法代码示例。如果您正苦于以下问题:Python Qutepart.centerCursor方法的具体用法?Python Qutepart.centerCursor怎么用?Python Qutepart.centerCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qutepart.Qutepart
的用法示例。
在下文中一共展示了Qutepart.centerCursor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Document
# 需要导入模块: from qutepart import Qutepart [as 别名]
# 或者: from qutepart.Qutepart import centerCursor [as 别名]
#.........这里部分代码省略.........
if core.config()['Qutepart']['StripTrailingWhitespace']:
self._stripTrailingWhiteSpace()
self._saveToFs(self.filePath())
return True
def saveFileAs(self):
"""Ask for new file name with dialog. Save file
"""
if self._filePath:
default_filename = os.path.basename(self._filePath)
else:
default_filename = ''
path, _ = QFileDialog.getSaveFileName(self, self.tr('Save file as...'), default_filename)
if not path:
return
self.setFilePath(path)
self._saveToFs(path)
def reload(self):
"""Reload the file from the disk
If child class reimplemented this method, it MUST call method of the parent class
for update internal bookkeeping"""
text = self._readFile(self.filePath())
pos = self.qutepart.cursorPosition
self.qutepart.text = text
self._externallyModified = False
self._externallyRemoved = False
self.qutepart.cursorPosition = pos
self.qutepart.centerCursor()
def modelToolTip(self):
"""Tool tip for the opened files model
"""
toolTip = self.filePath()
if toolTip is None:
return None
if self.qutepart.document().isModified():
toolTip += "<br/><font color='blue'>%s</font>" % self.tr("Locally Modified")
if self._externallyModified:
toolTip += "<br/><font color='red'>%s</font>" % self.tr("Externally Modified")
if self._externallyRemoved:
toolTip += "<br/><font color='red'>%s</font>" % self.tr("Externally Deleted")
return '<html>' + toolTip + '</html>'
def modelIcon(self):
"""Icon for the opened files model
"""
if self.isNeverSaved(): # never has been saved
icon = "save.png"
elif self._externallyRemoved and self.qutepart.document().isModified():
icon = 'modified-externally-deleted.png'
elif self._externallyRemoved:
icon = "close.png"
elif self._externallyModified and self.qutepart.document().isModified():
icon = "modified-externally-modified.png"
elif self._externallyModified:
icon = "modified-externally.png"
elif self.qutepart.document().isModified():
icon = "save.png"