kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #09845
Re: Patch to fix pcbnew example scripts and SWIG interface
Hey, thanks a lot Matthew,
This happened because of the ongoing class interface cleanup Wayne is working on,
I will apply the patch as soon as I check it,
I put the GetValue / GetPads, etc in place, to be ready for those changes,
but then It seems that later I forgot while writing the examples..
I think that it could make sense to change the GetXXX() to XXX() directly, just
removing the wrappers, and keeping everything else the same way.
What do you think?
Greetings,
Mike.
Miguel Angel Ajo
http://www.nbee.es (http://www.nbee.es/)
+34911407752
skype: ajoajoajo
On Monday, 8 de April de 2013 at 21:43, Matthew Beckler wrote:
> Hello,
>
> I've been trying to explore the python scripting interface for pcbnew. I see that some changes have been made to the pcbnew/class_module.h file, such that GetReference() returns a wxString& and Reference() returns the TEXTE_MODULE& itself.
>
> To get the scripting examples to work again, I made a few small changes in pcbnew/scripting/module.i :
>
> === modified file 'pcbnew/scripting/module.i'
> --- pcbnew/scripting/module.i 2012-05-16 09:35:18 +0000
> +++ pcbnew/scripting/module.i 2013-04-08 19:27:00 +0000
> @@ -33,10 +33,10 @@
> %pythoncode
> {
>
> - def GetPads(self): return self.m_Pads
> - def GetDrawings(self): return self.m_Drawings
> - def GetReferenceObj(self): return self.m_Reference
> - def GetValueObj(self): return self.m_Value
> + def GetPads(self): return self.Pads()
> + def GetDrawings(self): return self.GraphicalItems()
> + def GetReferenceObj(self): return self.Reference()
> + def GetValueObj(self): return self.Value()
>
> #def SaveToLibrary(self,filename):
> # return SaveModuleToLibrary(filename,self)
> @@ -52,10 +52,10 @@
>
> if type(itemC) is D_PAD:
> item.thisown=0
> - self.m_Pads.PushBack(itemC)
> + self.GetPads().PushBack(itemC)
> elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
> item.thisown = 0
> - self.m_Drawings.PushBack(item)
> + self.GetDrawings().PushBack(item)
> }
>
> }
>
>
> I also made some changes to two of the example scripts in pcbnew/scripting/examples/ to work with these new functions instead of accessing e.g. m_Reference directly (as that member is now Private).
>
> Hopefully I have prepared the patch correctly and followed all coding standards. Please let me know if I need to fix the patch in any way.
>
> Thanks much,
> Matthew Beckler
> Wayne and Layne, LLC
> _______________________________________________
> 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
>
>
>
>
> Attachments:
> - mbeckler_patch_pcbnew_scripting_module_createPcb_createFPC40.py
>
Follow ups
References