KiCad PCB EDA Suite
pcbnew_scripting.h File Reference
#include <wx/string.h>

Go to the source code of this file.

Functions

void pcbnewGetUnloadableScriptNames (wxString &aNames)
 Collect the list of python scripts which could not be loaded. More...
 
void pcbnewGetScriptsSearchPaths (wxString &aNames)
 Collect the list of paths where python scripts are searched. More...
 
void pcbnewGetWizardsBackTrace (wxString &aNames)
 Return the backtrace of errors (if any) when wizard python scripts are loaded. More...
 

Function Documentation

◆ pcbnewGetScriptsSearchPaths()

void pcbnewGetScriptsSearchPaths ( wxString &  aNames)

Collect the list of paths where python scripts are searched.

Parameters
aNamesis a wxString which will contain the paths (separated by '
')

Definition at line 130 of file pcbnew_scripting.cpp.

131{
132 pcbnewRunPythonMethodWithReturnedString( "pcbnew.GetWizardsSearchPaths", aNames );
133}
static void pcbnewRunPythonMethodWithReturnedString(const char *aMethodName, wxString &aNames)
Run a python method from the pcbnew module.

References pcbnewRunPythonMethodWithReturnedString().

Referenced by DIALOG_FOOTPRINT_WIZARD_LIST::initLists().

◆ pcbnewGetUnloadableScriptNames()

void pcbnewGetUnloadableScriptNames ( wxString &  aNames)

Collect the list of python scripts which could not be loaded.

Parameters
aNamesis a wxString which will contain the filenames (separated by '
')

Definition at line 124 of file pcbnew_scripting.cpp.

125{
126 pcbnewRunPythonMethodWithReturnedString( "pcbnew.GetUnLoadableWizards", aNames );
127}

References pcbnewRunPythonMethodWithReturnedString().

Referenced by DIALOG_FOOTPRINT_WIZARD_LIST::initLists().

◆ pcbnewGetWizardsBackTrace()

void pcbnewGetWizardsBackTrace ( wxString &  aNames)

Return the backtrace of errors (if any) when wizard python scripts are loaded.

Parameters
aNamesis a wxString which will contain the trace

Definition at line 136 of file pcbnew_scripting.cpp.

137{
138 pcbnewRunPythonMethodWithReturnedString( "pcbnew.GetWizardsBackTrace", aTrace );
139
140 // Filter message before displaying them
141 // a trace starts by "Traceback" and is followed by 2 useless lines
142 // for our purpose
143 wxArrayString traces;
144 wxStringSplit( aTrace, traces, '\n' );
145
146 // Build the filtered message (remove useless lines)
147 aTrace.Clear();
148
149 for( unsigned ii = 0; ii < traces.Count(); ++ii )
150 {
151 if( traces[ii].Contains( wxT( "Traceback" ) ) )
152 {
153 ii += 2; // Skip this line and next lines which are related to pcbnew.py module
154
155 if( !aTrace.IsEmpty() ) // Add separator for the next trace block
156 aTrace << wxT( "\n**********************************\n" );
157 }
158 else
159 {
160 aTrace += traces[ii] + wxT( "\n" );
161 }
162 }
163}
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.

References pcbnewRunPythonMethodWithReturnedString(), and wxStringSplit().

Referenced by PANEL_PCBNEW_ACTION_PLUGINS::OnShowErrorsButtonClick(), DIALOG_FOOTPRINT_WIZARD_LIST::onShowTrace(), and PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow().