DIALOG_FOOTPRINT_WIZARD_LIST: minor enhancement. qrcode_footprint_wizard.py: use filled polygons instead of square pads on silkscren layer.
This commit is contained in:
parent
8e11d9b628
commit
02fa9639cd
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2014 Miguel Angel Ajo <miguelangel@nbee.es>
|
* Copyright (C) 2012-2014 Miguel Angel Ajo <miguelangel@nbee.es>
|
||||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -36,7 +36,8 @@
|
||||||
|
|
||||||
enum FPGeneratorRowNames
|
enum FPGeneratorRowNames
|
||||||
{
|
{
|
||||||
FP_GEN_ROW_NAME = 0,
|
FP_GEN_ROW_NUMBER = 0,
|
||||||
|
FP_GEN_ROW_NAME,
|
||||||
FP_GEN_ROW_DESCR,
|
FP_GEN_ROW_DESCR,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,15 +62,17 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
||||||
m_footprintGeneratorsGrid->InsertRows( 0, n_wizards, true );
|
m_footprintGeneratorsGrid->InsertRows( 0, n_wizards, true );
|
||||||
|
|
||||||
// Put all wizards in the list
|
// Put all wizards in the list
|
||||||
for( int i=0; i<n_wizards; i++ )
|
for( int ii = 0; ii < n_wizards; ii++ )
|
||||||
{
|
{
|
||||||
FOOTPRINT_WIZARD *wizard = FOOTPRINT_WIZARDS::GetWizard( i );
|
wxString num = wxString::Format( "%d", ii+1 );
|
||||||
|
FOOTPRINT_WIZARD *wizard = FOOTPRINT_WIZARDS::GetWizard( ii );
|
||||||
wxString name = wizard->GetName();
|
wxString name = wizard->GetName();
|
||||||
wxString description = wizard->GetDescription();
|
wxString description = wizard->GetDescription();
|
||||||
wxString image = wizard->GetImage();
|
wxString image = wizard->GetImage();
|
||||||
|
|
||||||
m_footprintGeneratorsGrid->SetCellValue( i, FP_GEN_ROW_NAME, name );
|
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NUMBER, num );
|
||||||
m_footprintGeneratorsGrid->SetCellValue( i, FP_GEN_ROW_DESCR, description );
|
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NAME, name );
|
||||||
|
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_DESCR, description );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
// C++ code generated with wxFormBuilder (version May 6 2016)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -19,7 +19,7 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
||||||
m_footprintGeneratorsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_footprintGeneratorsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
m_footprintGeneratorsGrid->CreateGrid( 0, 2 );
|
m_footprintGeneratorsGrid->CreateGrid( 0, 3 );
|
||||||
m_footprintGeneratorsGrid->EnableEditing( false );
|
m_footprintGeneratorsGrid->EnableEditing( false );
|
||||||
m_footprintGeneratorsGrid->EnableGridLines( true );
|
m_footprintGeneratorsGrid->EnableGridLines( true );
|
||||||
m_footprintGeneratorsGrid->EnableDragGridSize( false );
|
m_footprintGeneratorsGrid->EnableDragGridSize( false );
|
||||||
|
@ -31,8 +31,9 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
||||||
m_footprintGeneratorsGrid->EnableDragColMove( false );
|
m_footprintGeneratorsGrid->EnableDragColMove( false );
|
||||||
m_footprintGeneratorsGrid->EnableDragColSize( true );
|
m_footprintGeneratorsGrid->EnableDragColSize( true );
|
||||||
m_footprintGeneratorsGrid->SetColLabelSize( 20 );
|
m_footprintGeneratorsGrid->SetColLabelSize( 20 );
|
||||||
m_footprintGeneratorsGrid->SetColLabelValue( 0, _("Name") );
|
m_footprintGeneratorsGrid->SetColLabelValue( 0, wxEmptyString );
|
||||||
m_footprintGeneratorsGrid->SetColLabelValue( 1, _("Description") );
|
m_footprintGeneratorsGrid->SetColLabelValue( 1, _("Name") );
|
||||||
|
m_footprintGeneratorsGrid->SetColLabelValue( 2, _("Description") );
|
||||||
m_footprintGeneratorsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
m_footprintGeneratorsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<property name="minimum_size">400,200</property>
|
<property name="minimum_size">400,200</property>
|
||||||
<property name="name">DIALOG_FOOTPRINT_WIZARD_LIST_BASE</property>
|
<property name="name">DIALOG_FOOTPRINT_WIZARD_LIST_BASE</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size">501,273</property>
|
<property name="size">554,286</property>
|
||||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
<property name="title">Footprint Generators</property>
|
<property name="title">Footprint Generators</property>
|
||||||
|
@ -121,9 +121,9 @@
|
||||||
<property name="close_button">1</property>
|
<property name="close_button">1</property>
|
||||||
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
|
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
|
||||||
<property name="col_label_size">20</property>
|
<property name="col_label_size">20</property>
|
||||||
<property name="col_label_values">"Name" "Description"</property>
|
<property name="col_label_values">"" "Name" "Description"</property>
|
||||||
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
|
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
|
||||||
<property name="cols">2</property>
|
<property name="cols">3</property>
|
||||||
<property name="column_sizes">160,325</property>
|
<property name="column_sizes">160,325</property>
|
||||||
<property name="context_help"></property>
|
<property name="context_help"></property>
|
||||||
<property name="context_menu">1</property>
|
<property name="context_menu">1</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
// C++ code generated with wxFormBuilder (version May 6 2016)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -48,7 +48,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Generators"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,273 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Generators"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 554,286 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
~DIALOG_FOOTPRINT_WIZARD_LIST_BASE();
|
~DIALOG_FOOTPRINT_WIZARD_LIST_BASE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -387,7 +387,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
|
||||||
if( units == WIZARD_PARAM_UNITS_BOOL )
|
if( units == WIZARD_PARAM_UNITS_BOOL )
|
||||||
{
|
{
|
||||||
wxGridCellBoolEditor *boolEditor = new wxGridCellBoolEditor;
|
wxGridCellBoolEditor *boolEditor = new wxGridCellBoolEditor;
|
||||||
boolEditor->UseStringValues("True","False");
|
boolEditor->UseStringValues( "1", "0" );
|
||||||
m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, boolEditor );
|
m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, boolEditor );
|
||||||
m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
|
m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,7 +457,7 @@ class FootprintWizardDrawingAids:
|
||||||
The transform matrix is applied
|
The transform matrix is applied
|
||||||
|
|
||||||
Note that this won't work properly if the result is not a
|
Note that this won't work properly if the result is not a
|
||||||
circular arc (eg a horzontal scale)
|
circular arc (eg a horizontal scale)
|
||||||
"""
|
"""
|
||||||
circle = pcbnew.EDGE_MODULE(self.module)
|
circle = pcbnew.EDGE_MODULE(self.module)
|
||||||
circle.SetWidth(self.dc['lineThickness'])
|
circle.SetWidth(self.dc['lineThickness'])
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
# MA 02110-1301, USA.
|
# MA 02110-1301, USA.
|
||||||
|
|
||||||
|
# last change: 2017, Jan 4.
|
||||||
|
|
||||||
import pcbnew
|
import pcbnew
|
||||||
import FootprintWizardBase
|
import FootprintWizardBase
|
||||||
|
|
||||||
|
@ -22,7 +24,7 @@ import qrcode
|
||||||
|
|
||||||
class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
||||||
GetName = lambda self: '2D Barcode QRCode'
|
GetName = lambda self: '2D Barcode QRCode'
|
||||||
GetDescription = lambda self: 'QR Code'
|
GetDescription = lambda self: 'QR Code barcode generator'
|
||||||
GetReferencePrefix = lambda self: 'QR***'
|
GetReferencePrefix = lambda self: 'QR***'
|
||||||
GetValue = lambda self: self.module.Value().GetText()
|
GetValue = lambda self: self.module.Value().GetText()
|
||||||
|
|
||||||
|
@ -56,8 +58,26 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.qr.addData(str(self.Barcode))
|
self.qr.addData(str(self.Barcode))
|
||||||
self.qr.make()
|
self.qr.make()
|
||||||
|
|
||||||
|
def drawSquareArea( self, layer, size, xposition, yposition):
|
||||||
|
# creates a EDGE_MODULE of polygon type
|
||||||
|
polygon = pcbnew.EDGE_MODULE(self.module)
|
||||||
|
polygon.SetShape(pcbnew.S_POLYGON)
|
||||||
|
polygon.SetWidth( 0 )
|
||||||
|
polygon.SetLayer(layer)
|
||||||
|
clist = polygon.GetPolyPoints();
|
||||||
|
halfsize = size/2
|
||||||
|
pos = pcbnew.wxPoint(xposition, yposition)
|
||||||
|
clist.push_back( pcbnew.wxPoint( halfsize, halfsize ) + pos )
|
||||||
|
clist.push_back( pcbnew.wxPoint( halfsize, -halfsize ) + pos )
|
||||||
|
clist.push_back( pcbnew.wxPoint( -halfsize, -halfsize ) + pos )
|
||||||
|
clist.push_back( pcbnew.wxPoint( -halfsize, halfsize ) + pos )
|
||||||
|
polygon.SetPolyPoints(clist)
|
||||||
|
return polygon
|
||||||
|
|
||||||
|
|
||||||
def _drawPixel(self, xposition, yposition):
|
def _drawPixel(self, xposition, yposition):
|
||||||
# build a rectangular pad: as a dot
|
# build a rectangular pad as a dot on copper layer,
|
||||||
|
# and a polygon (a square) on silkscreen
|
||||||
pad = pcbnew.D_PAD(self.module)
|
pad = pcbnew.D_PAD(self.module)
|
||||||
pad.SetSize(pcbnew.wxSize(self.X, self.X))
|
pad.SetSize(pcbnew.wxSize(self.X, self.X))
|
||||||
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
|
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
|
||||||
|
@ -66,12 +86,13 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
||||||
if self.UseCu:
|
if self.UseCu:
|
||||||
layerset.AddLayer(pcbnew.F_Cu)
|
layerset.AddLayer(pcbnew.F_Cu)
|
||||||
layerset.AddLayer(pcbnew.F_Mask)
|
layerset.AddLayer(pcbnew.F_Mask)
|
||||||
|
pad.SetLayerSet( layerset )
|
||||||
|
pad.SetPosition(pcbnew.wxPoint(xposition,yposition))
|
||||||
|
pad.SetPadName("1")
|
||||||
|
self.module.Add(pad)
|
||||||
if self.UseSilkS:
|
if self.UseSilkS:
|
||||||
layerset.AddLayer(pcbnew.F_SilkS)
|
polygon=self.drawSquareArea(pcbnew.F_SilkS, self.X, xposition, yposition)
|
||||||
pad.SetLayerSet( layerset )
|
self.module.Add(polygon)
|
||||||
pad.SetPosition(pcbnew.wxPoint(xposition,yposition))
|
|
||||||
pad.SetPadName("1")
|
|
||||||
self.module.Add(pad)
|
|
||||||
|
|
||||||
|
|
||||||
def BuildThisFootprint(self):
|
def BuildThisFootprint(self):
|
||||||
|
|
Loading…
Reference in New Issue