diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a46bf3..b26f6f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Explain about wrong dir/output separation (#493) - Diff: - Added option to un/fill zones before doing the comparison (See #391) + - Added a new mode where we can control the added/removed colors (#551) ### Changed - Documentation: diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index e9ab5d70..9cb68218 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -760,12 +760,17 @@ outputs: always_fail_if_missing: false # [string=''] Directory to cache the intermediate files. Leave it blank to disable the cache cache_dir: '' + # [string='#00FF00'] Color used for the added stuff in the '2color' mode + color_added: '#00FF00' + # [string='#FF0000'] Color used for the removed stuff in the '2color' mode + color_removed: '#FF0000' # [boolean=false] Modifies the behavior of `add_link_id` to create a copy of the file instead of a # symlink. Useful for some Windows setups copy_instead_of_link: false - # [string='red_green'] [red_green,stats] In the `red_green` mode added stuff is green and red when removed. + # [string='red_green'] [red_green,stats,2color] In the `red_green` mode added stuff is green and red when removed. # The `stats` mode is used to measure the amount of difference. In this mode all - # changes are red, but you can abort if the difference is bigger than certain threshold + # changes are red, but you can abort if the difference is bigger than certain threshold. + # The '2color' mode is like 'red_green', but you can customize the colors diff_mode: 'red_green' # [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 diff --git a/docs/source/configuration/outputs/diff.rst b/docs/source/configuration/outputs/diff.rst index beb8c445..aa3ba9c0 100644 --- a/docs/source/configuration/outputs/diff.rst +++ b/docs/source/configuration/outputs/diff.rst @@ -44,11 +44,14 @@ Parameters: So if you refer to a repo point where the file wasn't created KiBot will use an empty file. Enabling this option KiBot will report an error. - ``cache_dir`` :index:`: ` [string=''] Directory to cache the intermediate files. Leave it blank to disable the cache. + - ``color_added`` :index:`: ` [string='#00FF00'] Color used for the added stuff in the '2color' mode. + - ``color_removed`` :index:`: ` [string='#FF0000'] Color used for the removed stuff in the '2color' mode. - ``copy_instead_of_link`` :index:`: ` [boolean=false] Modifies the behavior of `add_link_id` to create a copy of the file instead of a symlink. Useful for some Windows setups. - - ``diff_mode`` :index:`: ` [string='red_green'] [red_green,stats] In the `red_green` mode added stuff is green and red when removed. + - ``diff_mode`` :index:`: ` [string='red_green'] [red_green,stats,2color] In the `red_green` mode added stuff is green and red when removed. The `stats` mode is used to measure the amount of difference. In this mode all changes are red, but you can abort if the difference is bigger than certain threshold. + The '2color' mode is like 'red_green', but you can customize the colors. - ``dnf_filter`` :index:`: ` [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. diff --git a/docs/source/dependencies.rst b/docs/source/dependencies.rst index cb6c8b06..16110d7b 100644 --- a/docs/source/dependencies.rst +++ b/docs/source/dependencies.rst @@ -28,7 +28,7 @@ - Optional to separate multiboard projects for general use - Note: Official 1.3.0 release does not work, use my fork if 1.3.0 is the latest -`KiCad PCB/SCH Diff `__ :index:`: ` v2.5.1 |image12| |Auto-download| +`KiCad PCB/SCH Diff `__ :index:`: ` v2.5.3 |image12| |Auto-download| - Mandatory for: `diff`, `kiri` diff --git a/kibot/out_any_diff.py b/kibot/out_any_diff.py index d7695d58..3c106e5f 100644 --- a/kibot/out_any_diff.py +++ b/kibot/out_any_diff.py @@ -21,8 +21,7 @@ def __init__(self): self.zones = 'global' """ [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces - a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. - Be careful with the *keep_generated* option when changing this setting """ + a refill, *unfill* forces a zone removal and *none* lets the zones unchanged """ super().__init__() self._expand_id = 'diff' self._expand_ext = 'pdf' diff --git a/kibot/out_diff.py b/kibot/out_diff.py index df696aa2..9c9521cb 100644 --- a/kibot/out_diff.py +++ b/kibot/out_diff.py @@ -6,7 +6,7 @@ """ Dependencies: - name: KiCad PCB/SCH Diff - version: 2.5.1 + version: 2.5.3 role: mandatory github: INTI-CMNB/KiDiff command: kicad-diff.py @@ -74,9 +74,10 @@ def __init__(self): self.cache_dir = '' """ Directory to cache the intermediate files. Leave it blank to disable the cache """ self.diff_mode = 'red_green' - """ [red_green,stats] In the `red_green` mode added stuff is green and red when removed. + """ [red_green,stats,2color] In the `red_green` mode added stuff is green and red when removed. The `stats` mode is used to measure the amount of difference. In this mode all - changes are red, but you can abort if the difference is bigger than certain threshold """ + changes are red, but you can abort if the difference is bigger than certain threshold. + The '2color' mode is like 'red_green', but you can customize the colors """ self.fuzz = 5 """ [0,100] Color tolerance (fuzzyness) for the `stats` mode """ self.threshold = 0 @@ -108,7 +109,12 @@ def __init__(self): """ Always fail if the old/new file doesn't exist. Currently we don't fail if they are from a repo. So if you refer to a repo point where the file wasn't created KiBot will use an empty file. Enabling this option KiBot will report an error """ + self.color_added = '#00FF00' + """ Color used for the added stuff in the '2color' mode """ + self.color_removed = '#FF0000' + """ Color used for the removed stuff in the '2color' mode """ super().__init__() + self.add_to_doc("zones", "Be careful with the cache when changing this setting") def config(self, parent): super().config(parent) @@ -123,6 +129,7 @@ def config(self, parent): raise KiPlotConfigurationError('`new` must be a single string for `{}` type'.format(self.new_type)) if self.old_type == 'multivar' and self.new_type != 'multivar': raise KiPlotConfigurationError("`old_type` can't be `multivar` when `new_type` isn't (`{}`)".format(self.new_type)) + self.validate_colors(['color_added', 'color_removed']) def get_targets(self, out_dir): return [self._parent.expand_filename(out_dir, self.output)] @@ -457,7 +464,8 @@ def do_compare(self, old, old_type, new, new_type, name, name_ori): # Compute the diff using the cache cmd = [self.command, '--no_reader', '--new_file_hash', new_hash, '--old_file_hash', old_hash, '--cache_dir', self.cache_dir, '--output_dir', dir_name, '--output_name', file_name, - '--diff_mode', self.diff_mode, '--fuzz', str(self.fuzz), '--no_exist_check'] + '--diff_mode', self.diff_mode, '--fuzz', str(self.fuzz), '--no_exist_check', + '--added_2color', self.color_added, '--removed_2color', self.color_removed] self.add_zones_ops(cmd) if self.incl_file: cmd.extend(['--layers', self.incl_file]) diff --git a/kibot/out_kiri.py b/kibot/out_kiri.py index 021b9eb9..98431ecc 100644 --- a/kibot/out_kiri.py +++ b/kibot/out_kiri.py @@ -70,6 +70,7 @@ def __init__(self): self.keep_generated = False """ *Avoid PCB and SCH images regeneration. Useful for incremental usage """ super().__init__() + self.add_to_doc("zones", "Be careful with the *keep_generated* option when changing this setting") self._kiri_mode = True def config(self, parent): diff --git a/src/kibot-check b/src/kibot-check index e93c9fdd..5e8c04ab 100755 --- a/src/kibot-check +++ b/src/kibot-check @@ -651,7 +651,7 @@ deps = '{\ "version": [\ 2,\ 5,\ - 1\ + 3\ ]\ },\ {\