Skip to content

Commit 84edc64

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 4226c5e + b2249c4 commit 84edc64

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

DATAFORMAT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ attribute.
258258
// 0: justify center
259259
// 1: justify right/bot
260260
"justify": [horizontal, vertical],
261+
// Either the thickness or the fillrule must be used
261262
"thickness": thickness,
263+
"fillrule": "nonzero" | "evenodd",
262264
"attr": [
263265
// may include none, one or both
264266
"italic", "mirrored"

InteractiveHtmlBom/core/config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Config:
3939
'dark_mode', 'show_pads', 'show_fabrication', 'show_silkscreen',
4040
'highlight_pin1', 'redraw_on_drag', 'board_rotation', 'checkboxes',
4141
'bom_view', 'layer_view', 'offset_back_rotation',
42-
'kicad_text_formatting'
42+
'kicad_text_formatting', 'mark_when_checked'
4343
]
4444
default_show_group_fields = ["Value", "Footprint"]
4545

@@ -55,6 +55,7 @@ class Config:
5555
board_rotation = 0
5656
offset_back_rotation = False
5757
checkboxes = ','.join(default_checkboxes)
58+
mark_when_checked = ''
5859
bom_view = bom_view_choices[1]
5960
layer_view = layer_view_choices[1]
6061
compression = True
@@ -121,6 +122,7 @@ def load_from_ini(self):
121122
self.offset_back_rotation = f.ReadBool(
122123
'offset_back_rotation', self.offset_back_rotation)
123124
self.checkboxes = f.Read('checkboxes', self.checkboxes)
125+
self.mark_when_checked = f.Read('mark_when_checked', self.mark_when_checked)
124126
self.bom_view = f.Read('bom_view', self.bom_view)
125127
self.layer_view = f.Read('layer_view', self.layer_view)
126128
self.compression = f.ReadBool('compression', self.compression)
@@ -180,6 +182,7 @@ def save(self, locally):
180182
f.WriteInt('board_rotation', self.board_rotation)
181183
f.WriteBool('offset_back_rotation', self.offset_back_rotation)
182184
f.Write('checkboxes', self.checkboxes)
185+
f.Write('mark_when_checked', self.mark_when_checked)
183186
f.Write('bom_view', self.bom_view)
184187
f.Write('layer_view', self.layer_view)
185188
f.WriteBool('compression', self.compression)
@@ -226,6 +229,7 @@ def set_from_dialog(self, dlg):
226229
self.offset_back_rotation = \
227230
dlg.html.offsetBackRotationCheckbox.IsChecked()
228231
self.checkboxes = dlg.html.bomCheckboxesCtrl.Value
232+
# No dialog for mark_when_checked ...
229233
self.bom_view = self.bom_view_choices[dlg.html.bomDefaultView.Selection]
230234
self.layer_view = self.layer_view_choices[
231235
dlg.html.layerDefaultView.Selection]
@@ -275,6 +279,7 @@ def transfer_to_dialog(self, dlg):
275279
dlg.html.boardRotationSlider.Value = self.board_rotation
276280
dlg.html.offsetBackRotationCheckbox.Value = self.offset_back_rotation
277281
dlg.html.bomCheckboxesCtrl.Value = self.checkboxes
282+
# No dialog for mark_when_checked ...
278283
dlg.html.bomDefaultView.Selection = self.bom_view_choices.index(
279284
self.bom_view)
280285
dlg.html.layerDefaultView.Selection = self.layer_view_choices.index(
@@ -360,6 +365,10 @@ def add_options(cls, parser, version):
360365
parser.add_argument('--checkboxes',
361366
default=cls.checkboxes,
362367
help='Comma separated list of checkbox columns.')
368+
parser.add_argument('--mark-when-checked',
369+
default=cls.mark_when_checked,
370+
help='Name of the checkbox column used to mark '
371+
'components when checked.')
363372
parser.add_argument('--bom-view', default=cls.bom_view,
364373
choices=cls.bom_view_choices,
365374
help='Default BOM view.')
@@ -446,6 +455,7 @@ def set_from_args(self, args):
446455
self.board_rotation = math.fmod(args.board_rotation // 5, 37)
447456
self.offset_back_rotation = args.offset_back_rotation
448457
self.checkboxes = args.checkboxes
458+
self.mark_when_checked = args.mark_when_checked
449459
self.bom_view = args.bom_view
450460
self.layer_view = args.layer_view
451461
self.compression = not args.no_compression

InteractiveHtmlBom/ecad/schema/genericjsonpcbdata_v1.schema

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,20 @@
443443
"properties": {
444444
"svgpath": { "type": "string" },
445445
"thickness": { "type": "number" },
446+
"fillrule": {
447+
"type": "string",
448+
"enum": [
449+
"nonzero",
450+
"evenodd"
451+
]
452+
},
446453
"ref": { "type": "integer" , "const": 1 },
447454
"val": { "type": "integer" , "const": 1 }
448455
},
449-
"required": [
450-
"svgpath",
451-
"thickness"
456+
"required": ["svgpath"],
457+
"oneOf": [
458+
{ "required": ["thickness"] },
459+
{ "required": ["fillrule"] }
452460
],
453461
"title": "DrawingText"
454462
},

InteractiveHtmlBom/web/render.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@ function drawText(ctx, text, color) {
2424
ctx.strokeStyle = color;
2525
ctx.lineCap = "round";
2626
ctx.lineJoin = "round";
27-
ctx.lineWidth = text.thickness;
2827
if ("svgpath" in text) {
29-
ctx.stroke(new Path2D(text.svgpath));
30-
ctx.restore();
31-
return;
28+
if ("thickness" in text) {
29+
ctx.lineWidth = text.thickness;
30+
ctx.stroke(new Path2D(text.svgpath));
31+
ctx.restore();
32+
return;
33+
}
34+
if ("fillrule" in text) {
35+
ctx.fill(new Path2D(text.svgpath), text.fillrule);
36+
ctx.restore();
37+
return;
38+
}
3239
}
3340
if ("polygons" in text) {
3441
ctx.fill(getPolygonsPath(text));

InteractiveHtmlBom/web/util.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ function initDefaults() {
549549
setHighlightPin1(highlightpin1);
550550
document.forms.highlightpin1.highlightpin1.value = highlightpin1;
551551

552-
settings.markWhenChecked = readStorage("markWhenChecked") || "";
552+
settings.markWhenChecked = readStorage("markWhenChecked");
553+
if (settings.markWhenChecked == null) {
554+
settings.markWhenChecked = config.mark_when_checked;
555+
}
553556
populateMarkWhenCheckedOptions();
554557

555558
function initBooleanSetting(storageString, def, elementId, func) {

0 commit comments

Comments
 (0)