[SCH_Print] Added color theme and color background options

See #362
This commit is contained in:
Salvador E. Tropea 2023-01-11 20:09:43 -03:00
parent 7fc02734b8
commit 0f5ada05ee
6 changed files with 35 additions and 13 deletions

View File

@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `_only_smd` used to get only SMD parts
- `_only_tht` used to get only THT parts
- `_only_virtual` used to get only virtual parts
- Variants:
- Support for multi-boards as defined by KiKit
- Compress:
- Option to use the output's `dir` as reference (`from_output_dir`)
- iBoM:
@ -32,8 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PCBWay: gerber, drill and compress
- Plot related outputs and PCB_Print:
- Added support for the KiCad 6 "sketch_pads_on_fab_layers" option. (#356)
- Variants:
- Support for multi-boards as defined by KiKit
- *SCH_Print:
- Added options to select the color theme and enable background color. (#362)
- SVG:
- Options to limit the view box to the used area.
### Fixed

View File

@ -3597,9 +3597,11 @@ Notes:
* Valid keys:
- **`frame`**: [boolean=true] Include the frame and title block.
- `all_pages`: [boolean=true] Generate with all hierarchical sheets.
- `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6).
- `color_theme`: [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6).
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- `monochrome`: [boolean=false] Generate a monochromatic PDF.
- `monochrome`: [boolean=false] Generate a monochromatic output.
- `output`: [string='%f-%i%I%v.%x'] Filename for the output PDF (%i=schematic, %x=pdf). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.
@ -4328,9 +4330,11 @@ Notes:
* Valid keys:
- **`frame`**: [boolean=true] Include the frame and title block.
- `all_pages`: [boolean=true] Generate with all hierarchical sheets.
- `background_color`: [boolean=false] Use the background color from the `color_theme` (KiCad 6).
- `color_theme`: [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6).
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- `monochrome`: [boolean=false] Generate a monochromatic PDF.
- `monochrome`: [boolean=false] Generate a monochromatic output.
- `output`: [string='%f-%i%I%v.%x'] Filename for the output SVG (%i=schematic, %x=svg). Affected by global options.
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.

View File

@ -2313,12 +2313,16 @@ outputs:
options:
# [boolean=true] Generate with all hierarchical sheets
all_pages: true
# [boolean=false] Use the background color from the `color_theme` (KiCad 6)
background_color: false
# [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6)
color_theme: '_builtin_default'
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
# A short-cut to use for simple cases where a variant is an overkill
dnf_filter: '_none'
# [boolean=true] Include the frame and title block
frame: true
# [boolean=false] Generate a monochromatic PDF
# [boolean=false] Generate a monochromatic output
monochrome: false
# [string='%f-%i%I%v.%x'] Filename for the output PDF (%i=schematic, %x=pdf). Affected by global options
output: '%f-%i%I%v.%x'
@ -2992,12 +2996,16 @@ outputs:
options:
# [boolean=true] Generate with all hierarchical sheets
all_pages: true
# [boolean=false] Use the background color from the `color_theme` (KiCad 6)
background_color: false
# [string='_builtin_default'] Color theme used, this must exist in the KiCad config (KiCad 6)
color_theme: '_builtin_default'
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
# A short-cut to use for simple cases where a variant is an overkill
dnf_filter: '_none'
# [boolean=true] Include the frame and title block
frame: true
# [boolean=false] Generate a monochromatic PDF
# [boolean=false] Generate a monochromatic output
monochrome: false
# [string='%f-%i%I%v.%x'] Filename for the output SVG (%i=schematic, %x=svg). Affected by global options
output: '%f-%i%I%v.%x'

View File

@ -33,11 +33,15 @@ class Any_SCH_PrintOptions(VariantOptions):
def __init__(self):
with document:
self.monochrome = False
""" Generate a monochromatic PDF """
""" Generate a monochromatic output """
self.frame = True
""" *Include the frame and title block """
self.all_pages = True
""" Generate with all hierarchical sheets """
self.color_theme = ''
""" Color theme used, this must exist in the KiCad config (KiCad 6) """
self.background_color = False
""" Use the background color from the `color_theme` (KiCad 6) """
super().__init__()
self.add_to_doc('variant', "Not fitted components are crossed")
self._expand_id = 'schematic'
@ -66,5 +70,9 @@ class Any_SCH_PrintOptions(VariantOptions):
cmd.append('--no_frame')
if self.all_pages:
cmd.append('--all_pages')
if self.color_theme:
cmd.extend(['--color_theme', self.color_theme])
if self.background_color:
cmd.append('--background_color')
cmd.extend([sch_file, os.path.dirname(name)])
self.exec_with_retry(self.add_extra_options(cmd), self._exit_error)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2022 Salvador E. Tropea
# Copyright (c) 2020-2022 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2023 Salvador E. Tropea
# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
"""
@ -8,7 +8,7 @@ Dependencies:
- from: KiAuto
role: mandatory
command: eeschema_do
version: 2.0.0
version: 2.1.1
"""
from .gs import GS
from .out_any_sch_print import Any_SCH_PrintOptions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2022 Salvador E. Tropea
# Copyright (c) 2020-2022 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020-2023 Salvador E. Tropea
# Copyright (c) 2020-2023 Instituto Nacional de Tecnología Industrial
# Copyright (c) 2020 @nerdyscout
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
@ -9,7 +9,7 @@ Dependencies:
- from: KiAuto
role: mandatory
command: eeschema_do
version: 2.0.0
version: 2.1.1
"""
from .gs import GS
from .out_any_sch_print import Any_SCH_PrintOptions