Skip to content

Commit

Permalink
[DOCs][Added] More note/warning boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Oct 16, 2024
1 parent e5c73d8 commit 15ac217
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
8 changes: 6 additions & 2 deletions docs/source/configuration/outputs/DiffOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ DiffOptions parameters
changes in the history you want to go back. A 0 is the same as `HEAD`,
a 1 means the last time the PCB/SCH was changed, etc.
Use `KIBOT_TAG-n` to search for the last tag skipping `n` tags.
Important: when using the `checkout` GitHub action you just get the
last commit. To clone the full repo use `fetch-depth: '0'`.

.. note::
when using the `checkout` GitHub action you just get the
last commit. To clone the full repo use `fetch-depth: '0'`. |br|
..
- ``old_type`` :index:`: <pair: output - diff - options; old_type>` [:ref:`string <string>`] (default: ``'git'``) (choices: "git", "file", "output", "multivar") How to interpret the `old` name. Use `git` for a git hash, branch, etc.
Use `file` for a file name. Use `output` to specify the name of a `pcb_variant`/`sch_variant` output.
Use `multivar` to specify a reference file when `new_type` is also `multivar`.
Expand Down
19 changes: 16 additions & 3 deletions docs/source/configuration/outputs/PCB_PrintOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ PCB_PrintOptions parameters
- ``background_image`` :index:`: <pair: output - pcb_print - options; background_image>` [:ref:`string <string>`] (default: ``''``) Background image, must be an SVG, only when `add_background` is enabled.
- ``blind_via_color`` :index:`: <pair: output - pcb_print - options; blind_via_color>` [:ref:`string <string>`] (default: ``''``) Color used for blind/buried `colored_vias`.
- ``colored_pads`` :index:`: <pair: output - pcb_print - options; colored_pads>` [:ref:`boolean <boolean>`] (default: ``true``) Plot through-hole in a different color. Like KiCad GUI does.
Warning: this usually involves a zones refill.

.. warning::
this usually involves a zones refill.
..
- ``colored_vias`` :index:`: <pair: output - pcb_print - options; colored_vias>` [:ref:`boolean <boolean>`] (default: ``true``) Plot vias in a different color. Like KiCad GUI does.
Warning: this usually involves a zones refill.

.. warning::
this usually involves a zones refill.
..
- ``dnf_filter`` :index:`: <pair: output - pcb_print - options; dnf_filter>` [:ref:`string <string>` | :ref:`list(string) <list(string)>`] (default: ``'_null'``) Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.

Expand All @@ -43,7 +51,12 @@ PCB_PrintOptions parameters
internal: KiBot loads the `.kicad_wks` and does the drawing work.
Best option, but some details are different from what the GUI generates.
plot: uses KiCad Python API. Not available for KiCad 5.
You get the default frame and some substitutions doesn't work.
You get the default frame and some substitutions doesn't work. |br|

.. note::
colors and fonts doesn't work, not supported by the API. Try *gui*, might work.
..
- ``hide_excluded`` :index:`: <pair: output - pcb_print - options; hide_excluded>` [:ref:`boolean <boolean>`] (default: ``false``) Hide components in the Fab layer that are marked as excluded by a variant.
Affected by global options.
- ``individual_page_scaling`` :index:`: <pair: output - pcb_print - options; individual_page_scaling>` [:ref:`boolean <boolean>`] (default: ``true``) Tell KiCad to apply the scaling for each page as a separated entity.
Expand Down
6 changes: 5 additions & 1 deletion docs/source/configuration/outputs/PositionOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ PositionOptions parameters
Only the options that explicitly say the format is supported.
- **only_smd** :index:`: <pair: output - position - options; only_smd>` [:ref:`boolean <boolean>`] (default: ``true``) Only include the surface mount components.
- **output** :index:`: <pair: output - position - options; output>` [:ref:`string <string>`] (default: ``'%f-%i%I%v.%x'``) Output file name (%i='top_pos'|'bottom_pos'|'both_pos', %x='pos'|'csv'|'gbr').
Important: when using separate files you must use `%i` to differentiate them. Affected by global options.

.. note::
when using separate files you must use `%i` to differentiate them. Affected by global options.
..
- **separate_files_for_front_and_back** :index:`: <pair: output - position - options; separate_files_for_front_and_back>` [:ref:`boolean <boolean>`] (default: ``true``) Generate two separated files, one for the top and another for the bottom.
- **units** :index:`: <pair: output - position - options; units>` [:ref:`string <string>`] (default: ``'millimeters'``) (choices: "millimeters", "inches", "mils") Units used for the positions. Affected by global options.
- ``bottom_negative_x`` :index:`: <pair: output - position - options; bottom_negative_x>` [:ref:`boolean <boolean>`] (default: ``false``) Use negative X coordinates for footprints on bottom layer.
Expand Down
8 changes: 6 additions & 2 deletions docs/source/configuration/preflights/PCB_ReplaceOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ PCB_ReplaceOptions parameters
Will return the date in YYYY-MM-DD format. |br|
```date -d @`git log -1 --format='%at' -- "$KIBOT_PCB_NAME"` +%Y-%m-%d_%H-%M-%S``` |br|
Will return the date in YYYY-MM-DD_HH-MM-SS format. |br|
Important: on KiCad 6 the title block data is optional.
This command will work only if you have a date in the PCB/Schematic.

.. note::
on KiCad 6 the title block data is optional. |br|
This command will work only if you have a date in the PCB/Schematic. |br|
..
- ``replace_tags`` :index:`: <pair: preflight - pcb_replace - pcb_replace; replace_tags>` [:ref:`TagReplacePCB parameters <TagReplacePCB>`] [:ref:`dict <dict>` | :ref:`list(dict) <list(dict)>`] (default: ``[]``) Tag or tags to replace.

.. toctree::
Expand Down
8 changes: 6 additions & 2 deletions docs/source/configuration/preflights/SCH_ReplaceOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ SCH_ReplaceOptions parameters
Will return the date in YYYY-MM-DD format. |br|
```date -d @`git log -1 --format='%at' -- "$KIBOT_SCH_NAME"` +%Y-%m-%d_%H-%M-%S``` |br|
Will return the date in YYYY-MM-DD_HH-MM-SS format. |br|
Important: on KiCad 6 the title block data is optional.
This command will work only if you have a date in the SCH/Schematic.

.. note::
on KiCad 6 the title block data is optional. |br|
This command will work only if you have a date in the SCH/Schematic. |br|
..
- ``replace_tags`` :index:`: <pair: preflight - sch_replace - sch_replace; replace_tags>` [:ref:`TagReplaceSCH parameters <TagReplaceSCH>`] [:ref:`dict <dict>` | :ref:`list(dict) <list(dict)>`] (default: ``[]``) Tag or tags to replace.

.. toctree::
Expand Down
24 changes: 23 additions & 1 deletion kibot/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,9 @@ def print_output_options(name, cl, indent, context=None, skip_keys=False, skip_o
preface = preface[:-2] + f' :index:`: <pair: {context}; {k}>` '
if separate_files and isinstance(v, type) and has_dict:
preface += f" [:ref:`{v.__name__} parameters <{v.__name__+id}>`] "
clines = len(lines)
if not rst_mode:
lines = [ln.replace(' |br|', ' ') for ln in lines]
clines = len(lines)
print(preface+adapt_text(lines[0].strip()+('.' if clines == 1 and dot else '')))
if rst_mode:
if skip_keys:
Expand Down Expand Up @@ -936,6 +936,9 @@ def print_output_options(name, cl, indent, context=None, skip_keys=False, skip_o
if in_list:
in_list = False
print()
if (text.startswith('Important: ') or text.startswith('Warning: ')) and ln+1 < clines:
print(adapt_text(ind_help+text+'\n'+('\n'.join(lines[ln+1:]))+'.'))
break
print(ind_help+adapt_text(text+('.' if ln+1 == clines else '')))
num_opts = num_opts+1
if isinstance(v, type):
Expand Down Expand Up @@ -1212,6 +1215,25 @@ def adapt_text(text):
if in_warning:
t.append('.. ')
text = '\n'.join(t)
else:
if 'Warning: ' in text:
t = []
indent = text.index('Warning: ')
t.append('')
t.append('.. warning::')
t.append(text[:indent]+' '+text[indent+9:])
t.append('..')
t.append('')
text = '\n'.join(t)
if 'Important: ' in text:
t = []
indent = text.index('Important: ')
t.append('')
t.append('.. note::')
t.append(text[:indent]+' '+text[indent+11:])
t.append('..')
t.append('')
text = '\n'.join(t)
return adapt_to_rst_urls(text)
text = text.replace('\\*', '*')
return text
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ignore = E402, E226, E126, W504
# docstrings - text style (imperative, dot)
D4
max-line-length = 127
max-complexity = 40
max-complexity = 50
builtins = _
exclude = experiments/kicad/v6/
experiments/JLC/
Expand Down

0 comments on commit 15ac217

Please sign in to comment.