コード例 #1
0
ファイル: text.py プロジェクト: silencen/calibre
 def load_text(self, text, syntax='html', process_template=False, doc_name=None):
     self.syntax = syntax
     self.highlighter = get_highlighter(syntax)()
     self.highlighter.apply_theme(self.theme)
     self.highlighter.set_document(self.document(), doc_name=doc_name)
     sclass = {'html':HTMLSmarts, 'xml':HTMLSmarts, 'css':CSSSmarts}.get(syntax, None)
     if sclass is not None:
         self.smarts = sclass(self)
     self.setPlainText(unicodedata.normalize('NFC', text))
     if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
         c = self.textCursor()
         c.insertText('')
コード例 #2
0
 def load_text(self, text, syntax='html', process_template=False, doc_name=None):
     self.syntax = syntax
     self.highlighter = get_highlighter(syntax)()
     self.highlighter.apply_theme(self.theme)
     self.highlighter.set_document(self.document(), doc_name=doc_name)
     sclass = {'html':HTMLSmarts, 'xml':HTMLSmarts, 'css':CSSSmarts}.get(syntax, None)
     if sclass is not None:
         self.smarts = sclass(self)
     self.setPlainText(unicodedata.normalize('NFC', text))
     if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
         c = self.textCursor()
         c.insertText('')
コード例 #3
0
ファイル: text.py プロジェクト: zhanleewo/calibre
 def load_text(self, text, syntax='html', process_template=False, doc_name=None):
     self.syntax = syntax
     self.highlighter = get_highlighter(syntax)()
     self.highlighter.apply_theme(self.theme)
     self.highlighter.set_document(self.document(), doc_name=doc_name)
     sclass = get_smarts(syntax)
     if sclass is not None:
         self.smarts = sclass(self)
         if self.smarts.override_tab_stop_width is not None:
             self.setTabStopWidth(self.smarts.override_tab_stop_width * self.space_width)
     self.setPlainText(unicodedata.normalize('NFC', unicode(text)))
     if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
         c = self.textCursor()
         c.insertText('')
コード例 #4
0
 def load_text(self, text, syntax='html', process_template=False, doc_name=None):
     self.syntax = syntax
     self.highlighter = get_highlighter(syntax)()
     self.highlighter.apply_theme(self.theme)
     self.highlighter.set_document(self.document(), doc_name=doc_name)
     sclass = get_smarts(syntax)
     if sclass is not None:
         self.smarts = sclass(self)
         if self.smarts.override_tab_stop_width is not None:
             self.tw = self.smarts.override_tab_stop_width
             self.setTabStopWidth(self.tw * self.space_width)
     self.setPlainText(unicodedata.normalize('NFC', unicode(text)))
     if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
         c = self.textCursor()
         c.insertText('')