diff --git a/InteractiveHtmlBom/core/config.py b/InteractiveHtmlBom/core/config.py index 5aa593d..2974cbc 100644 --- a/InteractiveHtmlBom/core/config.py +++ b/InteractiveHtmlBom/core/config.py @@ -1,3 +1,5 @@ +# InteractiveHtmlBom/core/config.py + """Config object""" import argparse @@ -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"] @@ -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 @@ -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) @@ -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 @@ -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 @@ -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 @@ -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, @@ -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 @@ -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) \ No newline at end of file diff --git a/InteractiveHtmlBom/dialog/dialog_base.py b/InteractiveHtmlBom/dialog/dialog_base.py index 6b3c5d4..fbff36e 100644 --- a/InteractiveHtmlBom/dialog/dialog_base.py +++ b/InteractiveHtmlBom/dialog/dialog_base.py @@ -1,3 +1,5 @@ +# InteractiveHtmlBom/dialog/dialog_base.py + # -*- coding: utf-8 -*- ########################################################################### @@ -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 ) @@ -573,6 +578,4 @@ def OnFieldsDown( self, event ): def OnBoardVariantFieldChange( self, event ): - event.Skip() - - + event.Skip() \ No newline at end of file diff --git a/InteractiveHtmlBom/web/colors_readme.html b/InteractiveHtmlBom/web/colors_readme.html new file mode 100644 index 0000000..ff9c229 --- /dev/null +++ b/InteractiveHtmlBom/web/colors_readme.html @@ -0,0 +1,367 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
White
+
+
Black
+
+
Brown
+
+
Red
+
+
Orange
+
+
Yellow
+
+
Green
+
+
Blue
+
+
Violet
+
+
Grey
+
+
Indigo
+
+
#FFFFFF
+
+
#000000
+
+
#996633
+
+
#FF0000
+
+
#FF9900
+
+
#FFFF00
+
+
#00FF00
+
+
#0000FF
+
+
#FF00FF
+
+
#CCCCCC
+
+
#4B0082
+
+
0
+
+
.
+
+
1
+
+
2
+
+
3
+
+
4
+
+
5
+
+
6
+
+
7
+
+
8
+
+
9
+
+ +
+
+ + + + + + + + + + + + + + + + + +
41
232
14
+

+

Reading Order:

+
+

Start in either corner, then sequence the values in a clockwise motion until you've got 3 numbers and a decimal.

+
+
+
+

+

Examples

+ + + + + + +
+ 100nF (100.)

+ + + + + + + + + + + + + + + + +
X
X
+
+ + 1: Brown (1)
+ 2: White (0)
+ 3: White (0)
+ 4: Black (.) +
+
+ 0.10uF (0.10) - Rotated 90°

+ + + + + + + + + + + + + + + + +
X
X
+
+ + 1: White (0)
+ 2: Black (.)
+ 3: Brown (1)
+ 4: White (0) +
+
+

+ +

Guide:

+

+
+ +

+
+
  • The other 2 corners will always be transparent, which could be confusing if you aren't familiar with the color + block + syntax. Try it in Dark mode if you're uncertain.
  • + +
  • The key thing to realize about this encoding method is that it isn't math, it's purely syntactical. Meaning, + 100nF + looks different than 0.1uF.
  • +
  • This is intentional. There are a number of reasons you might use one over the other. I wanted the original + formatting to be retained, and the decoding to be toddler proof.
  • +
  • You don't need to know what any of the colors mean to at least tell each unique value apart. And the color + codes are + identical to the standard resistor bands for the numbers 1-8, but I had to steal black to represent the decimal + point so, 0 is white instead and 9 is Indigo.
  • +
    +
    +

    +
    + + + + + + + + \ No newline at end of file diff --git a/InteractiveHtmlBom/web/ibom.css b/InteractiveHtmlBom/web/ibom.css index a601c3f..c3bf499 100644 --- a/InteractiveHtmlBom/web/ibom.css +++ b/InteractiveHtmlBom/web/ibom.css @@ -1,3 +1,5 @@ +/* InteractiveHtmlBom/web/ibom.css */ + :root { --pcb-edge-color: black; --pad-color: #878787; @@ -39,6 +41,11 @@ body { color: #eee; } +.rainbowGroupsEnabled .menu-label-top { + font-size: 0.8rem; +} + + button { background-color: #eee; border: 1px solid #888; @@ -221,11 +228,11 @@ canvas:active { } .bom tr.highlighted:nth-child(n) { - background-color: #cfc; + background-color: #cfc !important; } .dark .bom tr.highlighted:nth-child(n) { - background-color: #226022; + background-color: #226022 !important; } .bom tr:nth-child(even) { diff --git a/InteractiveHtmlBom/web/ibom.html b/InteractiveHtmlBom/web/ibom.html index 69fd777..1f731f0 100644 --- a/InteractiveHtmlBom/web/ibom.html +++ b/InteractiveHtmlBom/web/ibom.html @@ -1,3 +1,5 @@ + + @@ -132,6 +134,18 @@ Continuous redraw on drag + + +