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


Python spellcheck.SpellCheckTextEdit类代码示例

本文整理汇总了Python中cola.widgets.spellcheck.SpellCheckTextEdit的典型用法代码示例。如果您正苦于以下问题:Python SpellCheckTextEdit类的具体用法?Python SpellCheckTextEdit怎么用?Python SpellCheckTextEdit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SpellCheckTextEdit类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, parent=None):
        hint = N_('Extended description...')
        SpellCheckTextEdit.__init__(self, hint, parent)
        self.extra_actions = []

        self.action_emit_leave = qtutils.add_action(self,
                'Shift Tab', self.emit_leave, 'Shift+tab')
开发者ID:aj-bagwell,项目名称:git-cola,代码行数:7,代码来源:commitmsg.py

示例2: __init__

    def __init__(self, parent=None):
        hint = N_('Extended description...')
        SpellCheckTextEdit.__init__(self, hint, parent)
        self.extra_actions = []
        self.setMinimumSize(QtCore.QSize(1, 1))

        self.action_emit_leave = add_action(self,
                'Shift Tab', self.emit_leave, 'Shift+tab')

        self.installEventFilter(self)
开发者ID:Avinash-Bhat,项目名称:git-cola,代码行数:10,代码来源:commitmsg.py

示例3: keyPressEvent

 def keyPressEvent(self, event):
     if event.key() == Qt.Key_Up:
         cursor = self.textCursor()
         position = cursor.position()
         if position == 0:
             # The cursor is at the beginning of the line.
             # If we have selection then simply reset the cursor.
             # Otherwise, emit a signal so that the parent can
             # change focus.
             if cursor.hasSelection():
                 cursor.setPosition(0)
                 self.setTextCursor(cursor)
             else:
                 self.emit_leave()
             event.accept()
             return
         text_before = unicode(self.toPlainText())[:position]
         lines_before = text_before.count('\n')
         if lines_before == 0:
             # If we're on the first line, but not at the
             # beginning, then move the cursor to the beginning
             # of the line.
             if event.modifiers() & Qt.ShiftModifier:
                 mode = QtGui.QTextCursor.KeepAnchor
             else:
                 mode = QtGui.QTextCursor.MoveAnchor
             cursor.setPosition(0, mode)
             self.setTextCursor(cursor)
             event.accept()
             return
     elif event.key() == Qt.Key_Down:
         cursor = self.textCursor()
         position = cursor.position()
         all_text = unicode(self.toPlainText())
         text_after = all_text[position:]
         lines_after = text_after.count('\n')
         if lines_after == 0:
             if event.modifiers() & Qt.ShiftModifier:
                 mode = QtGui.QTextCursor.KeepAnchor
             else:
                 mode = QtGui.QTextCursor.MoveAnchor
             cursor.setPosition(len(all_text), mode)
             self.setTextCursor(cursor)
             event.accept()
             return
     SpellCheckTextEdit.keyPressEvent(self, event)
开发者ID:Avinash-Bhat,项目名称:git-cola,代码行数:46,代码来源:commitmsg.py

示例4: setFont

 def setFont(self, font):
     SpellCheckTextEdit.setFont(self, font)
     fm = self.fontMetrics()
     self.setMinimumSize(QtCore.QSize(1, fm.height() * 2))
开发者ID:aj-bagwell,项目名称:git-cola,代码行数:4,代码来源:commitmsg.py


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