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:
jean-pierre charras 2017-01-04 15:03:43 +01:00
parent 8e11d9b628
commit 02fa9639cd
7 changed files with 49 additions and 24 deletions

View File

@ -2,7 +2,7 @@
* 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) 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
* modify it under the terms of the GNU General Public License
@ -36,7 +36,8 @@
enum FPGeneratorRowNames
{
FP_GEN_ROW_NAME = 0,
FP_GEN_ROW_NUMBER = 0,
FP_GEN_ROW_NAME,
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 );
// 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 description = wizard->GetDescription();
wxString image = wizard->GetImage();
m_footprintGeneratorsGrid->SetCellValue( i, FP_GEN_ROW_NAME, name );
m_footprintGeneratorsGrid->SetCellValue( i, FP_GEN_ROW_DESCR, description );
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NUMBER, num );
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_NAME, name );
m_footprintGeneratorsGrid->SetCellValue( ii, FP_GEN_ROW_DESCR, description );
}

View File

@ -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/
//
// 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 );
// Grid
m_footprintGeneratorsGrid->CreateGrid( 0, 2 );
m_footprintGeneratorsGrid->CreateGrid( 0, 3 );
m_footprintGeneratorsGrid->EnableEditing( false );
m_footprintGeneratorsGrid->EnableGridLines( true );
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->EnableDragColSize( true );
m_footprintGeneratorsGrid->SetColLabelSize( 20 );
m_footprintGeneratorsGrid->SetColLabelValue( 0, _("Name") );
m_footprintGeneratorsGrid->SetColLabelValue( 1, _("Description") );
m_footprintGeneratorsGrid->SetColLabelValue( 0, wxEmptyString );
m_footprintGeneratorsGrid->SetColLabelValue( 1, _("Name") );
m_footprintGeneratorsGrid->SetColLabelValue( 2, _("Description") );
m_footprintGeneratorsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Rows

View File

@ -44,7 +44,7 @@
<property name="minimum_size">400,200</property>
<property name="name">DIALOG_FOOTPRINT_WIZARD_LIST_BASE</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="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Footprint Generators</property>
@ -121,9 +121,9 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="col_label_size">20</property>
<property name="col_label_values">&quot;Name&quot; &quot;Description&quot;</property>
<property name="col_label_values">&quot;&quot; &quot;Name&quot; &quot;Description&quot;</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="context_help"></property>
<property name="context_menu">1</property>

View File

@ -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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -48,7 +48,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
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();
};

View File

@ -387,7 +387,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
if( units == WIZARD_PARAM_UNITS_BOOL )
{
wxGridCellBoolEditor *boolEditor = new wxGridCellBoolEditor;
boolEditor->UseStringValues("True","False");
boolEditor->UseStringValues( "1", "0" );
m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, boolEditor );
m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
}

View File

@ -457,7 +457,7 @@ class FootprintWizardDrawingAids:
The transform matrix is applied
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.SetWidth(self.dc['lineThickness'])

View File

@ -13,6 +13,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# last change: 2017, Jan 4.
import pcbnew
import FootprintWizardBase
@ -22,7 +24,7 @@ import qrcode
class QRCodeWizard(FootprintWizardBase.FootprintWizard):
GetName = lambda self: '2D Barcode QRCode'
GetDescription = lambda self: 'QR Code'
GetDescription = lambda self: 'QR Code barcode generator'
GetReferencePrefix = lambda self: 'QR***'
GetValue = lambda self: self.module.Value().GetText()
@ -56,8 +58,26 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
self.qr.addData(str(self.Barcode))
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):
# 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.SetSize(pcbnew.wxSize(self.X, self.X))
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
@ -66,12 +86,13 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
if self.UseCu:
layerset.AddLayer(pcbnew.F_Cu)
layerset.AddLayer(pcbnew.F_Mask)
pad.SetLayerSet( layerset )
pad.SetPosition(pcbnew.wxPoint(xposition,yposition))
pad.SetPadName("1")
self.module.Add(pad)
if self.UseSilkS:
layerset.AddLayer(pcbnew.F_SilkS)
pad.SetLayerSet( layerset )
pad.SetPosition(pcbnew.wxPoint(xposition,yposition))
pad.SetPadName("1")
self.module.Add(pad)
polygon=self.drawSquareArea(pcbnew.F_SilkS, self.X, xposition, yposition)
self.module.Add(polygon)
def BuildThisFootprint(self):