[wingide-users] Execute with Output to an Editor Window
Michael Foord
fuzzyman at voidspace.org.uk
Tue Jan 9 11:32:08 MST 2007
Wingware Support wrote:
> On Mon, 8 Jan 2007, Michael Foord wrote:
>
>> I've implemented a simple Wing script which executes the
>> current script with an external executable (the example shows
>> python as the hardwired executable). The output is piped into a
>> new editor window.
>>
>> You can see the script at:
>>
>> http://www.voidspace.org.uk/python/weblog/arch_d7_2007_01_06.shtml#e605
>>
>> This was a feature we missed from TextPad. having the output in an
>> editor window is often useful.
>>
>> What we'd really like to do is turn tracebacks into links, with callback
>> functions that open the file at the right line. Is this even possible ?
>>
>
> The editor doesn't have any facility for hot spots now and there
> isn't any point<->text position conversion in the API now so
> you'ld be stuck going through the API to call GTK and Scintilla
> calls to get the point and convert it to position, etc. If you
> have access to the Wing sources, there is related code in the
> src/edit/editor.py file (search for _from_point and point_).
>
>
That *sounds* a bit brittle to me (subject to API changes).
What I'll probably do is use a regular expression and check the current
cursor position - and just bind this to another key. Not quite as nice,
but probably sufficient.
>> Also, is there a neater way to clear an output window than :
>>
>> doc.DeleteChars(0, doc.GetLength())
>>
>> (Which doesn't seem to work.)
>>
>
> It should probably throw and exception but you need this instead
> for it to work:
>
> doc.DeleteChars(0, doc.GetLength()-1)
>
>
Ok, thanks.
> Yes, for now this is the way to do it (we designed the API to
> have one way to do things, rather than adding lots and lots of
> functions).
>
>
Understood.
>> Are all the methods on editor and doc objects documented anywhere ? The
>> docstring on doc.DeleteChars wasn't astoundingly helpful :
>>
>> API to access an open editor document. A single document may be
>> shared by multiple editors.
>>
>
> Odd, it should say """ Delete characters in given range """ --
> although I realize that's not terrible information rich either...
> we'll try to improve this.
>
>
Great.
> In any case, the goal is to do all the documentation in the
> docstrings in the code and if anything is added to the manual
> as a reference, it would be auto-generated from those docstrings.
>
>
Autogenerated API docs would be fine. (Endo is a good tool.)
I was browsing through the sources and couldn't *easily* work out which
classes these objects were. Thinking about it now, accessing the
'__class__' and '__module__' attributes of the objects would have been a
good idea.
All the best,
Fuzzyman
http://www.voidspace.org.uk/python/articles.shtml
> Thanks,
>
> Stephan Deibel
>
> --
> Wingware
> Wing IDE for Python
> Advancing Software Development
>
> www.wingware.com
>
>
More information about the wingide-users
mailing list