示例#1
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent parent widget of this lexer
        """
        QsciLexerJava.__init__(self, parent)
        Lexer.__init__(self)

        self.commentString = "//"
        self.streamCommentString = {'start': '/* ', 'end': ' */'}
        self.boxCommentString = {'start': '/* ', 'middle': ' * ', 'end': ' */'}
示例#2
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent parent widget of this lexer
        """
        QsciLexerJava.__init__(self, parent)
        Lexer.__init__(self)

        self.commentString = "//"
        self.streamCommentString = {"start": "/* ", "end": " */"}
        self.boxCommentString = {"start": "/* ", "middle": " * ", "end": " */"}
示例#3
0
    def createCodeGroupBox(self, parent):
        yPos = const.GROUP_BOX_MARGIN_TOP
        width = AlgorithmDescDialog.WINDOW_WIDTH - const.PADDING * 4

        box = WidgetUtil.createGroupBox(parent, title="代码实现",
                                        minSize=QSize(width, AlgorithmDescDialog.DESC_GROUP_BOX_HEIGHT))

        # sizePolicy = WidgetUtil.createSizePolicy()
        splitter = WidgetUtil.createSplitter(box, geometry=QRect(const.PADDING, yPos, width - const.PADDING * 2, 330))

        tabWidget = WidgetUtil.createTabWidget(splitter)
        if self.javaCode:
            tabWidget.addTab(self.createTabWidget(self.javaCode, QsciLexerJava()), "Java")
        if self.javaScriptCode:
            tabWidget.addTab(self.createTabWidget(self.javaScriptCode, QsciLexerJavaScript()), "JavaScript")
        if self.pythonCode:
            tabWidget.addTab(self.createTabWidget(self.pythonCode, QsciLexerPython()), "Python")
        if self.cCode:
            tabWidget.addTab(self.createTabWidget(self.cCode, QsciLexerCPP()), "C")
        if self.cppCode:
            tabWidget.addTab(self.createTabWidget(self.cppCode, QsciLexerCPP()), "C++")
        if self.swiftCode:
            tabWidget.addTab(self.createTabWidget(self.swiftCode, QsciLexerCPP()), "Swift")

        return box
示例#4
0
 def defaultKeywords(self, kwSet):
     """
     Public method to get the default keywords.
     
     @param kwSet number of the keyword set (integer)
     @return string giving the keywords (string) or None
     """
     return QsciLexerJava.keywords(self, kwSet)
示例#5
0
 def defaultKeywords(self, kwSet):
     """
     Public method to get the default keywords.
     
     @param kwSet number of the keyword set (integer)
     @return string giving the keywords (string) or None
     """
     return QsciLexerJava.keywords(self, kwSet)
示例#6
0
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent parent widget of this lexer
     """
     QsciLexerJava.__init__(self, parent)
     Lexer.__init__(self)
     
     self.commentString = "//"
     self.streamCommentString = {
         'start': '/* ',
         'end': ' */'
     }
     self.boxCommentString = {
         'start': '/* ',
         'middle': ' * ',
         'end': ' */'
     }
示例#7
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent parent widget of this lexer
        """
        QsciLexerJava.__init__(self, parent)
        Lexer.__init__(self)

        self.commentString = "//"
        self.streamCommentString = {'start': '/* ', 'end': ' */'}
        self.boxCommentString = {'start': '/* ', 'middle': ' * ', 'end': ' */'}

        self.keywordSetDescriptions = [
            self.tr("Primary keywords and identifiers"),
            self.tr("Secondary keywords and identifiers"),
            self.tr("Documentation comment keywords"),
            self.tr("Global classes and typedefs"),
            self.tr("Preprocessor definitions"),
            self.tr("Task marker and error marker keywords"),
        ]
示例#8
0
    def checkExtensionToHighlight(self, path, editor):
        _, extension = os.path.splitext(path)

        if extension == '.py':
            editor.setLexer(QsciLexerPython(self))
        elif extension == '.html':
            editor.setLexer(QsciLexerHTML(self))
        elif extension == '.java':
            editor.setLexer(QsciLexerJava(self))
        elif extension == '.cs':
            editor.setLexer(QsciLexerCSharp(self))
        elif extension == '.bat':
            editor.setLexer(QsciLexerBatch(self))