Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion InteractiveHtmlBom/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Config:
'dark_mode', 'show_pads', 'show_fabrication', 'show_silkscreen',
'highlight_pin1', 'redraw_on_drag', 'board_rotation', 'checkboxes',
'bom_view', 'layer_view', 'offset_back_rotation',
'kicad_text_formatting'
'kicad_text_formatting', 'mark_when_checked'
]
default_show_group_fields = ["Value", "Footprint"]

Expand All @@ -55,6 +55,7 @@ class Config:
board_rotation = 0
offset_back_rotation = False
checkboxes = ','.join(default_checkboxes)
mark_when_checked = ''
bom_view = bom_view_choices[1]
layer_view = layer_view_choices[1]
compression = True
Expand Down Expand Up @@ -121,6 +122,7 @@ def load_from_ini(self):
self.offset_back_rotation = f.ReadBool(
'offset_back_rotation', self.offset_back_rotation)
self.checkboxes = f.Read('checkboxes', self.checkboxes)
self.mark_when_checked = f.Read('mark_when_checked', self.mark_when_checked)
self.bom_view = f.Read('bom_view', self.bom_view)
self.layer_view = f.Read('layer_view', self.layer_view)
self.compression = f.ReadBool('compression', self.compression)
Expand Down Expand Up @@ -180,6 +182,7 @@ def save(self, locally):
f.WriteInt('board_rotation', self.board_rotation)
f.WriteBool('offset_back_rotation', self.offset_back_rotation)
f.Write('checkboxes', self.checkboxes)
f.Write('mark_when_checked', self.mark_when_checked)
f.Write('bom_view', self.bom_view)
f.Write('layer_view', self.layer_view)
f.WriteBool('compression', self.compression)
Expand Down Expand Up @@ -226,6 +229,7 @@ def set_from_dialog(self, dlg):
self.offset_back_rotation = \
dlg.html.offsetBackRotationCheckbox.IsChecked()
self.checkboxes = dlg.html.bomCheckboxesCtrl.Value
# No dialog for mark_when_checked ...
self.bom_view = self.bom_view_choices[dlg.html.bomDefaultView.Selection]
self.layer_view = self.layer_view_choices[
dlg.html.layerDefaultView.Selection]
Expand Down Expand Up @@ -275,6 +279,7 @@ def transfer_to_dialog(self, dlg):
dlg.html.boardRotationSlider.Value = self.board_rotation
dlg.html.offsetBackRotationCheckbox.Value = self.offset_back_rotation
dlg.html.bomCheckboxesCtrl.Value = self.checkboxes
# No dialog for mark_when_checked ...
dlg.html.bomDefaultView.Selection = self.bom_view_choices.index(
self.bom_view)
dlg.html.layerDefaultView.Selection = self.layer_view_choices.index(
Expand Down Expand Up @@ -360,6 +365,10 @@ def add_options(cls, parser, version):
parser.add_argument('--checkboxes',
default=cls.checkboxes,
help='Comma separated list of checkbox columns.')
parser.add_argument('--mark-when-checked',
default=cls.mark_when_checked,
help='Name of the checkbox column used to mark '
'components when checked.')
parser.add_argument('--bom-view', default=cls.bom_view,
choices=cls.bom_view_choices,
help='Default BOM view.')
Expand Down Expand Up @@ -446,6 +455,7 @@ def set_from_args(self, args):
self.board_rotation = math.fmod(args.board_rotation // 5, 37)
self.offset_back_rotation = args.offset_back_rotation
self.checkboxes = args.checkboxes
self.mark_when_checked = args.mark_when_checked
self.bom_view = args.bom_view
self.layer_view = args.layer_view
self.compression = not args.no_compression
Expand Down
5 changes: 4 additions & 1 deletion InteractiveHtmlBom/web/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,10 @@ function initDefaults() {
setHighlightPin1(highlightpin1);
document.forms.highlightpin1.highlightpin1.value = highlightpin1;

settings.markWhenChecked = readStorage("markWhenChecked") || "";
settings.markWhenChecked = readStorage("markWhenChecked");
if (settings.markWhenChecked == null) {
settings.markWhenChecked = config.mark_when_checked;
}
populateMarkWhenCheckedOptions();

function initBooleanSetting(storageString, def, elementId, func) {
Expand Down