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
351e08c8
Commit
351e08c8
authored
May 10, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Footprint wizard UI gets the module from python wizard, and show it
parent
eff50232
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
5 deletions
+65
-5
dialog_footprint_wizard_list.cpp
pcbnew/dialogs/dialog_footprint_wizard_list.cpp
+1
-1
footprint_wizard_frame.cpp
pcbnew/footprint_wizard_frame.cpp
+12
-0
module.i
pcbnew/scripting/module.i
+19
-0
pcbnew_footprint_wizards.cpp
pcbnew/scripting/pcbnew_footprint_wizards.cpp
+27
-3
pcbnew_footprint_wizards.h
pcbnew/scripting/pcbnew_footprint_wizards.h
+2
-0
fpc_footprint_wizard.py
pcbnew/scripting/plugins/fpc_footprint_wizard.py
+4
-1
No files found.
pcbnew/dialogs/dialog_footprint_wizard_list.cpp
View file @
351e08c8
...
@@ -55,7 +55,7 @@ void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellWizardClick( wxGridEvent& event )
...
@@ -55,7 +55,7 @@ void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellWizardClick( wxGridEvent& event )
{
{
int
click_row
=
event
.
GetRow
();
int
click_row
=
event
.
GetRow
();
m_FootprintWizard
=
FOOTPRINT_WIZARDS
::
GetWizard
(
click_row
);
m_FootprintWizard
=
FOOTPRINT_WIZARDS
::
GetWizard
(
click_row
);
m_footprintWizardsGrid
->
SelectRow
(
event
.
GetRow
(),
false
);
}
}
FOOTPRINT_WIZARD
*
DIALOG_FOOTPRINT_WIZARD_LIST
::
GetWizard
()
FOOTPRINT_WIZARD
*
DIALOG_FOOTPRINT_WIZARD_LIST
::
GetWizard
()
...
...
pcbnew/footprint_wizard_frame.cpp
View file @
351e08c8
...
@@ -399,6 +399,18 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnParameterList( wxCommandEvent& event )
...
@@ -399,6 +399,18 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnParameterList( wxCommandEvent& event )
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
// Delete the current footprint
// Delete the current footprint
GetBoard
()
->
m_Modules
.
DeleteAll
();
GetBoard
()
->
m_Modules
.
DeleteAll
();
MODULE
*
m
=
m_FootprintWizard
->
GetModule
();
if
(
m
)
{
/* Here we should make a copy of the object before adding to board*/
m
->
SetParent
(
GetBoard
());
GetBoard
()
->
m_Modules
.
Append
(
m
);
}
else
{
printf
(
"m_FootprintWizard->GetModule() returns NULL
\n
"
);
}
DisplayWizardInfos
();
DisplayWizardInfos
();
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
...
...
pcbnew/scripting/module.i
View file @
351e08c8
...
@@ -95,3 +95,22 @@ def FootprintIsWritable(lpath):
...
@@ -95,3 +95,22 @@ def FootprintIsWritable(lpath):
}
}
%{
MODULE *PyModule_to_MODULE(PyObject *obj0)
{
void *argp;
int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_MODULE, 0 | 0 );
if (!SWIG_IsOK(res1))
{
SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*");
}
return (MODULE*)argp;
fail:
return NULL;
}
%}
\ No newline at end of file
pcbnew/scripting/pcbnew_footprint_wizards.cpp
View file @
351e08c8
...
@@ -176,8 +176,14 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames(int aPage)
...
@@ -176,8 +176,14 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames(int aPage)
wxArrayString
PYTHON_FOOTPRINT_WIZARD
::
GetParameterValues
(
int
aPage
)
wxArrayString
PYTHON_FOOTPRINT_WIZARD
::
GetParameterValues
(
int
aPage
)
{
{
wxArrayString
a
;
PyObject
*
arglist
;
return
a
;
wxArrayString
ret
;
arglist
=
Py_BuildValue
(
"(i)"
,
aPage
);
ret
=
CallRetArrayStrMethod
(
"GetParameterValues"
,
arglist
);
Py_DECREF
(
arglist
);
return
ret
;
}
}
wxString
PYTHON_FOOTPRINT_WIZARD
::
SetParameterValues
(
int
aPage
,
wxArrayString
&
aValues
)
wxString
PYTHON_FOOTPRINT_WIZARD
::
SetParameterValues
(
int
aPage
,
wxArrayString
&
aValues
)
...
@@ -186,9 +192,27 @@ wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues(int aPage,wxArrayString& aV
...
@@ -186,9 +192,27 @@ wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues(int aPage,wxArrayString& aV
return
ret
;
return
ret
;
}
}
/* this is a SWIG function declaration -from module.i*/
MODULE
*
PyModule_to_MODULE
(
PyObject
*
obj0
);
MODULE
*
PYTHON_FOOTPRINT_WIZARD
::
GetModule
()
MODULE
*
PYTHON_FOOTPRINT_WIZARD
::
GetModule
()
{
{
return
NULL
;
PyObject
*
result
,
*
obj
;
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
)));
}
return
PyModule_to_MODULE
(
obj
);
}
}
...
...
pcbnew/scripting/pcbnew_footprint_wizards.h
View file @
351e08c8
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
#include <vector>
#include <vector>
#include <class_footprint_wizard.h>
#include <class_footprint_wizard.h>
class
PYTHON_FOOTPRINT_WIZARD
:
public
FOOTPRINT_WIZARD
class
PYTHON_FOOTPRINT_WIZARD
:
public
FOOTPRINT_WIZARD
{
{
...
...
pcbnew/scripting/plugins/fpc_footprint_wizard.py
View file @
351e08c8
...
@@ -16,11 +16,13 @@ class FPCFootprintWizard(FootprintWizardPlugin):
...
@@ -16,11 +16,13 @@ class FPCFootprintWizard(FootprintWizardPlugin):
def
smdRectPad
(
self
,
module
,
size
,
pos
,
name
):
def
smdRectPad
(
self
,
module
,
size
,
pos
,
name
):
pad
=
D_PAD
(
module
)
pad
=
D_PAD
(
module
)
# print "smdRectPad( size=",size,"pos=",pos,"name=",name,")"
pad
.
SetSize
(
size
)
pad
.
SetSize
(
size
)
pad
.
SetShape
(
PAD_RECT
)
pad
.
SetShape
(
PAD_RECT
)
pad
.
SetAttribute
(
PAD_SMD
)
pad
.
SetAttribute
(
PAD_SMD
)
pad
.
SetLayerMask
(
PAD_SMD_DEFAULT_LAYERS
)
pad
.
SetLayerMask
(
PAD_SMD_DEFAULT_LAYERS
)
pad
.
SetPos0
(
pos
)
pad
.
SetPos0
(
pos
)
pad
.
SetPosition
(
pos
)
pad
.
SetPadName
(
name
)
pad
.
SetPadName
(
name
)
return
pad
return
pad
...
@@ -43,7 +45,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
...
@@ -43,7 +45,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
module
=
MODULE
(
None
)
module
=
MODULE
(
None
)
module
.
SetReference
(
"FPC"
+
str
(
pads
))
# give it a reference name
module
.
SetReference
(
"FPC"
+
str
(
pads
))
# give it a reference name
module
.
m_Reference
.
SetPos0
(
wxPointMM
(
-
1
,
-
1
))
module
.
m_Reference
.
SetPos0
(
wxPointMM
(
-
1
,
-
1
))
module
.
m_Reference
.
SetPosition
(
wxPointMM
(
-
1
,
-
1
))
# create a pad array and add it to the module
# create a pad array and add it to the module
for
n
in
range
(
0
,
pads
):
for
n
in
range
(
0
,
pads
):
...
@@ -75,6 +77,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
...
@@ -75,6 +77,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
module
.
SetLibRef
(
"FPC"
+
str
(
pads
))
module
.
SetLibRef
(
"FPC"
+
str
(
pads
))
self
.
module
=
module
self
.
module
=
module
# print "Module built and set:", module
# create our footprint wizard
# create our footprint wizard
fpc_wizard
=
FPCFootprintWizard
()
fpc_wizard
=
FPCFootprintWizard
()
...
...
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