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
6728f0a8
Commit
6728f0a8
authored
Oct 18, 2014
by
unknown
Committed by
jean-pierre charras
Oct 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scripts/test_kicad_plugin.py cleanup
parent
f23bb59c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
test_kicad_plugin.py
scripts/test_kicad_plugin.py
+14
-20
No files found.
scripts/test_kicad_plugin.py
View file @
6728f0a8
...
...
@@ -13,32 +13,27 @@
# 3) Entered following command line, script takes no arguments
# $ PYTHONPATH=. <path_to>/test_kicad_plugin.py
from
pcbnew
import
IO_MGR
,
BOARD
,
MODULE
,
FPID
,
UTF8
from
os
import
rename
as
mv
from
__future__
import
print_function
from
pcbnew
import
*
import
sys
import
os
lib_path1
=
'f:/tmp/lib1.pretty'
lib_path2
=
'f:/tmp/lib2.pretty'
tmp_path
=
'/tmp'
lib_path1
=
"
%
s/lib1.pretty"
%
tmp_path
lib_path2
=
"
%
s/lib2.pretty"
%
tmp_path
plugin
=
IO_MGR
.
PluginFind
(
IO_MGR
.
KICAD
)
# Expecting "KiCad":
print
(
"Plugin Type
"
,
plugin
.
PluginName
()
)
print
(
"Plugin Type
:
%
s"
%
plugin
.
PluginName
()
)
try
:
plugin
.
FootprintLibDelete
(
lib_path1
)
except
:
None
# ignore, new may not exist if first run
pass
# ignore, new may not exist if first run
try
:
plugin
.
FootprintLibDelete
(
lib_path2
)
except
:
None
# ignore, new may not exist if first run
pass
# ignore, new may not exist if first run
plugin
.
FootprintLibCreate
(
lib_path1
)
...
...
@@ -46,13 +41,12 @@ plugin.FootprintLibCreate( lib_path1 )
# for a FootprintLibCreate()
plugin
.
FootprintLibCreate
(
lib_path2
)
board
=
BOARD
()
# The only way to construct a MODULE is to pass it a BOARD? Yep.
module
=
MODULE
(
board
)
fpid
=
FPID
(
'mine'
)
fpid
=
FPID
(
'mine'
)
module
.
SetFPID
(
fpid
)
...
...
@@ -65,27 +59,27 @@ plugin.FootprintSave( lib_path1, module )
# create a disparity between the library's name ("footprint"),
# and the module's internal useless name ("mine"). Module is officially named "footprint" now
# but has (module mine ...) internally:
os
.
rename
(
'f:/tmp/lib2.pretty/mine.kicad_mod'
,
'f:/tmp/lib2.pretty/footprint.kicad_mod'
)
mv
(
"
%
s/mine.kicad_mod"
%
lib_path2
,
"
%
s/footprint.kicad_mod"
%
lib_path2
)
footprint
=
plugin
.
FootprintLoad
(
lib_path2
,
'footprint'
)
footprint
=
plugin
.
FootprintLoad
(
lib_path2
,
'footprint'
)
fpid
=
footprint
.
GetFPID
()
fpid
.
SetLibNickname
(
UTF8
(
'mylib'
)
)
name
=
fpid
.
Format
()
.
GetChars
()
# Always after a FootprintLoad() the internal name should match the one used to load it.
print
(
"
internal name should be 'footprint':"
,
name
)
print
(
"
Internal name should be 'footprint': '
%
s'"
%
name
)
# Verify that the same plugin instance can edge trigger on a lib_path change
# for FootprintLoad()
footprint
=
plugin
.
FootprintLoad
(
lib_path1
,
'mine'
)
footprint
=
plugin
.
FootprintLoad
(
lib_path1
,
'mine'
)
fpid
=
footprint
.
GetFPID
()
fpid
.
SetLibNickname
(
UTF8
(
'other_mylib'
)
)
name
=
fpid
.
Format
()
.
GetChars
()
# Always after a FootprintLoad() the internal name should match the one used to load it.
print
(
"
internal name should be 'mine':"
,
name
)
print
(
"
Internal name should be 'mine': '
%
s'"
%
name
)
# As of 3-Dec-2013 this test is passed by KICAD_PLUGIN and Wayne is owed an atta boy!
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