Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
42fad8a7
Commit
42fad8a7
authored
Apr 20, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exceptions handled on board Load/Save
parent
55c0eafd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
pcbnew.i
pcbnew/scripting/pcbnew.i
+5
-0
pcbnew_scripting_helpers.cpp
pcbnew/scripting/pcbnew_scripting_helpers.cpp
+14
-5
kicad.i
scripting/kicad.i
+2
-1
No files found.
pcbnew/scripting/pcbnew.i
View file @
42fad8a7
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
%ignore BOARD_ITEM::ZeroOffset;
%ignore BOARD_ITEM::ZeroOffset;
%ignore D_PAD::m_PadSketchModePenSize;
%ignore D_PAD::m_PadSketchModePenSize;
// rename the Add method of classes to Add native, so we will handle
// the Add method in python
%rename(AddNative) *::Add;
%rename(AddNative) *::Add;
// this is what it must be included in the wrapper .cxx code to compile
// this is what it must be included in the wrapper .cxx code to compile
...
@@ -102,6 +105,8 @@
...
@@ -102,6 +105,8 @@
%include <pcbnew_scripting_helpers.h>
%include <pcbnew_scripting_helpers.h>
#ifdef BUILD_WITH_PLUGIN
#ifdef BUILD_WITH_PLUGIN
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%include <io_mgr.h>
%include <kicad_plugin.h>
%include <kicad_plugin.h>
#endif
#endif
...
...
pcbnew/scripting/pcbnew_scripting_helpers.cpp
View file @
42fad8a7
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
* @brief Scripting helper functions for pcbnew functionality
* @brief Scripting helper functions for pcbnew functionality
*/
*/
#include <Python.h>
#include <pcbnew_scripting_helpers.h>
#include <pcbnew_scripting_helpers.h>
#include <pcbnew.h>
#include <pcbnew.h>
...
@@ -35,6 +36,8 @@
...
@@ -35,6 +36,8 @@
#include <class_board.h>
#include <class_board.h>
#include <kicad_string.h>
#include <kicad_string.h>
#include <io_mgr.h>
#include <io_mgr.h>
#include <macros.h>
#include <stdlib.h>
static
PCB_EDIT_FRAME
*
PcbEditFrame
=
NULL
;
static
PCB_EDIT_FRAME
*
PcbEditFrame
=
NULL
;
...
@@ -56,16 +59,19 @@ BOARD* LoadBoard(wxString& aFileName)
...
@@ -56,16 +59,19 @@ BOARD* LoadBoard(wxString& aFileName)
BOARD
*
LoadBoard
(
wxString
&
aFileName
,
IO_MGR
::
PCB_FILE_T
aFormat
)
BOARD
*
LoadBoard
(
wxString
&
aFileName
,
IO_MGR
::
PCB_FILE_T
aFormat
)
{
{
static
char
ExceptionError
[
256
];
#ifdef USE_NEW_PCBNEW_LOAD
#ifdef USE_NEW_PCBNEW_LOAD
try
{
try
{
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
}
catch
(
IO_ERROR
)
}
catch
(
IO_ERROR
e
)
{
{
sprintf
(
ExceptionError
,
"%s
\n
"
,
TO_UTF8
(
e
.
errorText
)
);
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
return
NULL
;
return
NULL
;
}
}
#else
#else
fprintf
(
stderr
,
"Warning, LoadBoard not implemented without USE_NEW_PCBNEW_LOAD
\n
"
);
fprintf
(
stderr
,
"Warning, LoadBoard not implemented without USE_NEW_PCBNEW_LOAD
\n
"
);
return
NULL
;
return
NULL
;
#endif
#endif
}
}
...
@@ -77,7 +83,7 @@ bool SaveBoard(wxString& aFilename, BOARD* aBoard)
...
@@ -77,7 +83,7 @@ bool SaveBoard(wxString& aFilename, BOARD* aBoard)
bool
SaveBoard
(
wxString
&
aFileName
,
BOARD
*
aBoard
,
bool
SaveBoard
(
wxString
&
aFileName
,
BOARD
*
aBoard
,
IO_MGR
::
PCB_FILE_T
aFormat
)
IO_MGR
::
PCB_FILE_T
aFormat
)
{
{
static
char
ExceptionError
[
256
];
#ifdef USE_NEW_PCBNEW_LOAD
#ifdef USE_NEW_PCBNEW_LOAD
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
SynchronizeNetsAndNetClasses
();
aBoard
->
SynchronizeNetsAndNetClasses
();
...
@@ -101,9 +107,12 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
...
@@ -101,9 +107,12 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
IO_MGR
::
Save
(
aFormat
,
aFileName
,
aBoard
,
&
props
);
IO_MGR
::
Save
(
aFormat
,
aFileName
,
aBoard
,
&
props
);
return
true
;
return
true
;
}
}
catch
(
IO_ERROR
)
catch
(
IO_ERROR
e
)
{
{
return
false
;
sprintf
(
ExceptionError
,
"%s
\n
"
,
TO_UTF8
(
e
.
errorText
)
);
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
return
false
;
}
}
#else
#else
...
...
scripting/kicad.i
View file @
42fad8a7
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
/* exception handling */
/* exception handling */
/* the IO_ERROR exception handler, not working yet... */
/* the IO_ERROR exception handler, not working yet... */
/*
%exception
%exception
{
{
try {
try {
...
@@ -92,7 +93,7 @@
...
@@ -92,7 +93,7 @@
return NULL;
return NULL;
}
}
}
}
*/
%include <dlist.h>
%include <dlist.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment