當前位置: 首頁>>代碼示例>>Python>>正文


Python widgets.PlainTextEdit類代碼示例

本文整理匯總了Python中calibre.gui2.tweak_book.widgets.PlainTextEdit的典型用法代碼示例。如果您正苦於以下問題:Python PlainTextEdit類的具體用法?Python PlainTextEdit怎麽用?Python PlainTextEdit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PlainTextEdit類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

 def __init__(self, parent=None, expected_geometry=(100, 50)):
     PlainTextEdit.__init__(self, parent)
     self.snippet_manager = SnippetManager(self)
     self.completion_popup = CompletionPopup(self)
     self.request_completion = self.completion_doc_name = None
     self.clear_completion_cache_timer = t = QTimer(self)
     t.setInterval(5000), t.timeout.connect(self.clear_completion_cache), t.setSingleShot(True)
     self.textChanged.connect(t.start)
     self.last_completion_request = -1
     self.gutter_width = 0
     self.tw = 2
     self.expected_geometry = expected_geometry
     self.saved_matches = {}
     self.syntax = None
     self.smarts = NullSmarts(self)
     self.current_cursor_line = None
     self.current_search_mark = None
     self.smarts_highlight_timer = t = QTimer()
     t.setInterval(750), t.setSingleShot(True), t.timeout.connect(self.update_extra_selections)
     self.highlighter = SyntaxHighlighter()
     self.line_number_area = LineNumbers(self)
     self.apply_settings()
     self.setMouseTracking(True)
     self.cursorPositionChanged.connect(self.highlight_cursor_line)
     self.blockCountChanged[int].connect(self.update_line_number_area_width)
     self.updateRequest.connect(self.update_line_number_area)
開發者ID:timpalpant,項目名稱:calibre,代碼行數:26,代碼來源:text.py

示例2: mousePressEvent

 def mousePressEvent(self, ev):
     if self.completion_popup.isVisible() and not self.completion_popup.rect().contains(ev.pos()):
         # For some reason using eventFilter for this does not work, so we
         # implement it here
         self.completion_popup.abort()
     if ev.modifiers() & Qt.CTRL:
         url = self.link_for_position(ev.pos())
         if url is not None:
             ev.accept()
             self.link_clicked.emit(url)
             return
     return PlainTextEdit.mousePressEvent(self, ev)
開發者ID:timpalpant,項目名稱:calibre,代碼行數:12,代碼來源:text.py

示例3: override_shortcut

 def override_shortcut(self, ev):
     # Let the global cut/copy/paste/undo/redo shortcuts work, this avoids the nbsp
     # problem as well, since they use the overridden createMimeDataFromSelection() method
     # instead of the one from Qt (which makes copy() work), and allows proper customization
     # of the shortcuts
     if ev in (QKeySequence.Copy, QKeySequence.Cut, QKeySequence.Paste, QKeySequence.Undo, QKeySequence.Redo):
         ev.ignore()
         return True
     # This is used to convert typed hex codes into unicode
     # characters
     if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier:
         ev.accept()
         return True
     return PlainTextEdit.override_shortcut(self, ev)
開發者ID:j-howell,項目名稱:calibre,代碼行數:14,代碼來源:text.py

示例4: keyPressEvent

 def keyPressEvent(self, ev):
     if self.snippet_manager.handle_key_press(ev):
         return
     PlainTextEdit.keyPressEvent(self, ev)
開發者ID:JimmXinu,項目名稱:calibre,代碼行數:4,代碼來源:snippets.py

示例5: __init__

 def __init__(self, text, parent=None):
     PlainTextEdit.__init__(self, parent)
     if text:
         self.setPlainText(text)
     self.snippet_manager = SnippetManager(self)
開發者ID:JimmXinu,項目名稱:calibre,代碼行數:5,代碼來源:snippets.py


注:本文中的calibre.gui2.tweak_book.widgets.PlainTextEdit類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。