[wingide-users] Execute with Output to an Editor Window

Wingware Support support at wingware.com
Tue Jan 9 11:14:03 MST 2007


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_).

> 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)

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).

> 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.

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.

Thanks,

Stephan Deibel

--
Wingware
Wing IDE for Python
Advancing Software Development

www.wingware.com


More information about the wingide-users mailing list