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.
This commit is contained in:
Salvador E. Tropea 2023-05-11 23:39:09 +00:00 committed by Seth Hillbrand
parent 1020cdd7a6
commit 9c1509b8c3
2 changed files with 57 additions and 0 deletions

View File

@ -6,3 +6,25 @@
#include <fp_textbox.h>
%}
%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)
%}
}

View File

@ -8,3 +8,38 @@
#include <pcb_textbox.h>
%}
%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)
%}
}