On 3/5/07, SPE Stani's Python Editor <[EMAIL PROTECTED]> wrote:
Becomes in the tree:
def hello_world():
(if linux:) #invisible
class Widget:
def __init__(self):
I think by recognizing the fake nodes (with eg regular expression) we
can transform easily the fold explorer in the class explorer, but
still I think the fold explorer is still valuable on its own even if
there is also the class explorer implemented.
At the very least, it makes the implementation of a class explorer
simpler by basing it on the fold explorer for the languages that
support folding. We can provide users with the ability to define
their own regular expressions for matching todos, fixmes, or whatever.
Is this not more generic?
def open(self,fileName, language, encoding=DEFAULT_ENCODING, line=0):
self.setLanguage(language)
self.setText(open(fileName).read(),encoding)
wx.CallAfter(self.GotoLine,line)
def setText(self,text,encoding=DEFAULT_ENCODING):
self.encoding = encoding
self.SetText(text.decode(encoding))
self.Colourise(0, self.GetTextLength()) #make sure everything is lexed
wx.CallAfter(self.explorer.update)
It still barfs on that source file. There's a \xdd character imbedded
in scintilla's Editor.cxx source file, and using the utf8 decoder as
above returns the error UnicodeDecodeError: 'utf8' codec can't decode
bytes in position 32785-32786: invalid data
I used the AddStyledText("\0".join(text) + "\0") hack because that
allowed me to use the stc as a generic binary datastore -- you can
e.g. store images in an STC if you use add data this way. That's how
I implemented my hex editor.
Rob