Cosmetic fixes, before moving to wxGrid
This commit is contained in:
parent
351e08c8a9
commit
4ead38a83d
|
@ -31,11 +31,13 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
case ID_FOOTPRINT_WIZARD_NEXT:
|
case ID_FOOTPRINT_WIZARD_NEXT:
|
||||||
//SelectAndViewFootprint( NEXT_PART );
|
m_PageList->SetSelection(m_PageList->GetSelection()+1,true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_FOOTPRINT_WIZARD_PREVIOUS:
|
case ID_FOOTPRINT_WIZARD_PREVIOUS:
|
||||||
//SelectAndViewFootprint( PREVIOUS_PART );
|
int page = m_PageList->GetSelection()-1;
|
||||||
|
if (page<0) page=0;
|
||||||
|
m_PageList->SetSelection(page,true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -76,10 +78,30 @@ void FOOTPRINT_WIZARD_FRAME::DisplayWizardInfos()
|
||||||
SetTitle( msg );
|
SetTitle( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
|
||||||
|
{
|
||||||
|
SetCurItem( NULL );
|
||||||
|
// Delete the current footprint
|
||||||
|
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((EDA_ITEM*)GetBoard());
|
||||||
|
GetBoard()->m_Modules.Append(m);
|
||||||
|
wxPoint p(0,0);
|
||||||
|
m->SetPosition(p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("m_FootprintWizard->GetModule() returns NULL\n");
|
||||||
|
}
|
||||||
|
m_canvas->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
|
void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
|
||||||
{
|
{
|
||||||
DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard =
|
DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard =
|
||||||
new DIALOG_FOOTPRINT_WIZARD_LIST(this);
|
new DIALOG_FOOTPRINT_WIZARD_LIST(this);
|
||||||
|
|
||||||
selectWizard->ShowModal();
|
selectWizard->ShowModal();
|
||||||
|
@ -92,6 +114,8 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
|
||||||
m_wizardDescription = m_FootprintWizard->GetDescription();
|
m_wizardDescription = m_FootprintWizard->GetDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReloadFootprint();
|
||||||
|
Zoom_Automatique(false);
|
||||||
DisplayWizardInfos();
|
DisplayWizardInfos();
|
||||||
ReCreatePageList();
|
ReCreatePageList();
|
||||||
ReCreateParameterList();
|
ReCreateParameterList();
|
||||||
|
|
|
@ -396,24 +396,11 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnParameterList( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString name = m_ParameterList->GetString( ii );
|
wxString name = m_ParameterList->GetString( ii );
|
||||||
|
|
||||||
SetCurItem( NULL );
|
|
||||||
// Delete the current footprint
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
ReloadFootprint();
|
||||||
DisplayWizardInfos();
|
DisplayWizardInfos();
|
||||||
Zoom_Automatique( false );
|
|
||||||
m_canvas->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ private:
|
||||||
void ReCreatePageList();
|
void ReCreatePageList();
|
||||||
void ReCreateParameterList();
|
void ReCreateParameterList();
|
||||||
void SelectFootprintWizard();
|
void SelectFootprintWizard();
|
||||||
|
void ReloadFootprint();
|
||||||
|
|
||||||
|
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
|
|
|
@ -94,3 +94,19 @@
|
||||||
return self.ShowShape(self.GetShape())
|
return self.ShowShape(self.GetShape())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%extend BOARD_ITEM
|
||||||
|
{
|
||||||
|
%pythoncode
|
||||||
|
{
|
||||||
|
def SetPos(self,p):
|
||||||
|
self.SetPosition(p)
|
||||||
|
self.SetPos0(p)
|
||||||
|
|
||||||
|
def SetStartEnd(self,start,end):
|
||||||
|
self.SetStart(start)
|
||||||
|
self.SetStart0(start)
|
||||||
|
self.SetEnd(end)
|
||||||
|
self.SetEnd0(end)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@ for name in lst:
|
||||||
m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name)
|
m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name)
|
||||||
print name,"->",m.GetLibRef(), m.GetReference()
|
print name,"->",m.GetLibRef(), m.GetReference()
|
||||||
for p in m.GetPads():
|
for p in m.GetPads():
|
||||||
print "\t",p.GetPadName(),p.GetPosition(), p.GetOffset()
|
print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset()
|
||||||
|
|
|
@ -9,57 +9,61 @@ class FPCFootprintWizard(FootprintWizardPlugin):
|
||||||
self.description = "FPC Footprint Wizard"
|
self.description = "FPC Footprint Wizard"
|
||||||
self.parameters = {
|
self.parameters = {
|
||||||
"Pads":
|
"Pads":
|
||||||
{"n":40,"pitch":0.5,"width":0.25,"height":1.6},
|
{"n":40,"pitch":FromMM(0.5),
|
||||||
|
"width":FromMM(0.25),"height":FromMM(1.6)},
|
||||||
"Shield":
|
"Shield":
|
||||||
{"shield_to_pad":1.6,"from_top":1.3,"width":1.5,"height":2}
|
{"shield_to_pad":FromMM(1.6),"from_top":FromMM(1.3),
|
||||||
|
"width":FromMM(1.5),"height":FromMM(2)},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,")"
|
# 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.SetPosition(pos)
|
||||||
pad.SetPadName(name)
|
pad.SetPadName(name)
|
||||||
return pad
|
return pad
|
||||||
|
|
||||||
def BuildFootprint(self):
|
def BuildFootprint(self):
|
||||||
|
|
||||||
pads = self.parameters["Pads"]["n"]
|
p = self.parameters
|
||||||
pad_width = self.parameters["Pads"]["width"]
|
pads = p["Pads"]["n"]
|
||||||
pad_height = self.parameters["Pads"]["height"]
|
pad_width = p["Pads"]["width"]
|
||||||
pad_pitch = self.parameters["Pads"]["pitch"]
|
pad_height = p["Pads"]["height"]
|
||||||
shl_width = self.parameters["Shield"]["width"]
|
pad_pitch = p["Pads"]["pitch"]
|
||||||
shl_height = self.parameters["Shield"]["height"]
|
shl_width = p["Shield"]["width"]
|
||||||
shl_to_pad = self.parameters["Shield"]["shield_to_pad"]
|
shl_height = p["Shield"]["height"]
|
||||||
shl_from_top = self.parameters["Shield"]["from_top"]
|
shl_to_pad = p["Shield"]["shield_to_pad"]
|
||||||
|
shl_from_top = p["Shield"]["from_top"]
|
||||||
|
|
||||||
size_pad = wxSizeMM(pad_width,pad_height)
|
size_pad = wxSize(pad_width,pad_height)
|
||||||
size_shld = wxSizeMM(shl_width,shl_height)
|
size_shld = wxSize(shl_width,shl_height)
|
||||||
|
|
||||||
|
|
||||||
# create a new module, it's parent is our previously created pcb
|
# create a new module
|
||||||
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,-2))
|
||||||
module.m_Reference.SetPosition(wxPointMM(-1,-1))
|
module.m_Reference.SetPosition(wxPointMM(-1,-2))
|
||||||
|
|
||||||
# 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):
|
||||||
pad = self.smdRectPad(module,size_pad,wxPointMM(pad_pitch*n,0),str(n+1))
|
pad = self.smdRectPad(module,size_pad,wxPoint(pad_pitch*n,0),str(n+1))
|
||||||
module.Add(pad)
|
module.Add(pad)
|
||||||
|
|
||||||
|
|
||||||
pad_s0 = self.smdRectPad(module,
|
pad_s0 = self.smdRectPad(module,
|
||||||
size_shld,
|
size_shld,
|
||||||
wxPointMM(-shl_to_pad,shl_from_top),
|
wxPoint(-shl_to_pad,shl_from_top),
|
||||||
"0")
|
"0")
|
||||||
pad_s1 = self.smdRectPad(module,
|
pad_s1 = self.smdRectPad(module,
|
||||||
size_shld,
|
size_shld,
|
||||||
wxPointMM((pads-1)*pad_pitch+shl_to_pad,shl_from_top),
|
wxPoint((pads-1)*pad_pitch+shl_to_pad,shl_from_top),
|
||||||
"0")
|
"0")
|
||||||
|
|
||||||
module.Add(pad_s0)
|
module.Add(pad_s0)
|
||||||
|
@ -67,7 +71,9 @@ class FPCFootprintWizard(FootprintWizardPlugin):
|
||||||
|
|
||||||
e = EDGE_MODULE(module)
|
e = EDGE_MODULE(module)
|
||||||
e.SetStart0(wxPointMM(-1,0))
|
e.SetStart0(wxPointMM(-1,0))
|
||||||
|
e.SetStart(wxPointMM(-1,0))
|
||||||
e.SetEnd0(wxPointMM(0,0))
|
e.SetEnd0(wxPointMM(0,0))
|
||||||
|
e.SetEnd(wxPointMM(0,0))
|
||||||
e.SetWidth(FromMM(0.2))
|
e.SetWidth(FromMM(0.2))
|
||||||
e.SetLayer(EDGE_LAYER)
|
e.SetLayer(EDGE_LAYER)
|
||||||
e.SetShape(S_SEGMENT)
|
e.SetShape(S_SEGMENT)
|
||||||
|
@ -77,7 +83,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
|
# print "Module built and set:", module
|
||||||
|
|
||||||
# create our footprint wizard
|
# create our footprint wizard
|
||||||
fpc_wizard = FPCFootprintWizard()
|
fpc_wizard = FPCFootprintWizard()
|
||||||
|
|
Loading…
Reference in New Issue