[wingide-users] Scripting question
support at wingware.com
Tue Jun 27 14:02:32 EDT 2006
On Mon, 26 Jun 2006, Markus Meyer wrote:
> * In line 314/315 of the script, the document is opened / reactivated
> and then a goto-line command to the error-line reported by PyLint is
> doc = app.OpenDocument(self._lastFilename)
> doc.ExecuteCommand("goto-line", lineno=line)
> However, this does not work. Is there any other / "the right" way to do
Use doc.ScrollToLine(lineno). Optionally set select and pos
arguments which are described in the docstring in the wingapi.py
> * I copied the GetVisualState/SetVisual state implementation from the
> "templating.py" script in Wing's scripts/ directory. But why is this needed?
If you want the same line(s) on the panel/tree selected across
sessions (when quit/restart Wing or close/open project) then you
need to implement these. Otherwise, they're not needed.
> * Is there a preferred way to implement preferences with a script? Is
> there an easy way to add a panel to the preferences dialog for settings?
Unfortunately not yet. You might implement prefs in the same way
as for the options in scripts/cvs.py -- that is, not show them in
the main prefs dialog but show your own dialog.
One thing to consider is whether you want something to be a
user-wide preference or an attribute stored in the project. The
examples in scripts/cvs.py stores the values on a per-project
basis, which might be the way to start and this could be changed
later if needed.
> * The "trees" shown inside the panels do not have a scroll bar for me
> (Wing2.0 on Linux). I copied the corresponding UI creation code from
> "templating.py". Is there a simple way to have scroll bars? Does that
> mean that the template list in "templating.py" doesn't have a scrollbar,
> too? (If yes, I'd consider this to be a bug in "templating.py") Why does
> my "tree" not respond to scroll wheel scrolling? Are those properties of
> the widget used?
Check scripts/templating.py in Wing 2.1.0 final release -- I
think that was a bug in 2.0.4 that was fixed. In that case, the
scrollbars are only shown if needed. Use POLICY_ALWAYS if you
want to show them even when not needed for the content.
> * This is Wing2.0. Will I need to change many things when porting this
> to Wing2.1 (since it says in the docs the API is not stable)?
Some minor changes are needed. The diffs between templating.py
shipped w/ 2.0.4 and 2.1.0 should tell you what you need to know.
Most of the changes are adding the scroll bars and moving from
OpenDocument to the more correctly named OpenEditor (tho the
former still works in 2.1.0's API).
Thanks for working on integrating pylint! We'ld be happy to
include this w/ future versions of Wing if you're willing, and/or
host the script in the "Contrib" downloads area on our website.
Wing IDE for Python
Advancing Software Development
More information about the wingide-users