def __init__(self, parent=None): QsciLexerBash.__init__(self, parent) Lexer.__init__(self) self.commentString = "#" return
def __init__( self, parent = None ): QsciLexerBash.__init__( self, parent ) Lexer.__init__( self ) self.commentString = "#" return
def __init__(self, parent = None): """ Constructor @param parent parent widget of this lexer """ QsciLexerBash.__init__(self, parent) Lexer.__init__(self) self.commentString = QString("#")
def __init__(self, parent): QsciLexerBash.__init__(self, parent) self.lexer = Lexer.Lexer(self.language()) self.setDefaultPaper(self.lexer.get_globaldefault_paper()) self.setFont(self.lexer.get_default_font()) self.comment_string = QString("#") self.stream_comment_string = { 'start' : QString(''), 'end' : QString('') }
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 QsciLexerBash.keywords(self, kwSet)
def keywords(self, index): """ Reimplement keyword and add personnal keywords """ keywords = QsciLexerBash.keywords(self, index) or '' if index == 1: return keywords return keywords
def loadFile(self, fileName): if not os.path.exists(unicode(fileName)): self.editor.clear() return self.filename = unicode(fileName) f = open(self.filename, 'r') t = f.read() try: self.editor.setText(t.decode(self.encoding)) lexer = QsciLexerBash() if self.filename.endswith('.py'): lexer = QsciLexerPython() elif self.filename.endswith('.cpp') or self.filename.endswith('.h'): lexer = QsciLexerCPP() elif self.filename.endswith('.java'): lexer = QsciLexerJava() elif self.filename.endswith('.js'): lexer = QsciLexerJavaScript() lexer.setFont(self.editor.font()) self.editor.setLexer(lexer) self.loadAnnotation() except UnicodeDecodeError as e: QtGui.QMessageBox.question(self, 'Error', 'info: ' + str(e) ) f.close()
def get_lexers(self): lexers = [] lexers.append(([".py", ".pyw"], QsciLexerPython)) lexers.append(([".c", ".cpp", ".h"], QsciLexerCPP)) lexers.append(([".sh"], QsciLexerBash())) lexers.append(([".bat"], QsciLexerBatch())) lexers.append(([".html", ".htm"], QsciLexerHTML)) lexers.append(([".java"], QsciLexerJava)) lexers.append(([".js"], QsciLexerJavaScript)) lexers.append(([".tex", ".latex", ".bibtex"], QsciLexerTeX)) lexers.append(([".f90"], QsciLexerFortran)) return lexers
# print "defaultEolFill" + str( style ) + "=" + str( lexer.defaultEolFill( style ) ) # print "defaultFont" + str( style ) + "=" + lexer.defaultFont( style ).toString() print "color" + str( style ) + "=" + colorToString( lexer.color( style ) ) print "paper" + str( style ) + "=" + colorToString( lexer.paper( style ) ) print "eolFill" + str( style ) + "=" + str( lexer.eolFill( style ) ) print "font" + str( style ) + "=" + lexer.font( style ).toString() indexes.append( str( style ) ) print "indexes=" + ",".join( indexes ) print "" return dumpLexer( QsciLexerPython() ) dumpLexer( QsciLexerBash() ) dumpLexer( QsciLexerBatch() ) dumpLexer( QsciLexerCMake() ) dumpLexer( QsciLexerCPP() ) dumpLexer( QsciLexerCSharp() ) dumpLexer( QsciLexerCSS() ) dumpLexer( QsciLexerDiff() ) dumpLexer( QsciLexerD() ) dumpLexer( QsciLexerFortran77() ) dumpLexer( QsciLexerFortran() ) dumpLexer( QsciLexerHTML() ) dumpLexer( QsciLexerIDL() ) dumpLexer( QsciLexerJava() ) dumpLexer( QsciLexerJavaScript() ) dumpLexer( QsciLexerLua() ) dumpLexer( QsciLexerMakefile() )
def defaultColor(self, style): '''Returns the foreground colour of the text for style number style''' color = self.lexer.get_default_color(style, self.description(style)) if color != 'not': return color return QsciLexerBash.defaultColor(self, style)