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
4dc70b2f
Commit
4dc70b2f
authored
May 10, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxGrid instead of list, now we do really have values...
parent
4ead38a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
53 deletions
+81
-53
footprint_wizard.cpp
pcbnew/footprint_wizard.cpp
+2
-1
footprint_wizard_frame.cpp
pcbnew/footprint_wizard_frame.cpp
+63
-39
footprint_wizard_frame.h
pcbnew/footprint_wizard_frame.h
+5
-4
fpc_footprint_wizard.py
pcbnew/scripting/plugins/fpc_footprint_wizard.py
+9
-4
kicadplugins.i
scripting/kicadplugins.i
+2
-5
No files found.
pcbnew/footprint_wizard.cpp
View file @
4dc70b2f
...
...
@@ -27,6 +27,7 @@
void
FOOTPRINT_WIZARD_FRAME
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
{
wxString
msg
;
int
page
;
switch
(
event
.
GetId
()
)
{
...
...
@@ -35,7 +36,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_FOOTPRINT_WIZARD_PREVIOUS
:
int
page
=
m_PageList
->
GetSelection
()
-
1
;
page
=
m_PageList
->
GetSelection
()
-
1
;
if
(
page
<
0
)
page
=
0
;
m_PageList
->
SetSelection
(
page
,
true
);
break
;
...
...
pcbnew/footprint_wizard_frame.cpp
View file @
4dc70b2f
...
...
@@ -42,6 +42,7 @@
#include <pcbnew_id.h>
#include "footprint_wizard_frame.h"
#include <footprint_info.h>
#include <wx/grid.h>
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
...
...
@@ -73,7 +74,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
/* listbox events */
EVT_LISTBOX
(
ID_FOOTPRINT_WIZARD_PAGE_LIST
,
FOOTPRINT_WIZARD_FRAME
::
ClickOnPageList
)
EVT_LISTBOX
(
ID_FOOTPRINT_WIZARD_PARAMETER_LIST
,
FOOTPRINT_WIZARD_FRAME
::
ClickOnParameter
List
)
EVT_LISTBOX
(
ID_FOOTPRINT_WIZARD_PARAMETER_LIST
,
FOOTPRINT_WIZARD_FRAME
::
ClickOnParameter
Grid
)
EVT_MENU
(
ID_SET_RELATIVE_OFFSET
,
FOOTPRINT_WIZARD_FRAME
::
OnSetRelativeOffset
)
END_EVENT_TABLE
()
...
...
@@ -111,15 +112,15 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
// Give an icon
wxIcon
icon
;
icon
.
CopyFromBitmap
(
KiBitmap
(
mod
view_icon_xpm
)
);
icon
.
CopyFromBitmap
(
KiBitmap
(
mod
ule_wizard_xpm
)
);
SetIcon
(
icon
);
m_HotkeysZoomAndGridList
=
g_Module_Viewer_Hokeys_Descr
;
m_FootprintWizard
=
NULL
;
m_PageList
=
NULL
;
m_Parameter
List
=
NULL
;
m_Parameter
Grid
=
NULL
;
m_PageListWindow
=
NULL
;
m_Parameter
List
Window
=
NULL
;
m_Parameter
Grid
Window
=
NULL
;
m_Semaphore
=
semaphore
;
m_wizardName
.
Empty
();
...
...
@@ -160,22 +161,21 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
0
,
NULL
,
wxLB_HSCROLL
);
// Creates the component window display
m_Parameter
List
Size
.
y
=
size
.
y
;
m_Parameter
Grid
Size
.
y
=
size
.
y
;
win_pos
.
x
=
m_PageListSize
.
x
;
m_Parameter
List
Window
=
new
wxSashLayoutWindow
(
this
,
m_Parameter
Grid
Window
=
new
wxSashLayoutWindow
(
this
,
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW
,
win_pos
,
wxDefaultSize
,
wxCLIP_CHILDREN
|
wxSW_3D
,
wxT
(
"ParameterList"
)
);
m_ParameterListWindow
->
SetOrientation
(
wxLAYOUT_VERTICAL
);
m_ParameterListWindow
->
SetSashVisible
(
wxSASH_RIGHT
,
true
);
m_ParameterListWindow
->
SetExtraBorderSize
(
EXTRA_BORDER_SIZE
);
m_ParameterList
=
new
wxListBox
(
m_ParameterListWindow
,
ID_FOOTPRINT_WIZARD_PARAMETER_LIST
,
wxPoint
(
0
,
0
),
wxDefaultSize
,
0
,
NULL
,
wxLB_HSCROLL
);
m_ParameterGridWindow
->
SetOrientation
(
wxLAYOUT_VERTICAL
);
m_ParameterGridWindow
->
SetSashVisible
(
wxSASH_RIGHT
,
true
);
m_ParameterGridWindow
->
SetExtraBorderSize
(
EXTRA_BORDER_SIZE
);
m_ParameterGrid
=
new
wxGrid
(
m_ParameterGridWindow
,
ID_FOOTPRINT_WIZARD_PARAMETER_LIST
,
wxPoint
(
0
,
0
),
wxDefaultSize
);
ReCreatePageList
();
DisplayWizardInfos
();
...
...
@@ -211,8 +211,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
Left
().
Row
(
0
));
// Manage the list of parameters)
m_auimgr
.
AddPane
(
m_Parameter
List
Window
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_Parameter
List
"
)
).
m_auimgr
.
AddPane
(
m_Parameter
Grid
Window
,
wxAuiPaneInfo
(
info
).
Name
(
wxT
(
"m_Parameter
Grid
"
)
).
Left
().
Row
(
1
)
);
// Manage the draw panel
...
...
@@ -231,8 +231,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( wxWindow* parent, wxSemaphore* s
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_PageListWindow
);
pane
.
MinSize
(
wxSize
(
m_PageListSize
.
x
,
-
1
));
}
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_Parameter
List
Window
);
pane
.
MinSize
(
wxSize
(
m_Parameter
List
Size
.
x
,
-
1
));
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_Parameter
Grid
Window
);
pane
.
MinSize
(
wxSize
(
m_Parameter
Grid
Size
.
x
,
-
1
));
m_auimgr
.
Update
();
...
...
@@ -283,7 +283,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event )
return
;
m_PageListSize
.
y
=
GetClientSize
().
y
-
m_MsgFrameHeight
;
m_Parameter
List
Size
.
y
=
m_PageListSize
.
y
;
m_Parameter
Grid
Size
.
y
=
m_PageListSize
.
y
;
switch
(
event
.
GetId
()
)
{
...
...
@@ -299,9 +299,9 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event )
case
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW
:
{
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_Parameter
List
Window
);
m_Parameter
List
Size
.
x
=
event
.
GetDragRect
().
width
;
pane
.
MinSize
(
m_Parameter
List
Size
);
wxAuiPaneInfo
&
pane
=
m_auimgr
.
GetPane
(
m_Parameter
Grid
Window
);
m_Parameter
Grid
Size
.
x
=
event
.
GetDragRect
().
width
;
pane
.
MinSize
(
m_Parameter
Grid
Size
);
m_auimgr
.
Update
();
}
break
;
...
...
@@ -352,7 +352,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
void
FOOTPRINT_WIZARD_FRAME
::
ReCreateParameterList
()
{
if
(
m_Parameter
List
==
NULL
)
if
(
m_Parameter
Grid
==
NULL
)
return
;
if
(
m_FootprintWizard
==
NULL
)
...
...
@@ -363,13 +363,38 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
if
(
page
<
0
)
return
;
m_ParameterList
->
Clear
();
m_ParameterGrid
->
ClearGrid
();
// Columns
m_ParameterGrid
->
AutoSizeColumns
();
m_ParameterGrid
->
SetColLabelSize
(
20
);
m_ParameterGrid
->
SetColLabelValue
(
0
,
_
(
"Parameter"
)
);
m_ParameterGrid
->
SetColLabelValue
(
1
,
_
(
"Value"
)
);
m_ParameterGrid
->
SetColLabelAlignment
(
wxALIGN_LEFT
,
wxALIGN_CENTRE
);
// Rows
m_ParameterGrid
->
AutoSizeRows
();
m_ParameterGrid
->
EnableDragRowSize
(
true
);
m_ParameterGrid
->
SetRowLabelSize
(
1
);
m_ParameterGrid
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
wxArrayString
fpList
=
m_FootprintWizard
->
GetParameterNames
(
page
);
wxArrayString
fvList
=
m_FootprintWizard
->
GetParameterValues
(
page
);
m_ParameterGrid
->
CreateGrid
(
fpList
.
size
(),
2
);
for
(
unsigned
int
i
=
0
;
i
<
fpList
.
size
();
i
++
)
{
m_ParameterGrid
->
SetCellValue
(
i
,
0
,
fpList
[
i
]
);
m_ParameterGrid
->
SetReadOnly
(
i
,
0
);
m_ParameterGrid
->
SetCellValue
(
i
,
1
,
fvList
[
i
]
);
}
m_ParameterGrid
->
AutoSizeColumns
();
m_ParameterList
->
Append
(
fpList
);
m_ParameterList
->
SetSelection
(
0
,
true
);
}
...
...
@@ -387,15 +412,14 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
}
void
FOOTPRINT_WIZARD_FRAME
::
ClickOnParameter
List
(
wxCommandEvent
&
event
)
void
FOOTPRINT_WIZARD_FRAME
::
ClickOnParameter
Grid
(
wxCommandEvent
&
event
)
{
int
ii
=
m_ParameterList
->
GetSelection
();
if
(
ii
<
0
)
return
;
wxString
name
=
m_ParameterList
->
GetString
(
ii
);
int
n
=
m_ParameterGrid
->
GetNumberRows
();
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
// Get values, send them to the object..
}
ReloadFootprint
();
...
...
@@ -418,17 +442,17 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( )
cfg
=
wxGetApp
().
GetSettings
();
m_PageListSize
.
x
=
150
;
// default width of libs list
m_Parameter
ListSize
.
x
=
1
50
;
// default width of component list
m_Parameter
GridSize
.
x
=
2
50
;
// default width of component list
cfg
->
Read
(
PARTLIST_WIDTH_KEY
,
&
m_PageListSize
.
x
);
cfg
->
Read
(
PARAMLIST_WIDTH_KEY
,
&
m_Parameter
List
Size
.
x
);
cfg
->
Read
(
PARAMLIST_WIDTH_KEY
,
&
m_Parameter
Grid
Size
.
x
);
// Set parameters to a reasonable value.
if
(
m_PageListSize
.
x
>
m_FrameSize
.
x
/
2
)
m_PageListSize
.
x
=
m_FrameSize
.
x
/
2
;
if
(
m_Parameter
List
Size
.
x
>
m_FrameSize
.
x
/
2
)
m_Parameter
List
Size
.
x
=
m_FrameSize
.
x
/
2
;
if
(
m_Parameter
Grid
Size
.
x
>
m_FrameSize
.
x
/
2
)
m_Parameter
Grid
Size
.
x
=
m_FrameSize
.
x
/
2
;
}
...
...
@@ -444,7 +468,7 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings()
if
(
m_PageListSize
.
x
)
cfg
->
Write
(
PARTLIST_WIDTH_KEY
,
m_PageListSize
.
x
);
cfg
->
Write
(
PARAMLIST_WIDTH_KEY
,
m_Parameter
List
Size
.
x
);
cfg
->
Write
(
PARAMLIST_WIDTH_KEY
,
m_Parameter
Grid
Size
.
x
);
}
...
...
pcbnew/footprint_wizard_frame.h
View file @
4dc70b2f
...
...
@@ -36,6 +36,7 @@
class
wxSashLayoutWindow
;
class
wxListBox
;
class
wxSemaphore
;
class
wxGrid
;
/**
...
...
@@ -50,9 +51,9 @@ private:
wxSize
m_PageListSize
;
// size of the window
// List of components in the selected library
wxSashLayoutWindow
*
m_Parameter
List
Window
;
wx
ListBox
*
m_ParameterList
;
// The list of parameters
wxSize
m_Parameter
List
Size
;
// size of the window
wxSashLayoutWindow
*
m_Parameter
Grid
Window
;
wx
Grid
*
m_ParameterGrid
;
// The list of parameters
wxSize
m_Parameter
Grid
Size
;
// size of the window
// Flags
wxSemaphore
*
m_Semaphore
;
// != NULL if the frame must emulate a modal dialog
...
...
@@ -103,7 +104,7 @@ private:
void
ReCreateVToolbar
();
void
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
void
ClickOnPageList
(
wxCommandEvent
&
event
);
void
ClickOnParameter
List
(
wxCommandEvent
&
event
);
void
ClickOnParameter
Grid
(
wxCommandEvent
&
event
);
void
OnSetRelativeOffset
(
wxCommandEvent
&
event
);
void
GeneralControl
(
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aHotKey
=
0
);
...
...
pcbnew/scripting/plugins/fpc_footprint_wizard.py
View file @
4dc70b2f
...
...
@@ -17,6 +17,14 @@ class FPCFootprintWizard(FootprintWizardPlugin):
}
def
GetParameterValues
(
self
,
page_n
):
name
=
self
.
GetParameterPageName
(
page_n
)
values
=
self
.
parameters
[
name
]
.
values
()
str_values
=
map
(
lambda
x
:
str
(
x
)
,
values
)
print
values
,
str_values
return
str_values
def
smdRectPad
(
self
,
module
,
size
,
pos
,
name
):
pad
=
D_PAD
(
module
)
# print "smdRectPad( size=",size,"pos=",pos,"name=",name,")"
...
...
@@ -70,10 +78,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
module
.
Add
(
pad_s1
)
e
=
EDGE_MODULE
(
module
)
e
.
SetStart0
(
wxPointMM
(
-
1
,
0
))
e
.
SetStart
(
wxPointMM
(
-
1
,
0
))
e
.
SetEnd0
(
wxPointMM
(
0
,
0
))
e
.
SetEnd
(
wxPointMM
(
0
,
0
))
e
.
SetStartEnd
(
wxPointMM
(
-
1
,
0
),
wxPointMM
(
0
,
0
))
e
.
SetWidth
(
FromMM
(
0.2
))
e
.
SetLayer
(
EDGE_LAYER
)
e
.
SetShape
(
S_SEGMENT
)
...
...
scripting/kicadplugins.i
View file @
4dc70b2f
...
...
@@ -84,14 +84,11 @@ class FootprintWizardPlugin(KiCadPlugin):
def GetParameterNames(self,page_n):
name = self.GetParameterPageName(page_n)
return self.parameters[name].keys()
def GetParameterValues(self,page_n):
name = self.GetParameterPageName(page_n)
return self.parameters[name].keys()
def GetParameterValues(self,page_n):
name = self.GetParameterPageName(page_n)
return self.parameters[name].values()
values = self.parameters[name].values()
return map( lambda x: str(x) , values)
def SetParameterValues(self,page_n,values):
...
...
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