本文整理汇总了Python中PyQt5.Qt.QTextDocument.setPlainText方法的典型用法代码示例。如果您正苦于以下问题:Python QTextDocument.setPlainText方法的具体用法?Python QTextDocument.setPlainText怎么用?Python QTextDocument.setPlainText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QTextDocument
的用法示例。
在下文中一共展示了QTextDocument.setPlainText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: profile
# 需要导入模块: from PyQt5.Qt import QTextDocument [as 别名]
# 或者: from PyQt5.Qt.QTextDocument import setPlainText [as 别名]
def profile():
import sys
from PyQt5.Qt import QTextDocument
from calibre.gui2 import Application
from calibre.gui2.tweak_book import set_book_locale
from calibre.gui2.tweak_book.editor.themes import get_theme
app = Application([])
set_book_locale("en")
raw = open(sys.argv[-2], "rb").read().decode("utf-8")
doc = QTextDocument()
doc.setPlainText(raw)
h = HTMLHighlighter()
theme = get_theme(tprefs["editor_theme"])
h.apply_theme(theme)
h.set_document(doc)
h.join()
import cProfile
print("Running profile on", sys.argv[-2])
h.rehighlight()
cProfile.runctx("h.join()", {}, {"h": h}, sys.argv[-1])
print("Stats saved to:", sys.argv[-1])
del h
del doc
del app
示例2: profile
# 需要导入模块: from PyQt5.Qt import QTextDocument [as 别名]
# 或者: from PyQt5.Qt.QTextDocument import setPlainText [as 别名]
def profile():
import sys
from PyQt5.Qt import QTextDocument
from calibre.gui2 import Application
from calibre.gui2.tweak_book import set_book_locale
from calibre.gui2.tweak_book.editor.themes import get_theme
app = Application([])
set_book_locale('en')
raw = open(sys.argv[-2], 'rb').read().decode('utf-8')
doc = QTextDocument()
doc.setPlainText(raw)
h = Highlighter()
theme = get_theme(tprefs['editor_theme'])
h.apply_theme(theme)
h.set_document(doc)
h.join()
import cProfile
print ('Running profile on', sys.argv[-2])
h.rehighlight()
cProfile.runctx('h.join()', {}, {'h':h}, sys.argv[-1])
print ('Stats saved to:', sys.argv[-1])
del h
del doc
del app