本文整理汇总了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')
示例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)
示例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)
示例4: setFont
def setFont(self, font):
SpellCheckTextEdit.setFont(self, font)
fm = self.fontMetrics()
self.setMinimumSize(QtCore.QSize(1, fm.height() * 2))