← Back to team overview

kicad-developers team mailing list archive

Re: PATCH : Enhanced Python Shell - Proposed version

 

At least the footprint wizards should be checked.
If I remember correctly at least on OSX they could rely on the path settings as they were before (this was one I did to make them work some while back)...
I can check on the weekend, if nobody is able to do before.


Regards,
Bernhard

On 2015-12-17 16:49, Wayne Stambaugh wrote:
The build issues have been resolved but I noticed that you have changes
the python script path form scripting/plugins to scripting/.  This may
break things for users and in package installers.  It' needs to be test
by some of our package devs and verified by our Python users to make
sure your path changes didn't break anything.  Any of you heavy Python
users have any thoughts on this patch since it impacts you the most?

On 12/17/2015 12:10 AM, Strontium wrote:
Hi Wayne,

Thanks for testing this on windows, I really appreciate it a lot.

I moved the offending comments from being inline comments and placed
them into the Docstring.  It has the added benefit of making them more
visible to end users.

See: http://i.imgur.com/Zq1pdyV.jpg
(Apologies on the quality of the screen capture.)

I also ran the pure python code I am submitting for the shell through PEP8, PEP257 and pyflakes and corrected all problems they highlighted. NOTE:
They are all style issues and not logic faults.

I don't believe there are style guides for python and KiCad yet, but I
figured PEP8 and PEP257 would be a minimum.

I believe I fixed the style problem with the C++ code.

Revised patch attached.
Updated code is also on my github.

Steven

On 17/12/15 05:56, Wayne Stambaugh wrote:
Your patch fails to build using swig 3.0.6 on windows due to the
comments you added to kicadplugins.i.  Here is the output:

C:/msys64/home/wstambaugh/src/kicad/product/pcbnew/../scripting\kicadplugins.i(101)

: Error: Unknown SWIG preprocessor directive: The (if this is a block of
target language code, delimit it with %{ and %})
C:/msys64/home/wstambaugh/src/kicad/product/pcbnew/../scripting\kicadplugins.i(105)

: Error: Unknown SWIG preprocessor directive: The (if this is a block of
target language code, delimit it with %{ and %})
C:/msys64/home/wstambaugh/src/kicad/product/pcbnew/../scripting\kicadplugins.i(109)

: Error: Unknown SWIG preprocessor directive: The (if this is a block of
target language code, delimit it with %{ and %})
C:/msys64/home/wstambaugh/src/kicad/product/pcbnew/../scripting\kicadplugins.i(113)

: Error: Unknown SWIG preprocessor directive: And (if this is a block of
target language code, delimit it with %{ and %})
C:/msys64/home/wstambaugh/src/kicad/product/pcbnew/../scripting\kicadplugins.i(118)

: Error: Unknown SWIG preprocessor directive: NOTE (if this is a block
of target language code, delimit it with %{ and %})
pcbnew/CMakeFiles/_pcbnew.dir/build.make:61: recipe for target
'pcbnew/pcbnewPYTHON_wrap.cxx' failed

I tried using the recommended %{ %} to wrap the comments. It built fine but crashed when I ran it. Your best bet is to get rid of the comments or figure out the proper swig technique for wrapping python comments. I
tried removing the comments and it worked fine.  You also have some
coding policy violations ( missing spaces before and after parenthesis )
that need to fixed.


On 12/16/2015 5:58 AM, Strontium wrote:
Hello List,

I believe I have cleaned up my patch and made the enhanced shell do
everything it should.

It has a tabbed interface, with simple text editing capabilities.

Its GUI can be used to introspect the full internal state of pcbnew, as
exposed by the python interface.

The editor can be used to code python scripts (with syntax
highlighting), and it has auto-completion built in. Ie, type word press (dot) and it gives you a list of possibilities which follow. Further,
you can use the editor to load up KiCad files and edit them without
having to use an external editor, if one desires.

It will allow you to save your interactive history, and restore it in a new session. It has a startup file which is executed when the python shell first starts, and automatically creates a default if it doesn't exist. All of its configuration, history and startup files are stored
in the users KiCad configuration directory on each platform.

The default startup file doesn't do anything, but includes a commented out example which will automatically load pcbnew into the shell, and get
the current board on screen.  Two very common things that need to be
done most times when you start the python shell.

The shell is fully written in python, and uses the foundation of
PyAlamode included with wxpython.  It does not introduce any further
dependencies on KiCad, everything it achieves is already built into
KiCad, and not currently exposed.

It should be possible to extend the shell in future and add features,
without requiring to hack core code inside pcbnew.

The changes to the core of pcbnew, that I did, were to facilitate this, and I discuss why I did them in earlier posts. They haven't changed in this patch. There may be better ways to achieve this and I am open to
suggestions.

I have only tested on Linux, but I do not believe any of the OS specific
code changes that I made should negatively effect Windows or Mac,
nevertheless it needs testing on those platforms and I do not have
access to them.

Screenshots of it in action:

http://i.imgur.com/lTFFddR.png
http://i.imgur.com/qbACtPR.png
http://i.imgur.com/Yny4Lnc.png
http://i.imgur.com/q2AjrPi.png

The code is also available on my github:
https://github.com/stevenj/kicad-source-mirror/tree/enahnced-python-shell


Hopefully this is useful.

Steven


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Follow ups

References