Skip to content
Open
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
14 changes: 12 additions & 2 deletions InteractiveHtmlBom/core/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# InteractiveHtmlBom/core/config.py

"""Config object"""

import argparse
Expand Down Expand Up @@ -39,7 +41,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', 'mark_when_checked'
'kicad_text_formatting', 'mark_when_checked', 'rainbow_mode'
]
default_show_group_fields = ["Value", "Footprint"]

Expand All @@ -60,6 +62,7 @@ class Config:
layer_view = layer_view_choices[1]
compression = True
open_browser = True
rainbow_mode = False

# General section
bom_dest_dir = 'bom/' # This is relative to pcb file directory
Expand Down Expand Up @@ -127,6 +130,7 @@ def load_from_ini(self):
self.layer_view = f.Read('layer_view', self.layer_view)
self.compression = f.ReadBool('compression', self.compression)
self.open_browser = f.ReadBool('open_browser', self.open_browser)
self.rainbow_mode = f.ReadBool('rainbow_mode', self.rainbow_mode)

f.SetPath('/general')
self.bom_dest_dir = f.Read('bom_dest_dir', self.bom_dest_dir)
Expand Down Expand Up @@ -187,6 +191,7 @@ def save(self, locally):
f.Write('layer_view', self.layer_view)
f.WriteBool('compression', self.compression)
f.WriteBool('open_browser', self.open_browser)
f.WriteBool('rainbow_mode', self.rainbow_mode)

f.SetPath('/general')
bom_dest_dir = self.bom_dest_dir
Expand Down Expand Up @@ -235,6 +240,7 @@ def set_from_dialog(self, dlg):
dlg.html.layerDefaultView.Selection]
self.compression = dlg.html.compressionCheckbox.IsChecked()
self.open_browser = dlg.html.openBrowserCheckbox.IsChecked()
self.rainbow_mode = dlg.html.rainbowModeCheckbox.IsChecked()

# General
self.bom_dest_dir = dlg.general.bomDirPicker.Path
Expand Down Expand Up @@ -286,6 +292,7 @@ def transfer_to_dialog(self, dlg):
self.layer_view)
dlg.html.compressionCheckbox.Value = self.compression
dlg.html.openBrowserCheckbox.Value = self.open_browser
dlg.html.rainbowModeCheckbox.Value = self.rainbow_mode

# General
import os.path
Expand Down Expand Up @@ -380,6 +387,8 @@ def add_options(cls, parser, version):
action='store_true')
parser.add_argument('--no-browser', help='Do not launch browser.',
action='store_true')
parser.add_argument('--rainbow-mode', help='Enable rainbow mode for component highlighting.',
action='store_true')

# General
parser.add_argument('--dest-dir', default=cls.bom_dest_dir,
Expand Down Expand Up @@ -460,6 +469,7 @@ def set_from_args(self, args):
self.layer_view = args.layer_view
self.compression = not args.no_compression
self.open_browser = not args.no_browser
self.rainbow_mode = args.rainbow_mode

# General
self.bom_dest_dir = args.dest_dir
Expand Down Expand Up @@ -490,4 +500,4 @@ def get_html_config(self):
import json
d = {f: getattr(self, f) for f in self.html_config_fields}
d["fields"] = self.show_fields
return json.dumps(d)
return json.dumps(d)
9 changes: 6 additions & 3 deletions InteractiveHtmlBom/dialog/dialog_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# InteractiveHtmlBom/dialog/dialog_base.py

# -*- coding: utf-8 -*-

###########################################################################
Expand Down Expand Up @@ -181,6 +183,9 @@ def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.
self.openBrowserCheckbox.SetValue(True)
sbSizer10.Add( self.openBrowserCheckbox, 0, wx.ALL, 5 )

self.rainbowModeCheckbox = wx.CheckBox( sbSizer10.GetStaticBox(), wx.ID_ANY, u"Assign each group a unique color", wx.DefaultPosition, wx.DefaultSize, 0 )
sbSizer10.Add( self.rainbowModeCheckbox, 0, wx.ALL, 5 )


b_sizer.Add( sbSizer10, 1, wx.EXPAND|wx.ALL, 5 )

Expand Down Expand Up @@ -573,6 +578,4 @@ def OnFieldsDown( self, event ):


def OnBoardVariantFieldChange( self, event ):
event.Skip()


event.Skip()
Loading