From 3cb90063a10a3783adb66ea13fd3770d5005ceca Mon Sep 17 00:00:00 2001 From: qu1ck Date: Mon, 3 Jun 2019 23:49:58 -0700 Subject: [PATCH] Pcbnew scripting fixes * Remove infinite recursion calls in footprint.i * Extend DRAWINGS deque iterator to auto cast contained BOARD_ITEMS, similar to what dlist implementation did. --- pcbnew/swig/board.i | 15 +++++++++++++++ pcbnew/swig/footprint.i | 3 --- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i index ca6d7b119f..91c41cc90a 100644 --- a/pcbnew/swig/board.i +++ b/pcbnew/swig/board.i @@ -106,6 +106,21 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) #include %} +%extend std::deque +{ + %pythoncode + %{ + def __iter__(self): + it = self.iterator() + try: + while True: + item = it.next() # throws StopIteration when iterator reached the end. + yield item.Cast() + except StopIteration: + return + %} +} + %extend BOARD { // BOARD_ITEM_CONTAINER's interface functions will be implemented by SWIG diff --git a/pcbnew/swig/footprint.i b/pcbnew/swig/footprint.i index 2c3108b17e..15b5214aaf 100644 --- a/pcbnew/swig/footprint.i +++ b/pcbnew/swig/footprint.i @@ -50,9 +50,6 @@ %pythoncode %{ - def Pads(self): return self.Pads() - def GraphicalItems(self): return self.GraphicalItems() - #def SaveToLibrary(self,filename): # return SaveModuleToLibrary(filename,self)