diff --git a/kibot/bom/xlsx_writer.py b/kibot/bom/xlsx_writer.py index 4fcdc9d3..1a6289f1 100644 --- a/kibot/bom/xlsx_writer.py +++ b/kibot/bom/xlsx_writer.py @@ -486,10 +486,13 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s set_edas_logger(logger) # Start with a clean list of available distributors init_distributor_dict() + # Filter which APIs we want + for api in cfg.xlsx.kicost_api_disable: + set_api_status(api, False) + for api in cfg.xlsx.kicost_api_enable: + set_api_status(api, True) # ***** DEBUG!!! # Test Digi-Key API - set_api_status('KitSpace', False) - set_api_status('Digi-Key', True) os.environ['DIGIKEY_SAVE_RESULTS'] = '1' os.environ['DIGIKEY_FAKE_RESULTS'] = '1' os.environ['DIGIKEY_STORAGE_PATH'] = op.abspath(op.join(op.dirname(__file__), '../../submodules/KiCost/tests/digikey')) diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 542bc7ab..f6a3ea47 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -163,8 +163,12 @@ class BoMXLSX(BoMLinkable): """ Head style: modern-blue, modern-green, modern-red and classic """ self.kicost = False """ Enable KiCost worksheet creation """ + self.kicost_api_enable = Optionable + """ [string|list(string)=''] List of KiCost APIs to enable """ + self.kicost_api_disable = Optionable + """ [string|list(string)=''] List of KiCost APIs to disable """ self.specs = False - """ Enable Specs worksheet creation """ + """ Enable Specs worksheet creation. Contains specifications for the components. Works with only some KiCost APIs """ self.logo_scale = 2 """ Scaling factor for the logo. Note that this value isn't honored by all spreadsheet software """ @@ -175,6 +179,15 @@ class BoMXLSX(BoMLinkable): self.style = 'modern-blue' if self.style not in VALID_STYLES: raise KiPlotConfigurationError('Unknown style `{}`'.format(self.style)) + # KiCost APIs + if isinstance(self.kicost_api_enable, type): + self.kicost_api_enable = [] + elif isinstance(self.kicost_api_enable, str): + self.kicost_api_enable = [self.kicost_api_enable] + if isinstance(self.kicost_api_disable, type): + self.kicost_api_disable = [] + elif isinstance(self.kicost_api_disable, str): + self.kicost_api_disable = [self.kicost_api_disable] class ComponentAliases(Optionable):