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
06c570ba
Commit
06c570ba
authored
Mar 17, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* More cleanup (common wrappers moved to scripting, instead of pcbnew/scripting)
* Added a first test 'testLoadSave.py'
parent
f4223506
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
263 additions
and
7 deletions
+263
-7
CMakeLists.txt
pcbnew/CMakeLists.txt
+6
-3
pcbnew.cpp
pcbnew/pcbnew.cpp
+2
-2
pcbnew.i
pcbnew/scripting/pcbnew.i
+30
-0
pcbnew_scripting_helpers.cpp
pcbnew/scripting/pcbnew_scripting_helpers.cpp
+30
-0
test1.py
pcbnew/scripting/tests/test1.py
+2
-2
testLoadSave.py
pcbnew/scripting/tests/testLoadSave.py
+29
-0
kicad.i
scripting/kicad.i
+79
-0
python_scripting.cpp
scripting/python_scripting.cpp
+28
-0
python_scripting.h
scripting/python_scripting.h
+0
-0
wx.i
scripting/wx.i
+28
-0
wx_python_helpers.cpp
scripting/wx_python_helpers.cpp
+29
-0
wx_python_helpers.h
scripting/wx_python_helpers.h
+0
-0
No files found.
pcbnew/CMakeLists.txt
View file @
06c570ba
add_definitions
(
-DPCBNEW
)
if
(
KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES
)
file
(
MAKE_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/scripting
)
FIND_PACKAGE
(
SWIG REQUIRED
)
INCLUDE
(
${
SWIG_USE_FILE
}
)
...
...
@@ -22,6 +24,7 @@ include_directories(
../polygon
../common/dialogs
./scripting
../scripting
${
INC_AFTER
}
)
...
...
@@ -230,9 +233,9 @@ set(PCBNEW_COMMON_SRCS
if
(
KICAD_SCRIPTING
)
set
(
PCBNEW_SCRIPTING_PYTHON_HELPERS
scripting/wx_python_helpers.cpp
../scripting/wx_python_helpers.cpp
../scripting/python_scripting.cpp
scripting/pcbnew_scripting_helpers.cpp
scripting/python_scripting.cpp
)
set
(
PCBNEW_SCRIPTING_SRCS
...
...
@@ -247,7 +250,7 @@ endif()
if
(
KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES
)
set
(
SWIG_FLAGS -I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../.. -I
${
CMAKE_CURRENT_SOURCE_DIR
}
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../include -DDEBUG
)
set
(
SWIG_FLAGS -I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../.. -I
${
CMAKE_CURRENT_SOURCE_DIR
}
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../include -
I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../scripting -
DDEBUG
)
# collect CFLAGS , and pass them to swig later
...
...
pcbnew/pcbnew.cpp
View file @
06c570ba
...
...
@@ -48,8 +48,8 @@
#include <class_board.h>
#include <dialogs/dialog_scripting.h>
#include <
scripting/
python_scripting.h>
#include <
scripting/
pcbnew_scripting_helpers.h>
#include <python_scripting.h>
#include <pcbnew_scripting_helpers.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS
g_ColorsSettings
;
...
...
pcbnew/scripting/pcbnew.i
View file @
06c570ba
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcbnew.i
* @brief Specific pcbnew wrappers
*/
%module pcbnew
%include "kicad.i"
...
...
pcbnew/scripting/pcbnew_scripting_helpers.cpp
View file @
06c570ba
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcbnew_scripting_helpers.cpp
* @brief Scripting helper functions for pcbnew functionality
*/
#include <pcbnew_scripting_helpers.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
...
...
pcbnew/scripting/tests/test1.py
View file @
06c570ba
pcb
=
pcbnew
.
GetBoard
()
m
=
pcb
.
m_Modules
.
item
()
m
=
pcb
.
m_Modules
while
m
:
print
m
.
GetPosition
()
p
=
m
.
m_Pads
.
item
()
p
=
m
.
m_Pads
while
p
:
print
"p=>"
,
p
.
GetPosition
(),
p
.
GetPadName
()
print
p
.
GetPosition
()
...
...
pcbnew/scripting/tests/testLoadSave.py
0 → 100644
View file @
06c570ba
from
pcbnew
import
*
import
unittest
class
TestLoadSave
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
TITLE
=
"Test Board"
self
.
COMMENT1
=
"For load/save test"
self
.
FILENAME
=
"/tmp/test.brd"
def
test_00_save
(
self
):
pcb
=
BOARD
()
pcb
.
GetTitleBlock
()
.
SetTitle
(
self
.
TITLE
)
pcb
.
GetTitleBlock
()
.
SetComment1
(
self
.
COMMENT1
)
result
=
SaveBoard
(
self
.
FILENAME
,
pcb
)
self
.
assertTrue
(
result
)
def
test_01_load
(
self
):
pcb2
=
LoadBoard
(
self
.
FILENAME
)
self
.
assertIsNotNone
(
pcb2
)
def
test_02_titleblock_ok
(
self
):
pcb2
=
LoadBoard
(
self
.
FILENAME
)
tb
=
pcb2
.
GetTitleBlock
()
self
.
assertEqual
(
tb
.
GetTitle
(),
self
.
TITLE
)
self
.
assertEqual
(
tb
.
GetComment1
(),
self
.
COMMENT1
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
pcbnew/
scripting/kicad.i
→
scripting/kicad.i
View file @
06c570ba
//%module kicad
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file kicad.i
* @brief General wrappers for kicad / wx structures and classes
*/
/* OFF NOW, it triggers an error with GCC 4.6 and swig-2.0.4 or trunk..
http://sourceforge.net/tracker/index.php?func=detail&aid=3391906&group_id=1645&atid=101645
...
...
pcbnew/
scripting/python_scripting.cpp
→
scripting/python_scripting.cpp
View file @
06c570ba
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file python_scripting.cpp
* @brief methods to add scripting capabilities inside pcbnew
*/
#include <python_scripting.h>
...
...
pcbnew/
scripting/python_scripting.h
→
scripting/python_scripting.h
View file @
06c570ba
File moved
pcbnew/
scripting/wx.i
→
scripting/wx.i
View file @
06c570ba
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file wx.i
* @brief wx wrappers for basic things, wxString, wxPoint, wxRect, etc..
*/
%{
#include <wx_python_helpers.h>
...
...
pcbnew/
scripting/wx_python_helpers.cpp
→
scripting/wx_python_helpers.cpp
View file @
06c570ba
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file wx_python_helpers.cpp
* @brief Python wrapping helpers for wx structures/objects
*/
#include <Python.h>
#include <wx/intl.h>
#include <wx/string.h>
...
...
pcbnew/
scripting/wx_python_helpers.h
→
scripting/wx_python_helpers.h
View file @
06c570ba
File moved
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