kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #29802
Re: Pcbnew Python Interface breakage?
Due to me not being able to imagine that problems regarding drawings
could be related to the connectivity algorithm, I started digging around
a bit.
I searched around the sourcecode for a while and it looks a bit
confusing regarding some of the Getter functions for returning objects
from the board object.
The now non-functional method GetDrawings() is actually implemented in
pcbnew/swig/board.i and is thus just available from Python.
I guess the reason it broke yesterday is that Tomasz pushed something
along his connectivity algorithm that is not (or is it?) related to the
connectivity algorithm. Have a look at this commit from 26. Sep 2016
that got pushed along with the stuff yesterday.
https://github.com/KiCad/kicad-source-mirror/commit/08314082dbdfdd634b6cdcaeb000b0e4c23adf26#diff-ce7955f5bf51c6f27b918fe0a0fc2b39
It looks like m_Drawings is now private (before it was public), hence
the reason for the python-only GetDrawings() failing (I presume).
With this change Tomasz also added DrawingsList() instead, with a hint
that it will again be deprecated and we should use Drawings() instead.
However as jsreynaud pointed out, a Python compatible
DLIST_ITERATOR_WRAPPER does not yet exist (or I cannot figure it out).
I am unsure whether the changes that Tomasz did were intentional
(because they are from last year and I cannot see the relation to the
connectivity algorithm) and whether we should completely switch over to
DrawingsList() and remove GetDrawings() from pcbnew/swig/board.i with
respect to python.
Maybe Tomasz can elaborate, because he seem to know some stuff about the
mentioned and planned board item storage refactoring.
Thanks everyone and Best Regards
Simon
Am 26.06.2017 um 12:27 schrieb reynaud:
> The new connectivity algorithm was pushed this last days. Big
> improvements, speed... But some changes in internal API...
> For the moment python API is (mostly) directly mapped to internal API...
>
>
> Le lundi 26 juin 2017 à 12:11 +0200, Simon Küppers a écrit :
>> Hey,
>> It works for me thanks. But what is the background here? Has someone
>> just changed the name of something in the Python API (are we supposed to
>> use DrawingsList() from now on) or is this just something like a workaround?
>>
>> Thanks
>> Simon
>>
>> Am 26.06.2017 um 12:03 schrieb reynaud:
>>> Hi, DrawingsList() is a good candidate ;) Le lundi 26 juin 2017 à
>>> 11:34 +0200, easyw a écrit :
>>>> Hi Js, thx with PadsList() the script is fine now... Do you have any
>>>> suggestion also for "for drw in board.GetDrawings(): GetDrawings def
>>>> GetDrawings(self): return self.m_Drawings File ... AttributeError:
>>>> type object 'object' has no attribute '__getattr__'" reference this
>>>> action script
>>>> https://github.com/easyw/kicad-action-plugins/blob/master/action_menu_move_to_layer.py
>>>> thx Maurice On 06/26/2017 11:21 AM, reynaud wrote:
>>>>> Hi, Python interface is not stable. You can have some changes on
>>>>> daily build version. In your case, using PadsList() instead of
>>>>> Pads() should fix your issue. Le lundi 26 juin 2017 à 10:23 +0200,
>>>>> easyw a écrit :
>>>>>> Hi, I can confirm the same error on windows 10. I get also an
>>>>>> other kind of error in my annular plugin that worked till now "for
>>>>>> pad in module.Pads(): TypeError 'SwigPyObject' object is not
>>>>>> iterable" BR Maurice On 06/25/2017 5:46 PM, Simon Küppers wrote:
>>>>>>> Hi, I just updated KiCad on Linux Mint using the Launchpad PPA to
>>>>>>> test the new connection algorithm. However, a SWIG error starts
>>>>>>> to pop up in my python plugins. Right now I can produce the
>>>>>>> error, when calling GetDrawings on the board object (which worked
>>>>>>> a few days ago). It looks like the SWIG wrappers are
>>>>>>> desynchronized from the C++-code. Is that (at all) possible? This
>>>>>>> is the Traceback I get: ---- Traceback (most recent call last):
>>>>>>> File
>>>>>>> "/home/sk/.kicad_plugins/action_viafence/viafence_action.py",
>>>>>>> line 160, in Run boardItem =
>>>>>>> self.boardObj.GetDrawings().GetFirst() File
>>>>>>> "/usr/lib/python2.7/dist-packages/pcbnew.py", line 18508, in
>>>>>>> GetDrawings def GetDrawings(self): return self.m_Drawings File
>>>>>>> "/usr/lib/python2.7/dist-packages/pcbnew.py", line 17803, in
>>>>>>> <lambda> __getattr__ = lambda self, name: _swig_getattr(self,
>>>>>>> BOARD, name) File "/usr/lib/python2.7/dist-packages/pcbnew.py",
>>>>>>> line 74, in _swig_getattr return _swig_getattr_nondynamic(self,
>>>>>>> class_type, name, 0) File
>>>>>>> "/usr/lib/python2.7/dist-packages/pcbnew.py", line 69, in
>>>>>>> _swig_getattr_nondynamic return object.__getattr__(self, name)
>>>>>>> AttributeError: type object 'object' has no attribute
>>>>>>> '__getattr__' Best Regards Simon
>>>>>>> _______________________________________________ Mailing list:
>>>>>>> https://launchpad.net/~kicad-developers Post to :
>>>>>>> kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>>> <mailto: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
>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>>> <mailto: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
>>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>> <mailto: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
>>> <mailto: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 <mailto: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
>
References