def __init__ (self, editor, colorizeSyntax, enableSpellChecking, runEvent): self._editor = editor self._helper = TextEditorHelper() self._enableSpellChecking = enableSpellChecking self._runEvent = runEvent self.text = TextFactory.make (None) self.bold = FontsFactory.makeBold (None).setParseAction(lambda s, l, t: None) self.italic = FontsFactory.makeItalic (None).setParseAction(lambda s, l, t: None) self.bold_italic = FontsFactory.makeBoldItalic (None).setParseAction(lambda s, l, t: None) self.underline = FontsFactory.makeUnderline (None).setParseAction(lambda s, l, t: None) self.heading = HeadingFactory.make (None).setParseAction(lambda s, l, t: None) self.command = CommandFactory.make (None).setParseAction(lambda s, l, t: None) self.link = LinkFactory.make (None).setParseAction(lambda s, l, t: None) self.url = UrlFactory.make (None).setParseAction(lambda s, l, t: None) self.linebreak = LineBreakFactory.make (None).setParseAction(lambda s, l, t: None) self.noformat = NoFormatFactory.make (None).setParseAction(lambda s, l, t: None) self.preformat = PreFormatFactory.make (None).setParseAction(lambda s, l, t: None) if colorizeSyntax: self.colorParser = ( self.url | self.text | self.linebreak | self.link | self.noformat | self.preformat | self.command | self.bold_italic | self.bold | self.italic | self.underline | self.heading) self.insideBlockParser = ( self.url | self.text | self.linebreak | self.link | self.noformat | self.preformat | self.bold_italic | self.bold | self.italic | self.underline) else: self.colorParser = self.text self.insideBlockParser = self.text
def __init__ (self, editor): self._editor = editor self.text = TextFactory.make (None) self.bold = FontsFactory.makeBold (None).setParseAction(lambda s, l, t: None) self.italic = FontsFactory.makeItalic (None).setParseAction(lambda s, l, t: None) self.bold_italic = FontsFactory.makeBoldItalic (None).setParseAction(lambda s, l, t: None) self.underline = FontsFactory.makeUnderline (None).setParseAction(lambda s, l, t: None) self.heading = HeadingFactory.make (None).setParseAction(lambda s, l, t: None) self.command = CommandFactory.make (None).setParseAction(lambda s, l, t: None) self.link = LinkFactory.make (None).setParseAction(lambda s, l, t: None) self.url = UrlFactory.make (None).setParseAction(lambda s, l, t: None) self.linebreak = LineBreakFactory.make (None).setParseAction(lambda s, l, t: None) self.noformat = NoFormatFactory.make (None).setParseAction(lambda s, l, t: None) self.colorParser = (self.url | self.text | self.linebreak | self.link | self.noformat | self.command | self.bold_italic | self.bold | self.italic | self.underline | self.heading) self.insideBlockParser = (self.url | self.text | self.linebreak | self.link | self.noformat | self.bold_italic | self.bold | self.italic | self.underline) self._thread = None