def defaultFont(self, style): """ Provides the default font for a style """ if style in [PYGMENTS_COMMENT, PYGMENTS_PREPROCESSOR]: f = GlobalData().skin.nolexerFont if style == PYGMENTS_PREPROCESSOR: f.setItalic(True) return f if style in [PYGMENTS_STRING]: return GlobalData().skin.nolexerFont if style in [ PYGMENTS_KEYWORD, PYGMENTS_OPERATOR, PYGMENTS_WORD, PYGMENTS_BUILTIN, PYGMENTS_ATTRIBUTE, PYGMENTS_FUNCTION, PYGMENTS_CLASS, PYGMENTS_NAMESPACE, PYGMENTS_EXCEPTION, PYGMENTS_ENTITY, PYGMENTS_TAG, PYGMENTS_SCALAR, PYGMENTS_ESCAPE, PYGMENTS_HEADING, PYGMENTS_SUBHEADING, PYGMENTS_STRONG, PYGMENTS_PROMPT ]: f = LexerContainer.defaultFont(self, style) f.setBold(True) return f if style in [PYGMENTS_DOCSTRING, PYGMENTS_EMPHASIZE]: f = LexerContainer.defaultFont(self, style) f.setItalic(True) return f return LexerContainer.defaultFont(self, style)
def defaultFont( self, style ): """ Provides the default font for a style """ if style in [ PYGMENTS_COMMENT, PYGMENTS_PREPROCESSOR ]: f = GlobalData().skin.nolexerFont if style == PYGMENTS_PREPROCESSOR: f.setItalic( True ) return f if style in [ PYGMENTS_STRING ]: return GlobalData().skin.nolexerFont if style in [ PYGMENTS_KEYWORD, PYGMENTS_OPERATOR, PYGMENTS_WORD, PYGMENTS_BUILTIN, PYGMENTS_ATTRIBUTE, PYGMENTS_FUNCTION, PYGMENTS_CLASS, PYGMENTS_NAMESPACE, PYGMENTS_EXCEPTION, PYGMENTS_ENTITY, PYGMENTS_TAG, PYGMENTS_SCALAR, PYGMENTS_ESCAPE, PYGMENTS_HEADING, PYGMENTS_SUBHEADING, PYGMENTS_STRONG, PYGMENTS_PROMPT ]: f = LexerContainer.defaultFont( self, style ) f.setBold( True ) return f if style in [ PYGMENTS_DOCSTRING, PYGMENTS_EMPHASIZE ]: f = LexerContainer.defaultFont( self, style ) f.setItalic( True ) return f return LexerContainer.defaultFont( self, style )
def defaultPaper(self, style): """ Provides the default paper for a style """ try: return self.defaultPapers[style] except KeyError: return LexerContainer.defaultPaper(self, style)
def defaultColor(self, style): """ Provides the default foreground color for a style """ try: return self.defaultColors[style] except KeyError: return LexerContainer.defaultColor(self, style)
def __init__(self, parent=None, name="", fileName=""): LexerContainer.__init__(self, parent) self.__pygmentsName = name self.__fileName = fileName self.__lexerGuessed = False self.__language = "Guessed" self.descriptions = { PYGMENTS_DEFAULT: "Default", PYGMENTS_COMMENT: "Comment", PYGMENTS_PREPROCESSOR: "Preprocessor", PYGMENTS_KEYWORD: "Keyword", PYGMENTS_PSEUDOKEYWORD: "Pseudo Keyword", PYGMENTS_TYPEKEYWORD: "Type Keyword", PYGMENTS_OPERATOR: "Operator", PYGMENTS_WORD: "Word", PYGMENTS_BUILTIN: "Builtin", PYGMENTS_FUNCTION: "Function or method name", PYGMENTS_CLASS: "Class name", PYGMENTS_NAMESPACE: "Namespace", PYGMENTS_EXCEPTION: "Exception", PYGMENTS_VARIABLE: "Identifier", PYGMENTS_CONSTANT: "Constant", PYGMENTS_LABEL: "Label", PYGMENTS_ENTITY: "Entity", PYGMENTS_ATTRIBUTE: "Attribute", PYGMENTS_TAG: "Tag", PYGMENTS_DECORATOR: "Decorator", PYGMENTS_STRING: "String", PYGMENTS_DOCSTRING: "Documentation string", PYGMENTS_SCALAR: "Scalar", PYGMENTS_ESCAPE: "Escape", PYGMENTS_REGEX: "Regular expression", PYGMENTS_SYMBOL: "Symbol", PYGMENTS_OTHER: "Other string", PYGMENTS_NUMBER: "Number", PYGMENTS_HEADING: "Heading", PYGMENTS_SUBHEADING: "Subheading", PYGMENTS_DELETED: "Deleted", PYGMENTS_INSERTED: "Inserted", PYGMENTS_GENERIC_ERROR: "Generic error", PYGMENTS_EMPHASIZE: "Emphasized text", PYGMENTS_STRONG: "Strong text", PYGMENTS_PROMPT: "Prompt", PYGMENTS_OUTPUT: "Output", PYGMENTS_TRACEBACK: "Traceback", PYGMENTS_ERROR: "Error", } self.defaultColors = { PYGMENTS_DEFAULT: QColor("#000000"), PYGMENTS_COMMENT: QColor("#408080"), PYGMENTS_PREPROCESSOR: QColor("#BC7A00"), PYGMENTS_KEYWORD: QColor("#008000"), PYGMENTS_PSEUDOKEYWORD: QColor("#008000"), PYGMENTS_TYPEKEYWORD: QColor("#B00040"), PYGMENTS_OPERATOR: QColor("#666666"), PYGMENTS_WORD: QColor("#AA22FF"), PYGMENTS_BUILTIN: QColor("#008000"), PYGMENTS_FUNCTION: QColor("#0000FF"), PYGMENTS_CLASS: QColor("#0000FF"), PYGMENTS_NAMESPACE: QColor("#0000FF"), PYGMENTS_EXCEPTION: QColor("#D2413A"), PYGMENTS_VARIABLE: QColor("#19177C"), PYGMENTS_CONSTANT: QColor("#880000"), PYGMENTS_LABEL: QColor("#A0A000"), PYGMENTS_ENTITY: QColor("#999999"), PYGMENTS_ATTRIBUTE: QColor("#7D9029"), PYGMENTS_TAG: QColor("#008000"), PYGMENTS_DECORATOR: QColor("#AA22FF"), PYGMENTS_STRING: QColor("#BA2121"), PYGMENTS_DOCSTRING: QColor("#BA2121"), PYGMENTS_SCALAR: QColor("#BB6688"), PYGMENTS_ESCAPE: QColor("#BB6622"), PYGMENTS_REGEX: QColor("#BB6688"), PYGMENTS_SYMBOL: QColor("#19177C"), PYGMENTS_OTHER: QColor("#008000"), PYGMENTS_NUMBER: QColor("#666666"), PYGMENTS_HEADING: QColor("#000080"), PYGMENTS_SUBHEADING: QColor("#800080"), PYGMENTS_DELETED: QColor("#A00000"), PYGMENTS_INSERTED: QColor("#00A000"), PYGMENTS_GENERIC_ERROR: QColor("#FF0000"), PYGMENTS_PROMPT: QColor("#000080"), PYGMENTS_OUTPUT: QColor("#808080"), PYGMENTS_TRACEBACK: QColor("#0040D0"), } self.defaultPapers = { PYGMENTS_ERROR: QColor("#FF0000"), }
def defaultPaper( self, style ): """ Provides the default paper for a style """ try: return self.defaultPapers[ style ] except KeyError: return LexerContainer.defaultPaper( self, style )
def defaultColor( self, style ): """ Provides the default foreground color for a style """ try: return self.defaultColors[ style ] except KeyError: return LexerContainer.defaultColor( self, style )
def __init__( self, parent = None, name = "", fileName = "" ): LexerContainer.__init__( self, parent ) self.__pygmentsName = name self.__fileName = fileName self.__lexerGuessed = False self.__language = "Guessed" self.descriptions = { PYGMENTS_DEFAULT : "Default", PYGMENTS_COMMENT : "Comment", PYGMENTS_PREPROCESSOR : "Preprocessor", PYGMENTS_KEYWORD : "Keyword", PYGMENTS_PSEUDOKEYWORD : "Pseudo Keyword", PYGMENTS_TYPEKEYWORD : "Type Keyword", PYGMENTS_OPERATOR : "Operator", PYGMENTS_WORD : "Word", PYGMENTS_BUILTIN : "Builtin", PYGMENTS_FUNCTION : "Function or method name", PYGMENTS_CLASS : "Class name", PYGMENTS_NAMESPACE : "Namespace", PYGMENTS_EXCEPTION : "Exception", PYGMENTS_VARIABLE : "Identifier", PYGMENTS_CONSTANT : "Constant", PYGMENTS_LABEL : "Label", PYGMENTS_ENTITY : "Entity", PYGMENTS_ATTRIBUTE : "Attribute", PYGMENTS_TAG : "Tag", PYGMENTS_DECORATOR : "Decorator", PYGMENTS_STRING : "String", PYGMENTS_DOCSTRING : "Documentation string", PYGMENTS_SCALAR : "Scalar", PYGMENTS_ESCAPE : "Escape", PYGMENTS_REGEX : "Regular expression", PYGMENTS_SYMBOL : "Symbol", PYGMENTS_OTHER : "Other string", PYGMENTS_NUMBER : "Number", PYGMENTS_HEADING : "Heading", PYGMENTS_SUBHEADING : "Subheading", PYGMENTS_DELETED : "Deleted", PYGMENTS_INSERTED : "Inserted", PYGMENTS_GENERIC_ERROR : "Generic error", PYGMENTS_EMPHASIZE : "Emphasized text", PYGMENTS_STRONG : "Strong text", PYGMENTS_PROMPT : "Prompt", PYGMENTS_OUTPUT : "Output", PYGMENTS_TRACEBACK : "Traceback", PYGMENTS_ERROR : "Error", } self.defaultColors = { PYGMENTS_DEFAULT : QColor("#000000"), PYGMENTS_COMMENT : QColor("#408080"), PYGMENTS_PREPROCESSOR : QColor("#BC7A00"), PYGMENTS_KEYWORD : QColor("#008000"), PYGMENTS_PSEUDOKEYWORD : QColor("#008000"), PYGMENTS_TYPEKEYWORD : QColor("#B00040"), PYGMENTS_OPERATOR : QColor("#666666"), PYGMENTS_WORD : QColor("#AA22FF"), PYGMENTS_BUILTIN : QColor("#008000"), PYGMENTS_FUNCTION : QColor("#0000FF"), PYGMENTS_CLASS : QColor("#0000FF"), PYGMENTS_NAMESPACE : QColor("#0000FF"), PYGMENTS_EXCEPTION : QColor("#D2413A"), PYGMENTS_VARIABLE : QColor("#19177C"), PYGMENTS_CONSTANT : QColor("#880000"), PYGMENTS_LABEL : QColor("#A0A000"), PYGMENTS_ENTITY : QColor("#999999"), PYGMENTS_ATTRIBUTE : QColor("#7D9029"), PYGMENTS_TAG : QColor("#008000"), PYGMENTS_DECORATOR : QColor("#AA22FF"), PYGMENTS_STRING : QColor("#BA2121"), PYGMENTS_DOCSTRING : QColor("#BA2121"), PYGMENTS_SCALAR : QColor("#BB6688"), PYGMENTS_ESCAPE : QColor("#BB6622"), PYGMENTS_REGEX : QColor("#BB6688"), PYGMENTS_SYMBOL : QColor("#19177C"), PYGMENTS_OTHER : QColor("#008000"), PYGMENTS_NUMBER : QColor("#666666"), PYGMENTS_HEADING : QColor("#000080"), PYGMENTS_SUBHEADING : QColor("#800080"), PYGMENTS_DELETED : QColor("#A00000"), PYGMENTS_INSERTED : QColor("#00A000"), PYGMENTS_GENERIC_ERROR : QColor("#FF0000"), PYGMENTS_PROMPT : QColor("#000080"), PYGMENTS_OUTPUT : QColor("#808080"), PYGMENTS_TRACEBACK : QColor("#0040D0"), } self.defaultPapers = { PYGMENTS_ERROR : QColor("#FF0000"), }