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
b939f3bc
Commit
b939f3bc
authored
Apr 24, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ plugin exceptions correctly handled now
parent
d719282a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
24 deletions
+25
-24
pcbnew.i
pcbnew/scripting/pcbnew.i
+19
-0
pcbnew_scripting_helpers.cpp
pcbnew/scripting/pcbnew_scripting_helpers.cpp
+6
-24
No files found.
pcbnew/scripting/pcbnew.i
View file @
b939f3bc
...
@@ -44,6 +44,25 @@
...
@@ -44,6 +44,25 @@
%rename(AddNative) *::Add;
%rename(AddNative) *::Add;
%exception {
try{
$action
}
catch( IO_ERROR e )
{
char ExceptionError[256];
sprintf(ExceptionError, "%s\n", TO_UTF8(e.errorText) );
PyErr_SetString(PyExc_IOError,ExceptionError);
return NULL;
}
catch( ... )
{
SWIG_fail;
}
}
%include exception.i
// 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
%{
%{
...
...
pcbnew/scripting/pcbnew_scripting_helpers.cpp
View file @
b939f3bc
...
@@ -67,15 +67,7 @@ BOARD* LoadBoard(wxString& aFileName)
...
@@ -67,15 +67,7 @@ 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
];
try
{
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
}
catch
(
IO_ERROR
e
)
{
sprintf
(
ExceptionError
,
"%s
\n
"
,
TO_UTF8
(
e
.
errorText
)
);
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
return
NULL
;
}
}
}
...
@@ -87,7 +79,6 @@ bool SaveBoard(wxString& aFilename, BOARD* aBoard)
...
@@ -87,7 +79,6 @@ 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
];
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
SynchronizeNetsAndNetClasses
();
aBoard
->
SynchronizeNetsAndNetClasses
();
aBoard
->
SetCurrentNetClass
(
aBoard
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
aBoard
->
SetCurrentNetClass
(
aBoard
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
...
@@ -105,18 +96,9 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
...
@@ -105,18 +96,9 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
}
}
try
{
IO_MGR
::
Save
(
aFormat
,
aFileName
,
aBoard
,
&
props
);
IO_MGR
::
Save
(
aFormat
,
aFileName
,
aBoard
,
&
props
);
return
true
;
return
true
;
}
catch
(
IO_ERROR
e
)
{
sprintf
(
ExceptionError
,
"%s
\n
"
,
TO_UTF8
(
e
.
errorText
)
);
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
return
false
;
}
}
}
...
...
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