Scripting Wing Woes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Scripting Wing Woes

Peter Kropf
Hi -

I'd like to add the ability to track some keyword that are used
comments to indicate tasks that need to be done and things that need
to be fixed. Basic format would be TASK: or FIXME: followed by some
text that indicates what needs to be done. (Anyone know if this is
already a feature of Wing? I couldn't find any references in the
docs...)

To do this, I reasoned that the scripting API of Wing would be the
best way to go about getting it done. And since I don't know all that
much about the API, I decided to use the help that is available to
work thought some of the details. There's a Scripting Example
(http://wingware.com/doc/scripting/example) that's available. But when
I try to run it, I see the following in the messages tab:

Error::Error executing script .user.internal_script_test.test_script
Runtime failure details:
Exception: 'exceptions.AttributeError'
Value = "CAPIApplication instance has no attribute 'DisplayMessage'"
Traceback:
  File "2.3/src/command/commandmgr.pyo", line 735, in Execute
  File "/home/peter/.wingide2/scripts/test.py", line 8, in test_script

The text was cut and pasted from the example page so I'm reasonably
certain that I didn't screw up the syntax.

Should this work? Any ideas why it doesn't work for me?

Thanks!

- Peter
_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|

Re: Scripting Wing Woes

Wing IDE Support
Peter Kropf wrote:
> I'd like to add the ability to track some keyword that are used
> comments to indicate tasks that need to be done and things that need
> to be fixed. Basic format would be TASK: or FIXME: followed by some
> text that indicates what needs to be done. (Anyone know if this is
> already a feature of Wing? I couldn't find any references in the
> docs...)

This isn't currently implemented in Wing.  It's ambitious to try and do
this as a script, especially when it comes to displaying the results.
You may want to put the results in a temporary file like the cvs script
does.

> Error::Error executing script .user.internal_script_test.test_script
> Runtime failure details:
> Exception: 'exceptions.AttributeError'
> Value = "CAPIApplication instance has no attribute 'DisplayMessage'"
> Traceback:
>   File "2.3/src/command/commandmgr.pyo", line 735, in Execute
>   File "/home/peter/.wingide2/scripts/test.py", line 8, in test_script

Unfortunately, the example is wrong :(.  It should be:

import wingapi
def test_script(test_str):
   app = wingapi.gApplication
   v = "Product info is: " + str(app.GetProductInfo())
   v += "\nAnd you typed: %s" % test_str
   app.ShowMessageDialog("Test Message", v)

John
_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|

Re: Scripting Wing Woes

Peter Kropf
On 8/1/05, Wingware Support <[hidden email]> wrote:

> Peter Kropf wrote:
> > I'd like to add the ability to track some keyword that are used
> > comments to indicate tasks that need to be done and things that need
> > to be fixed. Basic format would be TASK: or FIXME: followed by some
> > text that indicates what needs to be done. (Anyone know if this is
> > already a feature of Wing? I couldn't find any references in the
> > docs...)
>
> This isn't currently implemented in Wing.  It's ambitious to try and do
> this as a script, especially when it comes to displaying the results.
> You may want to put the results in a temporary file like the cvs script
> does.

My thought was to add a tab to the Project / Source Browser tab list
that would show the places in the project files where these types of
entries were found.

Do I take it as you're suggesting that this is a whee bit too
ambitious to do with the script API? Any thoughts / suggestions for
other where where I might accomplish this?


> > Error::Error executing script .user.internal_script_test.test_script
> > Runtime failure details:
> > Exception: 'exceptions.AttributeError'
> > Value = "CAPIApplication instance has no attribute 'DisplayMessage'"
> > Traceback:
> >   File "2.3/src/command/commandmgr.pyo", line 735, in Execute
> >   File "/home/peter/.wingide2/scripts/test.py", line 8, in test_script
>
> Unfortunately, the example is wrong :(.  It should be:
>
> import wingapi
> def test_script(test_str):
>    app = wingapi.gApplication
>    v = "Product info is: " + str(app.GetProductInfo())
>    v += "\nAnd you typed: %s" % test_str
>    app.ShowMessageDialog("Test Message", v)

May I suggest that you update the documentation that's show on your website?

Thanks for the reponse...

- Peter
_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|

Re: Scripting Wing Woes

Wing IDE Support
Peter Kropf wrote:
> My thought was to add a tab to the Project / Source Browser tab list
> that would show the places in the project files where these types of
> entries were found.

This is not supported under the api currently.  The api is intended to
be a way to provide a stable api for fairly simple and common tasks.  To
do something like adding a new tool pane that is updated as the user is
editing, you'll go beyond the api and get into code that might change
between releases, but probably won't -- we're not planning on
rearchitecting Wing's implementation any time soon.  The first step in
doing this is probably to download the source, set up Wing to debug
itself, and incrementally add features to the tool.

> May I suggest that you update the documentation that's show on your website?

We will do this soon.

Thanks,

John
_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|

Re: Scripting Wing Woes

Wing IDE Support
Note that the templating.py script that ships with Wing *does* add a
new tool panel type, and that might be a good place to start.  I don't
recommend trying to write something that complex w/o debugging Wing
with itself, but it will give you an idea of how it can be done even
before you download the Wing sources.

Stephan Deibel

--
Wingware
Wing IDE for Python
Advancing Software Development

www.wingware.com

On Mon, 1 Aug 2005, Wingware Support wrote:

> Peter Kropf wrote:
> > My thought was to add a tab to the Project / Source Browser tab list
> > that would show the places in the project files where these types of
> > entries were found.
>
> This is not supported under the api currently.  The api is intended to
> be a way to provide a stable api for fairly simple and common tasks.  To
> do something like adding a new tool pane that is updated as the user is
> editing, you'll go beyond the api and get into code that might change
> between releases, but probably won't -- we're not planning on
> rearchitecting Wing's implementation any time soon.  The first step in
> doing this is probably to download the source, set up Wing to debug
> itself, and incrementally add features to the tool.
>
> > May I suggest that you update the documentation that's show on your website?
>
> We will do this soon.
>
> Thanks,
>
> John
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide
>
_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide