From 9c1509b8c340a6a27946b3627ff7ffe05232cf53 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 11 May 2023 23:39:09 +0000 Subject: [PATCH] Provide some degree of compatibility for GetShownText in Python This patch keeps the new API for GetShownText (argument order inverted), but also allows calling the member without parameters. --- pcbnew/python/swig/fp_text.i | 22 ++++++++++++++++++++++ pcbnew/python/swig/pcb_text.i | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/pcbnew/python/swig/fp_text.i b/pcbnew/python/swig/fp_text.i index 5dbcd91cd6..101359ee72 100644 --- a/pcbnew/python/swig/fp_text.i +++ b/pcbnew/python/swig/fp_text.i @@ -6,3 +6,25 @@ #include %} +%extend FP_TEXT +{ + %pythoncode + %{ + # KiCad 6 API compatibility + def GetShownText(self): + r"""GetShownText(FP_TEXT self) -> wxString""" + return _pcbnew.FP_TEXT_GetShownText(self, True, 0) + %} +} + + +%extend FP_TEXTBOX +{ + %pythoncode + %{ + # KiCad 6 API compatibility + def GetShownText(self): + r"""GetShownText(FP_TEXTBOX self) -> wxString""" + return _pcbnew.FP_TEXTBOX_GetShownText(self, True, 0) + %} +} diff --git a/pcbnew/python/swig/pcb_text.i b/pcbnew/python/swig/pcb_text.i index 65f2aa0c8d..f917947cc4 100644 --- a/pcbnew/python/swig/pcb_text.i +++ b/pcbnew/python/swig/pcb_text.i @@ -8,3 +8,38 @@ #include %} + +%extend EDA_TEXT +{ + %pythoncode + %{ + # KiCad 6 API compatibility + def GetShownText(self): + r"""GetShownText(EDA_TEXT self) -> wxString""" + return _pcbnew.EDA_TEXT_GetShownText(self, True, 0) + %} +} + + +%extend PCB_TEXT +{ + %pythoncode + %{ + # KiCad 6 API compatibility + def GetShownText(self): + r"""GetShownText(PCB_TEXT self) -> wxString""" + return _pcbnew.PCB_TEXT_GetShownText(self, True, 0) + %} +} + + +%extend PCB_TEXTBOX +{ + %pythoncode + %{ + # KiCad 6 API compatibility + def GetShownText(self): + r"""GetShownText(PCB_TEXTBOX self) -> wxString""" + return _pcbnew.PCB_TEXTBOX_GetShownText(self, True, 0) + %} +}