Footprint editor: fix bug in footprint wizard 2D barcode generator.

The text height and thickness settings were never implemented so they
didn't get updated when the options were changed.  Added the missing
code to update both parameters.

Added text width parameter so text height and width do not need to be
the same value.  Currently both the value and reference fields are set
to the same height and width.  Please feel free to change this if you
feel the need to have separate text settings for both the value and
reference fields.

Fixes lp:1751309

https://bugs.launchpad.net/kicad/+bug/1751309
This commit is contained in:
Wayne Stambaugh 2018-03-15 10:37:36 -04:00
parent c6ef0d57f1
commit 89d350a7d2
1 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
self.AddParam("Barcode", "Use Cu layer", self.uBool, True) self.AddParam("Barcode", "Use Cu layer", self.uBool, True)
self.AddParam("Caption", "Enabled", self.uBool, True) self.AddParam("Caption", "Enabled", self.uBool, True)
self.AddParam("Caption", "Height", self.uMM, 1.2) self.AddParam("Caption", "Height", self.uMM, 1.2)
self.AddParam("Caption", "Width", self.uMM, 1.2)
self.AddParam("Caption", "Thickness", self.uMM, 0.12) self.AddParam("Caption", "Thickness", self.uMM, 0.12)
@ -48,7 +49,9 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
self.UseCu = self.parameters['Barcode']['Use Cu layer'] self.UseCu = self.parameters['Barcode']['Use Cu layer']
self.border = int(self.parameters['Barcode']['Border']) self.border = int(self.parameters['Barcode']['Border'])
self.textHeight = int(self.parameters['Caption']['Height']) self.textHeight = int(self.parameters['Caption']['Height'])
self.module.Value().SetText(str(self.Barcode) ) self.textThickness = int(self.parameters['Caption']['Thickness'])
self.textWidth = int(self.parameters['Caption']['Width'])
self.module.Value().SetText(str(self.Barcode))
# Build Qrcode # Build Qrcode
self.qr = qrcode.QRCode() self.qr = qrcode.QRCode()
@ -133,7 +136,13 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
#int((5 + half_number_of_elements) * self.X)) #int((5 + half_number_of_elements) * self.X))
textPosition = int((self.textHeight) + ((1 + half_number_of_elements) * self.X)) textPosition = int((self.textHeight) + ((1 + half_number_of_elements) * self.X))
self.module.Value().SetPosition(pcbnew.wxPoint(0, - textPosition)) self.module.Value().SetPosition(pcbnew.wxPoint(0, - textPosition))
self.module.Value().SetTextHeight(self.textHeight)
self.module.Value().SetTextWidth(self.textWidth)
self.module.Value().SetThickness(self.textThickness)
self.module.Reference().SetPosition(pcbnew.wxPoint(0, textPosition)) self.module.Reference().SetPosition(pcbnew.wxPoint(0, textPosition))
self.module.Reference().SetTextHeight(self.textHeight)
self.module.Reference().SetTextWidth(self.textWidth)
self.module.Reference().SetThickness(self.textThickness)
self.module.Value().SetLayer(pcbnew.F_SilkS) self.module.Value().SetLayer(pcbnew.F_SilkS)
QRCodeWizard().register() QRCodeWizard().register()