diff --git a/CHANGELOG.md b/CHANGELOG.md index 226a69ca..b1caa015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - invert_bottom: bottom angles are inverted. - skip_top: top components aren't rotated. - skip_bottom: bottom components aren't rotated. +- XLSX BoM: option to control the logo scale (#84) ## [0.11.0] - 2021-04-25 ### Added diff --git a/kibot/bom/xlsx_writer.py b/kibot/bom/xlsx_writer.py index 07895bcd..dfd58f40 100644 --- a/kibot/bom/xlsx_writer.py +++ b/kibot/bom/xlsx_writer.py @@ -211,14 +211,14 @@ def create_fmt_info(workbook, cfg): return [fmt_name, fmt_data] -def insert_logo(worksheet, image_data): +def insert_logo(worksheet, image_data, scale): """ Inserts the logo, returns how many columns we used """ if image_data: # Note: OpenOffice doesn't support using images in the header for XLSXs # worksheet.set_header('&L&[Picture]', {'image_left': 'logo.png', 'image_data_left': image_data}) options = {'image_data': io.BytesIO(image_data), - 'x_scale': 2, - 'y_scale': 2, + 'x_scale': scale, + 'y_scale': scale, 'object_position': 1, 'decorative': True} worksheet.insert_image('A1', 'logo.png', options) @@ -504,7 +504,7 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s wks = ss.wks # Page head # Logo - col1 = insert_logo(wks, image_data) + col1 = insert_logo(wks, image_data, cfg.xlsx.logo_scale) if col1: col1 += 1 # PCB & Stats Info @@ -640,7 +640,7 @@ def write_xlsx(filename, groups, col_fields, head_names, cfg): # Page head # Logo - col1 = insert_logo(worksheet, image_data) + col1 = insert_logo(worksheet, image_data, cfg.xlsx.logo_scale) # Title if cfg.xlsx.title: worksheet.set_row(0, 32) diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 6ff26a07..792bf0cc 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -163,6 +163,8 @@ class BoMXLSX(BoMLinkable): """ Head style: modern-blue, modern-green, modern-red and classic """ self.kicost = False """ Enable KiCost worksheet creation """ + self.logo_scale = 2 + """ Scaling factor for the logo. Note that this value isn't honored by all spreadsheet software """ def config(self, parent): super().config(parent)