pcbnew scripting: fixed for coding style policy

This commit is contained in:
Miguel Angel Ajo 2012-07-31 23:00:33 +02:00
parent f96d557e73
commit 474128a445
7 changed files with 176 additions and 179 deletions

View File

@ -26,13 +26,13 @@ FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
{
int max = GetSize();
for( int i=0; i<max;i++ )
for( int i=0; i<max; i++ )
{
FOOTPRINT_WIZARD *wizard = GetWizard( i );
wxString name = wizard->GetName();
if ( name.Cmp(aName) )
if ( name.Cmp( aName ) )
return wizard;
}
@ -48,10 +48,7 @@ void FOOTPRINT_WIZARDS::register_wizard(FOOTPRINT_WIZARD *aWizard)
{
wxString name = aWizard->GetName();
m_FootprintWizards.push_back(aWizard);
//printf("Registered footprint wizard '%s'\n",(const char*)name.mb_str() );
m_FootprintWizards.push_back( aWizard );
}

View File

@ -33,13 +33,13 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_FOOTPRINT_WIZARD_NEXT:
m_PageList->SetSelection(m_PageList->GetSelection()+1,true);
m_PageList->SetSelection( m_PageList->GetSelection()+1, true );
break;
case ID_FOOTPRINT_WIZARD_PREVIOUS:
page = m_PageList->GetSelection()-1;
if (page<0) page=0;
m_PageList->SetSelection(page,true);
m_PageList->SetSelection( page, true );
break;
default:
@ -95,13 +95,13 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
MODULE *m = m_FootprintWizard->GetModule();
if (m)
if ( m )
{
/* Here we should make a copy of the object before adding to board*/
m->SetParent((EDA_ITEM*)GetBoard());
GetBoard()->m_Modules.Append(m);
wxPoint p(0,0);
m->SetPosition(p);
wxPoint p( 0 , 0 );
m->SetPosition( p );
}
else
{
@ -112,21 +112,21 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
{
DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard =
new DIALOG_FOOTPRINT_WIZARD_LIST(this);
DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard =
new DIALOG_FOOTPRINT_WIZARD_LIST( this );
selectWizard->ShowModal();
m_FootprintWizard = selectWizard->GetWizard();
if (m_FootprintWizard)
if ( m_FootprintWizard )
{
m_wizardName = m_FootprintWizard->GetName();
m_wizardDescription = m_FootprintWizard->GetDescription();
}
ReloadFootprint();
Zoom_Automatique(false);
Zoom_Automatique( false );
DisplayWizardInfos();
ReCreatePageList();
ReCreateParameterList();
@ -149,36 +149,36 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
int page = m_PageList->GetSelection();
if (page<0)
if ( page<0 )
return;
int n=m_ParameterGrid->GetNumberRows();
wxArrayString arr;
wxArrayString ptList = m_FootprintWizard->GetParameterTypes(page);
for (int i=0;i<n;i++)
for ( int i=0; i<n; i++ )
{
wxString value = m_ParameterGrid->GetCellValue(i,1);
wxString value = m_ParameterGrid->GetCellValue( i, 1 );
// if this parameter is expected to be an internal
// unit convert it back from the user format
if (ptList[i]==wxT("IU"))
{
double dValue;
value.ToDouble(&dValue);
value.ToDouble( &dValue );
// convert from mils to inches where it's needed
if (g_UserUnit==INCHES) dValue = dValue / 1000.0;
dValue = From_User_Unit(g_UserUnit,dValue);
dValue = From_User_Unit( g_UserUnit, dValue);
value.Printf(wxT("%lf"),dValue);
value.Printf( wxT("%lf"), dValue );
}
arr.Add(value);
arr.Add( value );
}
wxString res = m_FootprintWizard->SetParameterValues(page,arr);
wxString res = m_FootprintWizard->SetParameterValues( page, arr );
ReloadFootprint();
DisplayWizardInfos();

View File

@ -234,11 +234,11 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
*/
if( m_PageListWindow )
{
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_PageListWindow);
pane.MinSize( wxSize(m_PageListSize.x, -1));
wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow );
pane.MinSize( wxSize( m_PageListSize.x, -1 ) );
}
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_ParameterGridWindow);
pane.MinSize(wxSize(m_ParameterGridSize.x, -1));
wxAuiPaneInfo& pane = m_auimgr.GetPane( m_ParameterGridWindow );
pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) );
m_auimgr.Update();
@ -358,10 +358,10 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
m_PageList->Clear();
int max_page = m_FootprintWizard->GetNumParameterPages();
for (int i=0;i<max_page;i++)
for ( int i=0; i<max_page; i++)
{
wxString name = m_FootprintWizard->GetParameterPageName(i);
m_PageList->Append(name);
wxString name = m_FootprintWizard->GetParameterPageName( i );
m_PageList->Append( name );
}
m_PageList->SetSelection( 0, true );
@ -414,44 +414,43 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
// Dimension the wxGrid
m_ParameterGrid->CreateGrid(fpList.size(),3);
for (unsigned int i=0;i<fpList.size();i++)
for (unsigned int i=0; i<fpList.size(); i++)
{
wxString name,value,units;
name = fpList[i];
value = fvList[i];
m_ParameterGrid->SetCellValue( i, 0, name);
m_ParameterGrid->SetCellValue( i, 0, name );
m_ParameterGrid->SetReadOnly( i, 0 );
if (ptList[i]==wxT("IU"))
if ( ptList[i]==wxT( "IU" ) )
{
// We are handling internal units, so convert them to the current
// system selected units and store into value.
double dValue;
value.ToDouble(&dValue);
value.ToDouble( &dValue );
dValue = To_User_Unit(g_UserUnit,dValue);
dValue = To_User_Unit( g_UserUnit, dValue );
if (g_UserUnit==INCHES) // we convert inches into mils for more detail
if ( g_UserUnit==INCHES ) // we convert inches into mils for more detail
{
dValue = dValue*1000.0;
units = wxT("mils");
units = wxT( "mils" );
}
else if (g_UserUnit==MILLIMETRES)
else if ( g_UserUnit==MILLIMETRES )
{
units = wxT("mm");
units = wxT( "mm" );
}
value.Printf(wxT("%lf"),dValue);
value.Printf( wxT( "%lf" ), dValue );
}
else if (ptList[i]==wxT("UNITS")) // 1,2,3,4,5 ... N
else if ( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N
{
units = wxT("");
units = wxT( "" );
}
m_ParameterGrid->SetCellValue( i, 1 , value );
m_ParameterGrid->SetCellValue( i, 2 , units );
m_ParameterGrid->SetReadOnly( i, 2 );
}
@ -529,7 +528,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
return;
bool footprintWizardsChanged=false;
if (footprintWizardsChanged)
if ( footprintWizardsChanged )
{
// If we are here, the library list has changed, rebuild it
ReCreatePageList();
@ -734,6 +733,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
_( "Insert footprint in board" ) );
}
#endif
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
@ -745,4 +745,5 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar()
{
}

View File

@ -9,12 +9,12 @@
PYTHON_FOOTPRINT_WIZARD::PYTHON_FOOTPRINT_WIZARD(PyObject *aWizard)
{
this->m_PyWizard= aWizard;
Py_XINCREF(aWizard);
Py_XINCREF( aWizard );
}
PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD()
{
Py_XDECREF(this->m_PyWizard);
Py_XDECREF( this->m_PyWizard );
}
PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aArglist)
@ -22,85 +22,86 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aAr
PyObject *pFunc;
/* pFunc is a new reference to the desired method */
pFunc = PyObject_GetAttrString(this->m_PyWizard, aMethod);
pFunc = PyObject_GetAttrString( this->m_PyWizard, aMethod );
if (pFunc && PyCallable_Check(pFunc))
if ( pFunc && PyCallable_Check( pFunc ) )
{
PyObject *result;
result = PyObject_CallObject(pFunc, aArglist);
result = PyObject_CallObject( pFunc, aArglist );
if (PyErr_Occurred())
if ( PyErr_Occurred() )
{
PyObject *t, *v, *b;
PyErr_Fetch(&t, &v, &b);
printf ("calling %s()\n",aMethod);
printf ("Exception: %s\n",PyString_AsString(PyObject_Str(v)));
printf (" : %s\n",PyString_AsString(PyObject_Str(b)));
PyErr_Fetch( &t, &v, &b );
printf ( "calling %s()\n", aMethod );
printf ( "Exception: %s\n", PyString_AsString( PyObject_Str(v) ) );
printf ( " : %s\n", PyString_AsString( PyObject_Str(b) ) );
}
if (result)
if ( result )
{
Py_XDECREF(pFunc);
return result;
Py_XDECREF( pFunc );
return result;
}
}
else
{
printf("method not found, or not callable: %s\n",aMethod);
printf( "method not found, or not callable: %s\n", aMethod );
}
if (pFunc) Py_XDECREF(pFunc);
if ( pFunc )
Py_XDECREF( pFunc );
return NULL;
}
wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod(const char* aMethod, PyObject *aArglist)
wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObject *aArglist )
{
wxString ret;
ret.Clear();
PyObject *result = CallMethod(aMethod,aArglist);
if (result)
PyObject *result = CallMethod( aMethod, aArglist );
if ( result )
{
const char *str_res = PyString_AsString(result);
ret = wxString::FromUTF8(str_res);
Py_DECREF(result);
const char *str_res = PyString_AsString( result );
ret = wxString::FromUTF8( str_res );
Py_DECREF( result );
}
return ret;
}
wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
(const char *aMethod, PyObject *aArglist)
( const char *aMethod, PyObject *aArglist )
{
PyObject *result, *element;
wxArrayString ret;
wxString str_item;
result = CallMethod(aMethod,aArglist);
result = CallMethod( aMethod, aArglist );
if (result)
if ( result )
{
if (!PyList_Check(result))
if ( !PyList_Check(result) )
{
Py_DECREF(result);
ret.Add(wxT("PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod, "
"result is not a list"),1);
Py_DECREF( result );
ret.Add( wxT("PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod, "
"result is not a list"),1 );
return ret;
}
int list_size = PyList_Size(result);
int list_size = PyList_Size( result );
for (int n=0;n<list_size;n++)
for ( int n=0; n<list_size; n++ )
{
element = PyList_GetItem(result,n);
element = PyList_GetItem( result, n );
const char *str_res = PyString_AsString(element);
str_item = wxString::FromUTF8(str_res);
ret.Add(str_item,1);
const char *str_res = PyString_AsString( element );
str_item = wxString::FromUTF8( str_res );
ret.Add( str_item, 1 );
}
Py_DECREF(result);
Py_DECREF( result );
}
@ -111,17 +112,17 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
wxString PYTHON_FOOTPRINT_WIZARD::GetName()
{
return CallRetStrMethod("GetName");
return CallRetStrMethod( "GetName" );
}
wxString PYTHON_FOOTPRINT_WIZARD::GetImage()
{
return CallRetStrMethod("GetImage");
return CallRetStrMethod( "GetImage" );
}
wxString PYTHON_FOOTPRINT_WIZARD::GetDescription()
{
return CallRetStrMethod("GetDescription");
return CallRetStrMethod( "GetDescription" );
}
int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages()
@ -130,52 +131,53 @@ int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages()
PyObject *result;
/* Time to call the callback */
result = CallMethod("GetNumParameterPages",NULL);
result = CallMethod( "GetNumParameterPages" , NULL );
if (result)
{
if (!PyInt_Check(result)) return -1;
ret = PyInt_AsLong(result);
Py_DECREF(result);
if ( !PyInt_Check( result ) )
return -1;
ret = PyInt_AsLong( result );
Py_DECREF( result );
}
return ret;
}
wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName(int aPage)
wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
{
wxString ret;
PyObject *arglist;
PyObject *result;
/* Time to call the callback */
arglist = Py_BuildValue("(i)", aPage);
result = CallMethod("GetParameterPageName",arglist);
Py_DECREF(arglist);
arglist = Py_BuildValue( "(i)", aPage );
result = CallMethod( "GetParameterPageName", arglist );
Py_DECREF( arglist );
if (result)
if ( result )
{
const char *str_res = PyString_AsString(result);
ret = wxString::FromUTF8(str_res);
Py_DECREF(result);
const char *str_res = PyString_AsString( result );
ret = wxString::FromUTF8( str_res );
Py_DECREF( result );
}
return ret;
}
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames(int aPage)
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage )
{
PyObject *arglist;
wxArrayString ret;
arglist = Py_BuildValue("(i)", aPage);
ret = CallRetArrayStrMethod("GetParameterNames",arglist);
Py_DECREF(arglist);
arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
Py_DECREF( arglist );
for (unsigned i=0;i<ret.GetCount();i++)
for ( unsigned i=0; i<ret.GetCount(); i++ )
{
wxString rest;
wxString item = ret[i];
if (item.StartsWith(wxT("*"),&rest))
if ( item.StartsWith( wxT("*"), &rest ) )
{
ret[i]=rest;
}
@ -185,27 +187,27 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames(int aPage)
return ret;
}
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes(int aPage)
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage )
{
PyObject *arglist;
wxArrayString ret;
arglist = Py_BuildValue("(i)", aPage);
ret = CallRetArrayStrMethod("GetParameterNames",arglist);
arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
Py_DECREF(arglist);
for (unsigned i=0;i<ret.GetCount();i++)
for ( unsigned i=0; i<ret.GetCount(); i++ )
{
wxString rest;
wxString item = ret[i];
if (item.StartsWith(wxT("*"),&rest))
if ( item.StartsWith( wxT("*"), &rest ) )
{
ret[i]=wxT("UNITS"); /* units */
ret[i]=wxT( "UNITS" ); /* units */
}
else
{
ret[i]=wxT("IU"); /* internal units */
ret[i]=wxT( "IU" ); /* internal units */
}
}
@ -215,52 +217,50 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes(int aPage)
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterValues(int aPage)
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterValues( int aPage )
{
PyObject *arglist;
wxArrayString ret;
arglist = Py_BuildValue("(i)", aPage);
ret = CallRetArrayStrMethod("GetParameterValues",arglist);
Py_DECREF(arglist);
arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterValues", arglist );
Py_DECREF( arglist );
return ret;
}
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterErrors(int aPage)
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterErrors( int aPage )
{
PyObject *arglist;
wxArrayString ret;
arglist = Py_BuildValue("(i)", aPage);
ret = CallRetArrayStrMethod("GetParameterErrors",arglist);
Py_DECREF(arglist);
arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterErrors", arglist );
Py_DECREF( arglist );
return ret;
}
wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues(int aPage,wxArrayString& aValues)
wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues( int aPage, wxArrayString& aValues )
{
int len = aValues.size();
PyObject *py_list;
py_list = PyList_New(len);
py_list = PyList_New( len );
for (int i=0;i<len;i++)
for ( int i=0; i<len ; i++ )
{
wxString str = aValues[i];
PyObject *py_str = PyString_FromString((const char*)str.mb_str());
PyList_SetItem(py_list, i, py_str);
PyObject *py_str = PyString_FromString( (const char*)str.mb_str() );
PyList_SetItem( py_list, i, py_str );
}
PyObject *arglist;
arglist = Py_BuildValue("(i,O)", aPage,py_list);
wxString res = CallRetStrMethod("SetParameterValues",arglist);
Py_DECREF(arglist);
arglist = Py_BuildValue( "(i,O)", aPage, py_list );
wxString res = CallRetStrMethod( "SetParameterValues", arglist );
Py_DECREF( arglist );
return res;
}
@ -271,23 +271,24 @@ MODULE *PyModule_to_MODULE(PyObject *obj0);
MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule()
{
PyObject *result, *obj;
result = CallMethod("GetModule",NULL);
if (!result) return NULL;
result = CallMethod( "GetModule", NULL );
if (!result)
return NULL;
obj = PyObject_GetAttrString(result, "this");
if (PyErr_Occurred())
{
/*
PyObject *t, *v, *b;
PyErr_Fetch(&t, &v, &b);
printf ("calling GetModule()\n");
printf ("Exception: %s\n",PyString_AsString(PyObject_Str(v)));
printf (" : %s\n",PyString_AsString(PyObject_Str(b)));
*/
PyErr_Print();
}
obj = PyObject_GetAttrString( result, "this" );
if (PyErr_Occurred())
{
/*
PyObject *t, *v, *b;
PyErr_Fetch(&t, &v, &b);
printf ("calling GetModule()\n");
printf ("Exception: %s\n",PyString_AsString(PyObject_Str(v)));
printf (" : %s\n",PyString_AsString(PyObject_Str(b)));
*/
PyErr_Print();
}
return PyModule_to_MODULE(obj);
}
@ -297,9 +298,9 @@ void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard)
{
PYTHON_FOOTPRINT_WIZARD *fw;
fw = new PYTHON_FOOTPRINT_WIZARD(aPyWizard);
fw = new PYTHON_FOOTPRINT_WIZARD( aPyWizard );
printf("Registered python footprint wizard '%s'\n",
printf( "Registered python footprint wizard '%s'\n",
(const char*)fw->GetName().mb_str()
);
@ -308,7 +309,6 @@ void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard)
fw->register_wizard();
#if 0
/* just to test if it works correctly */
int pages = fw->GetNumParameterPages();
@ -321,9 +321,6 @@ void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard)
}
#endif
}

View File

@ -15,24 +15,24 @@ class PYTHON_FOOTPRINT_WIZARD: public FOOTPRINT_WIZARD
{
PyObject *m_PyWizard;
PyObject *CallMethod(const char *aMethod, PyObject *aArglist=NULL);
wxString CallRetStrMethod(const char *aMethod, PyObject *aArglist=NULL);
wxArrayString CallRetArrayStrMethod(const char *aMethod,
PyObject *aArglist=NULL);
PyObject *CallMethod( const char *aMethod, PyObject *aArglist=NULL );
wxString CallRetStrMethod( const char *aMethod, PyObject *aArglist=NULL );
wxArrayString CallRetArrayStrMethod( const char *aMethod,
PyObject *aArglist=NULL );
public:
PYTHON_FOOTPRINT_WIZARD(PyObject *wizard);
PYTHON_FOOTPRINT_WIZARD( PyObject *wizard );
~PYTHON_FOOTPRINT_WIZARD();
wxString GetName();
wxString GetImage();
wxString GetDescription();
int GetNumParameterPages();
wxString GetParameterPageName(int aPage);
wxArrayString GetParameterNames(int aPage);
wxArrayString GetParameterTypes(int aPage);
wxArrayString GetParameterValues(int aPage);
wxArrayString GetParameterErrors(int aPage);
wxString SetParameterValues(int aPage,wxArrayString& aValues); //< must return "OK" or error description
wxString GetParameterPageName( int aPage );
wxArrayString GetParameterNames( int aPage );
wxArrayString GetParameterTypes( int aPage );
wxArrayString GetParameterValues( int aPage );
wxArrayString GetParameterErrors( int aPage );
wxString SetParameterValues( int aPage, wxArrayString& aValues ); //< must return "OK" or error description
MODULE *GetModule();
};
@ -40,7 +40,7 @@ public:
class PYTHON_FOOTPRINT_WIZARDS
{
public:
static void register_wizard(PyObject *aPyWizard);
static void register_wizard( PyObject *aPyWizard );
};

View File

@ -43,20 +43,22 @@ static PCB_EDIT_FRAME *PcbEditFrame=NULL;
BOARD *GetBoard()
{
if (PcbEditFrame) return PcbEditFrame->GetBoard();
if (PcbEditFrame)
return PcbEditFrame->GetBoard();
else return NULL;
}
void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame)
void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME *aPCBEdaFrame )
{
PcbEditFrame = aPCBEdaFrame;
}
BOARD* LoadBoard(wxString& aFileName)
BOARD* LoadBoard( wxString& aFileName )
{
if (aFileName.EndsWith(wxT(".kicad_brd")))
if ( aFileName.EndsWith( wxT( ".kicad_brd" ) ) )
return LoadBoard(aFileName,IO_MGR::KICAD);
else if (aFileName.EndsWith(wxT(".brd")))
return LoadBoard(aFileName,IO_MGR::LEGACY);
@ -65,19 +67,18 @@ BOARD* LoadBoard(wxString& aFileName)
}
BOARD* LoadBoard(wxString& aFileName,IO_MGR::PCB_FILE_T aFormat)
BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
{
return IO_MGR::Load(aFormat,aFileName);
return IO_MGR::Load( aFormat, aFileName );
}
bool SaveBoard(wxString& aFilename, BOARD* aBoard)
bool SaveBoard( wxString& aFilename, BOARD* aBoard )
{
return SaveBoard(aFilename,aBoard,IO_MGR::KICAD);
return SaveBoard( aFilename, aBoard,IO_MGR::KICAD );
}
bool SaveBoard(wxString& aFileName, BOARD* aBoard,
IO_MGR::PCB_FILE_T aFormat)
bool SaveBoard( wxString& aFileName, BOARD* aBoard,
IO_MGR::PCB_FILE_T aFormat )
{
aBoard->m_Status_Pcb &= ~CONNEXION_OK;
aBoard->SynchronizeNetsAndNetClasses();
@ -86,7 +87,7 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
wxString header;
PROPERTIES props;
if (aFormat==IO_MGR::LEGACY)
if ( aFormat==IO_MGR::LEGACY )
{
header = wxString::Format(
wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s scripting\n\n" ),

View File

@ -7,15 +7,16 @@
* we want plain pcbnew.<method_name> access from python */
#ifndef SWIG
void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame);
void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME *aPCBEdaFrame );
#endif
BOARD *GetBoard();
BOARD* LoadBoard(wxString& aFileName, IO_MGR::PCB_FILE_T aFormat);
BOARD* LoadBoard(wxString& aFileName);
bool SaveBoard(wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat);
bool SaveBoard(wxString& aFileName, BOARD* aBoard);
BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat );
BOARD* LoadBoard( wxString& aFileName );
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat );
bool SaveBoard( wxString& aFileName, BOARD* aBoard );
#endif