XLSX BoM: option to control the logo scale (Fixes #84)
This commit is contained in:
parent
40a42513ba
commit
1dea3970bc
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue