[Diff][Added] New mode where we can control the added/removed colors
Also fixed the "zones" options help message, altered while creating a base class Closes #551
This commit is contained in:
parent
58c54a1d71
commit
2ccb54b04e
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:`: <pair: output - diff - options; cache_dir>` [string=''] Directory to cache the intermediate files. Leave it blank to disable the cache.
|
||||
- ``color_added`` :index:`: <pair: output - diff - options; color_added>` [string='#00FF00'] Color used for the added stuff in the '2color' mode.
|
||||
- ``color_removed`` :index:`: <pair: output - diff - options; color_removed>` [string='#FF0000'] Color used for the removed stuff in the '2color' mode.
|
||||
- ``copy_instead_of_link`` :index:`: <pair: output - diff - options; copy_instead_of_link>` [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:`: <pair: output - diff - options; diff_mode>` [string='red_green'] [red_green,stats] In the `red_green` mode added stuff is green and red when removed.
|
||||
- ``diff_mode`` :index:`: <pair: output - diff - options; diff_mode>` [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:`: <pair: output - diff - options; 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <https://github.com/INTI-CMNB/KiDiff>`__ :index:`: <pair: dependency; KiCad PCB/SCH Diff>` v2.5.1 |image12| |Auto-download|
|
||||
`KiCad PCB/SCH Diff <https://github.com/INTI-CMNB/KiDiff>`__ :index:`: <pair: dependency; KiCad PCB/SCH Diff>` v2.5.3 |image12| |Auto-download|
|
||||
|
||||
- Mandatory for: `diff`, `kiri`
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ class AnyDiffOptions(VariantOptions):
|
|||
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'
|
||||
|
|
|
|||
|
|
@ -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 @@ class DiffOptions(AnyDiffOptions):
|
|||
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 @@ class DiffOptions(AnyDiffOptions):
|
|||
""" 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 @@ class DiffOptions(AnyDiffOptions):
|
|||
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 @@ class DiffOptions(AnyDiffOptions):
|
|||
# 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])
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class KiRiOptions(AnyDiffOptions):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ deps = '{\
|
|||
"version": [\
|
||||
2,\
|
||||
5,\
|
||||
1\
|
||||
3\
|
||||
]\
|
||||
},\
|
||||
{\
|
||||
|
|
|
|||
Loading…
Reference in New Issue