当前位置: 首页>>代码示例>>Python>>正文


Python Qutepart.centerCursor方法代码示例

本文整理汇总了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"
开发者ID:,项目名称:,代码行数:70,代码来源:


注:本文中的qutepart.Qutepart.centerCursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。