Skip to content

Commit

Permalink
[DOCs][Fixed] We had 3 FileList classes, only one shown
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Oct 18, 2024
1 parent 7947115 commit b4f302b
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 23 deletions.
10 changes: 5 additions & 5 deletions docs/samples/generic_plot.kibot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,11 @@ outputs:
# Not used for the `project` mode
source: '*'
# [string='files'] [files,out_files,output,3d_models,project] From where do we get the files to be copied.
# `files`: files relative to the current working directory.
# `out_files`: files relative to output dir specified with `-d` command line option.
# `output`: files generated by the output specified by `source`.
# `3d_models`: 3D models used in the project.
# `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+)
# - `files`: files relative to the current working directory.
# - `out_files`: files relative to output dir specified with `-d` command line option.
# - `output`: files generated by the output specified by `source`.
# - `3d_models`: 3D models used in the project.
# - `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+)
source_type: 'files'
# [boolean=true] Store the file pointed by symlinks, not the symlink
follow_links: true
Expand Down
4 changes: 2 additions & 2 deletions docs/source/configuration/outputs/CompressOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CompressOptions parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~

- **files** :index:`: <pair: output - compress - options; files>` [:ref:`FilesList parameters <FilesList>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- **files** :index:`: <pair: output - compress - options; files>` [:ref:`FilesListCompress parameters <FilesListCompress>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- **format** :index:`: <pair: output - compress - options; format>` [:ref:`string <string>`] (default: ``'ZIP'``) (choices: "ZIP", "TAR", "RAR") Output file format.
- **output** :index:`: <pair: output - compress - options; output>` [:ref:`string <string>`] (default: ``'%f-%i%I%v.%x'``) Name for the generated archive (%i=name of the output %x=according to format). Affected by global options.
- ``compression`` :index:`: <pair: output - compress - options; compression>` [:ref:`string <string>`] (default: ``'auto'``) (choices: "auto", "stored", "deflated", "bzip2", "lzma") Compression algorithm. Use auto to let KiBot select a suitable one.
Expand All @@ -16,4 +16,4 @@ CompressOptions parameters
.. toctree::
:caption: Used dicts

FilesList
FilesListCompress
4 changes: 2 additions & 2 deletions docs/source/configuration/outputs/Copy_FilesOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Copy_FilesOptions parameters
They are downloaded to a temporal directory and discarded.
If you want to cache the downloaded files specify a directory using the
KIBOT_3D_MODELS environment variable.
- **files** :index:`: <pair: output - copy_files - options; files>` [:ref:`FilesList parameters <FilesList>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- **files** :index:`: <pair: output - copy_files - options; files>` [:ref:`FilesListCopy parameters <FilesListCopy>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- **no_virtual** :index:`: <pair: output - copy_files - options; no_virtual>` [:ref:`boolean <boolean>`] (default: ``false``) Used to exclude 3D models for components with 'virtual' attribute.
- ``dnf_filter`` :index:`: <pair: output - copy_files - 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 @@ -31,4 +31,4 @@ Copy_FilesOptions parameters
.. toctree::
:caption: Used dicts

FilesList
FilesListCopy
18 changes: 18 additions & 0 deletions docs/source/configuration/outputs/FilesListCompress.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _FilesListCompress:


FilesListCompress parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- **from_output** :index:`: <pair: output - compress - options - files; from_output>` [:ref:`string <string>`] (default: ``''``) Collect files from the selected output.
When used the `source` option is ignored.
- **source** :index:`: <pair: output - compress - options - files; source>` [:ref:`string <string>`] (default: ``'*'``) File names to add, wildcards allowed. Use ** for recursive match.
By default this pattern is applied to the output dir specified with `-d` command line option.
See the `from_cwd` and `from_output_dir` options.
- ``dest`` :index:`: <pair: output - compress - options - files; dest>` [:ref:`string <string>`] (default: ``''``) Destination directory inside the archive, empty means the same of the file.
- ``filter`` :index:`: <pair: output - compress - options - files; filter>` [:ref:`string <string>`] (default: ``'.*'``) A regular expression that source files must match.
- ``from_cwd`` :index:`: <pair: output - compress - options - files; from_cwd>` [:ref:`boolean <boolean>`] (default: ``false``) Use the current working directory instead of the dir specified by `-d`.
- ``from_output_dir`` :index:`: <pair: output - compress - options - files; from_output_dir>` [:ref:`boolean <boolean>`] (default: ``false``) Use the current directory specified by the output instead of the dir specified by `-d`.
Note that it only applies when using `from_output` and no `dest` is specified.
It has more prescedence than `from_cwd`.

29 changes: 29 additions & 0 deletions docs/source/configuration/outputs/FilesListCopy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. _FilesListCopy:


FilesListCopy parameters
~~~~~~~~~~~~~~~~~~~~~~~~

- **source** :index:`: <pair: output - copy_files - options - files; source>` [:ref:`string <string>`] (default: ``'*'``) For the `files` and `out_files` mode this is th file names to add,
wildcards allowed. Use ** for recursive match.
For the `output` mode this is the name of the output.
For the `3d_models` is a pattern to match the name of the 3D models extracted from the PCB.
Not used for the `project` mode.
- **source_type** :index:`: <pair: output - copy_files - options - files; source_type>` [:ref:`string <string>`] (default: ``'files'``) (choices: "files", "out_files", "output", "3d_models", "project") From where do we get the files to be copied.

- `files`: files relative to the current working directory.
- `out_files`: files relative to output dir specified with `-d` command line option.
- `output`: files generated by the output specified by `source`.
- `3d_models`: 3D models used in the project.
- `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+).
- ``dest`` :index:`: <pair: output - copy_files - options - files; dest>` [:ref:`string <string>`] (default: ``''``) Destination directory inside the output dir, empty means the same of the file
relative to the source directory.
Note that when you specify a name here files are copied to this destination
without creating subdirs. The `project` mode is an exception.
For the `3d_models` type you can use DIR+ to create subdirs under DIR.
- ``filter`` :index:`: <pair: output - copy_files - options - files; filter>` [:ref:`string <string>`] (default: ``'.*'``) A regular expression that source files must match.
Not used for the `project` mode.
- ``save_pcb`` :index:`: <pair: output - copy_files - options - files; save_pcb>` [:ref:`boolean <boolean>`] (default: ``false``) Only usable for the `3d_models` mode.
Save a PCB copy modified to use the copied 3D models.
You don't need to specify it for `project` mode.

14 changes: 14 additions & 0 deletions docs/source/configuration/outputs/FilesListPDFUnite.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. _FilesListPDFUnite:


FilesListPDFUnite parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- **from_output** :index:`: <pair: output - pdfunite - options - outputs; from_output>` [:ref:`string <string>`] (default: ``''``) Collect files from the selected output.
When used the `source` option is ignored.
- **source** :index:`: <pair: output - pdfunite - options - outputs; source>` [:ref:`string <string>`] (default: ``'*.pdf'``) File names to add, wildcards allowed. Use ** for recursive match.
By default this pattern is applied to the output dir specified with `-d` command line option.
See the `from_cwd` option.
- ``filter`` :index:`: <pair: output - pdfunite - options - outputs; filter>` [:ref:`string <string>`] (default: ``'.*\\.pdf'``) A regular expression that source files must match.
- ``from_cwd`` :index:`: <pair: output - pdfunite - options - outputs; from_cwd>` [:ref:`boolean <boolean>`] (default: ``false``) Use the current working directory instead of the dir specified by `-d`.

4 changes: 2 additions & 2 deletions docs/source/configuration/outputs/PDFUniteOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PDFUniteOptions parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~

- **output** :index:`: <pair: output - pdfunite - options; output>` [:ref:`string <string>`] (default: ``'%f-%i%I%v.%x'``) Name for the generated PDF (%i=name of the output %x=pdf). Affected by global options.
- **outputs** :index:`: <pair: output - pdfunite - options; outputs>` [:ref:`FilesList parameters <FilesList>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- **outputs** :index:`: <pair: output - pdfunite - options; outputs>` [:ref:`FilesListPDFUnite parameters <FilesListPDFUnite>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Which files will be included.
- ``use_external_command`` :index:`: <pair: output - pdfunite - options; use_external_command>` [:ref:`boolean <boolean>`] (default: ``false``) Use the `pdfunite` tool instead of PyPDF2 Python module.

.. toctree::
:caption: Used dicts

FilesList
FilesListPDFUnite
4 changes: 2 additions & 2 deletions kibot/out_compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
logger = log.get_logger()


class FilesList(Optionable):
class FilesListCompress(Optionable):
def __init__(self):
super().__init__()
with document:
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self):
""" *[ZIP,TAR,RAR] Output file format """
self.compression = 'auto'
""" [auto,stored,deflated,bzip2,lzma] Compression algorithm. Use auto to let KiBot select a suitable one """
self.files = FilesList
self.files = FilesListCompress
""" *[list(dict)=[]] Which files will be included """
self.move_files = False
""" Move the files to the archive. In other words: remove the files after adding them to the archive """
Expand Down
16 changes: 8 additions & 8 deletions kibot/out_copy_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def may_be_rel(file):
return file


class FilesList(Optionable):
class FilesListCopy(Optionable):
def __init__(self):
super().__init__()
with document:
Expand All @@ -42,11 +42,11 @@ def __init__(self):
Not used for the `project` mode """
self.source_type = 'files'
""" *[files,out_files,output,3d_models,project] From where do we get the files to be copied.
`files`: files relative to the current working directory.
`out_files`: files relative to output dir specified with `-d` command line option.
`output`: files generated by the output specified by `source`.
`3d_models`: 3D models used in the project.
`project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) """
- `files`: files relative to the current working directory.
- `out_files`: files relative to output dir specified with `-d` command line option.
- `output`: files generated by the output specified by `source`.
- `3d_models`: 3D models used in the project.
- `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) """
self.filter = '.*'
""" A regular expression that source files must match.
Not used for the `project` mode """
Expand Down Expand Up @@ -86,7 +86,7 @@ def __str__(self):
class Copy_FilesOptions(Base3DOptions):
def __init__(self):
with document:
self.files = FilesList
self.files = FilesListCopy
""" *[list(dict)=[]] Which files will be included """
self.follow_links = True
""" Store the file pointed by symlinks, not the symlink """
Expand Down Expand Up @@ -217,7 +217,7 @@ def get_3d_models(self, f, mode_project, dry):
self.filter_pcb_components(do_3D=True, do_2D=True)
# Download missing models and rename all collected 3D models (renamed)
f.rel_dirs = self.rel_dirs
files_list = self.download_models(rename_filter=f.source, rename_function=FilesList.apply_rename, rename_data=f)
files_list = self.download_models(rename_filter=f.source, rename_function=FilesListCopy.apply_rename, rename_data=f)

if f.save_pcb or mode_project:
dest_dir = self.output_dir
Expand Down
4 changes: 2 additions & 2 deletions kibot/out_pdfunite.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logger = log.get_logger()


class FilesList(Optionable):
class FilesListPDFUnite(Optionable):
def __init__(self):
super().__init__()
with document:
Expand All @@ -46,7 +46,7 @@ def __init__(self):
with document:
self.output = GS.def_global_output
""" *Name for the generated PDF (%i=name of the output %x=pdf) """
self.outputs = FilesList
self.outputs = FilesListPDFUnite
""" *[list(dict)=[]] Which files will be included """
self.use_external_command = False
""" Use the `pdfunite` tool instead of PyPDF2 Python module """
Expand Down

0 comments on commit b4f302b

Please sign in to comment.