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


Python QtGui.QSyntaxHighlighter方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QSyntaxHighlighter方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QSyntaxHighlighter方法的具体用法?Python QtGui.QSyntaxHighlighter怎么用?Python QtGui.QSyntaxHighlighter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui的用法示例。


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

示例1: reload_java_sources

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QSyntaxHighlighter [as 别名]
def reload_java_sources(self):
        """Reload completely the sources by asking Androguard
           to decompile it again. Useful when:
            - an element has been renamed to propagate the info
            - the current tab is changed because we do not know what user
              did since then, so we need to propagate previous changes as well
        """

        log.debug("Getting sources for %s" % self.current_class)

        lines = [("COMMENTS", [(
            "COMMENT", "// filename:%s\n// digest:%s\n\n" % (
                self.current_filename, self.current_digest))])]

        method_info_buff = ""
        for method in self.current_class.get_methods():
            method_info_buff += "// " + str(method) + "\n"

        lines.append(("COMMENTS", [(
            "COMMENT", method_info_buff + "\n\n")]))

        lines.extend(self.current_class.get_source_ext())

        # TODO: delete doc when tab is closed? not deleted by "self" :(
        if hasattr(self, "doc"):
            del self.doc
        self.doc = SourceDocument(parent=self, lines=lines)
        self.setDocument(self.doc)

        # No need to save hightlighter. highlighBlock will automatically be called
        # because we passed the QTextDocument to QSyntaxHighlighter constructor
        MyHighlighter(self.doc, lexer=JavaLexer()) 
开发者ID:amimo,项目名称:dcc,代码行数:34,代码来源:sourcewindow.py

示例2: reload_java_sources

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QSyntaxHighlighter [as 别名]
def reload_java_sources(self):
        '''Reload completely the sources by asking Androguard
           to decompile it again. Useful when:
            - an element has been renamed to propagate the info
            - the current tab is changed because we do not know what user
              did since then, so we need to propagate previous changes as well
        '''

        androconf.debug("Getting sources for %s" % self.current_class)

        lines = []
        lines.append(("COMMENTS", [(
            "COMMENT", "// filename:%s\n// digest:%s\n\n" % (
                self.current_filename, self.current_digest))]))

        method_info_buff = ""
        for method in self.current_class.get_methods():
            method_info_buff += "// " + str(method) + "\n"

        lines.append(("COMMENTS", [(
            "COMMENT", method_info_buff + "\n\n")]))

        lines.extend(self.current_class.get_source_ext())

        #TODO: delete doc when tab is closed? not deleted by "self" :(
        if hasattr(self, "doc"):
            del self.doc
        self.doc = SourceDocument(parent=self, lines=lines)
        self.setDocument(self.doc)

        #No need to save hightlighter. highlighBlock will automatically be called
        #because we passed the QTextDocument to QSyntaxHighlighter constructor
        if PYGMENTS:
            MyHighlighter(self.doc, lexer=JavaLexer())
        else:
            androconf.debug("Pygments is not present !") 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:38,代码来源:sourcewindow.py


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