Well that's disappointing I had hoped for a magic bullet but oh well. maybe you can help me figure it out. From the example I can find
http://editra.org/forum/viewtopic.php?f=3&t=141 it seems that all that's needed is to use the wxSTC_LEX_CONTAINER as the lexer and then bind the wx.stc.EVT_STC_STYLENEEDED event to a method and then use that method to set the styling. from what I can see in dabo\ui\uiwx\dEditor.py The following seems to set the STC_LEX_CONTAINER if the lexer isn't found class StyleTimer(dTimer.dTimer): def afterInit(self): # Default timer interval self.styleTimerInterval = 50 self.super() self.bindEvent(dEvents.Hit, self.onHit) self.mode = "container" def onHit(self, evt): #self.Interval = 0 self.stop() if self.mode in LexerDic.keys(): if self.Parent: self.Parent.SetLexer(LexerDic[self.mode]) self.mode = "container" self.Interval = self.styleTimerInterval else: if self.Parent: self.Parent.SetLexer(stc.STC_LEX_CONTAINER) def setSyntaxColoring(self, color=None): """Sets the appropriate lexer for syntax coloring.""" lex = self.Language.lower() if color and lex: if lex in LexerDic.keys(): self.SetLexer(LexerDic[lex]) if lex == "python": if not self._keyWordsLanguage == lex: self.SetKeyWords(0, " ".join(keyword.kwlist)) self._keyWordsLanguage = lex else: # Until we can get other keyword lists, we need to clear this out self.SetKeyWords(0, "") self._keyWordsLanguage = "" dabo.ui.callAfter(self.Colourise, 0, 1) else: self.ClearDocumentStyle() self.SetLexer(stc.STC_LEX_CONTAINER) And the init binds the event to OnStyleNeeded def __init__(self, parent, properties=None, attProperties=None, *args, **kwargs): ... self.Bind(stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded) ... and the OnStyleNeeded method calls the styleTimer Unfortunatly I can't overwrite the OnStyleNeeded method in the dabo ClassDesigner. It's just not available. def OnStyleNeeded(self, evt): if not self._syntaxColoring: return self._styleTimer.mode = self.Language.lower() self._styleTimer.start() hmmmm. what if I tried binding the EVT_STC_STYLENEEDED to a new OnStyleNeeded method during initialization and then try playing with that? Does that sound right? It seems like you've got a lot of things going on so I wanted to ask about what your intentions were but it sounds like you didn't have any regarding a custom lexer. Any more thoughts? -- AaronS --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
