[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert to pdf #341

Open
wants to merge 114 commits into
base: master
Choose a base branch
from
Open

convert to pdf #341

wants to merge 114 commits into from

Conversation

erzoe
Copy link
Contributor
@erzoe erzoe commented Sep 9, 2021
  • Added a new attribute to signals: lsb, the startbit which is displayed in Vector CANdb++ (and is different from start, the value which is saved in the dbc file), see commit dd7137a
  • Extended the convert command so that it can also convert to tex and pdf files, see python3 -m cantools convert --help | less

erzoe added 30 commits June 4, 2021 15:19
needing to duplicate all braces makes the code unreadable
in case somebody wants a special formatting of table headers
bugfix for commit 67086a5
The last column was not recognized because the end of line (\\) was not stripped.
Therefore it got the default alignment l.
Empty cells make it more difficult to stay on the same line.
You can configure the symbol to be used with the --none arg.
Curly braces as protection for the S column are added automatically.
I have added the extra space by inserting an empty column.
That is not exactly elegant but it works.
I have tried inserting a @\qquad instead but that screws up
the alignment with S columns.
added some code which can be used to manually highlight important rows.
If you want to do this, change the \iffalse to \iftrue.
Add an asterisk in front of each row that you want to highlight.
the command id is numbering enough
this sets the horizontal borders to around 2.6cm

This causes the warning "Package typearea Warning: Bad type area settings!"
but I think that's ok, because this document does not contain text, only tables.
Therefore the usual concerns about how long a line may be do not apply here.
bugfix for commit c47222e
not sure how often is needed for ltablex.

First the documentation says "the document should be run through latex twice."
but more prominently it states: "The document needs to be latexed a couple times in general."
which sounds like twice might not be enough. I think with three times I should be safe.
this seems like a good opportunity to test the --landscape option
because the min and max values of Message64big take up so much space
that they don't fit on one DINA4 paper portrait.
tabular needs less lines than xltabular
because it does not support line breaks
and therefore has no specification for
table head and foot inside of a table.
apt
===
texlive-latex-base
- pdflatex
- hyperref
- fancyhdr
- url
- tabularx

texlive-latex-recommended
- booktabs
- parskip
- typearea (koma-script)

texlive-latex-extra
- lastpage
- xltabular
- ltablex

texlive-science
- siunitx

pacman
======

texlive-bin (not listed explicitly because this is a dependency of texlive-core, so it should be installed automatically)
- pdflatex

texlive-core
- parskip
- booktabs
- fancyhdr
- typearea
- hyperref
- url
- tabularx

texlive-latexextra
- lastpage
- xltabular
- ltablex

texlive-science
- siunitx
This reverts commit 660a879.
Has been fixed in commit 9cf95f1.
This reverts commit d901bd0.
Has been fixed in commit 9cf95f1.
This reverts commit c91b641.
Has been fixed in commit 9cf95f1.
@coveralls
Copy link
coveralls commented Sep 9, 2021

Coverage Status

Coverage increased (+0.2%) to 96.669% when pulling 3806f3e on erzoe:dev-convert-to-pdf into f8fd300 on eerimoq:master.

@erzoe
Copy link
Contributor Author
erzoe commented Sep 10, 2021

I don't know why appveyor failed. Is there any way to display what has gone wrong?

@andlaus
Copy link
Member
andlaus commented Sep 12, 2021

I don't know why appveyor failed. Is there any way to display what has gone wrong?

click on the "Details" link on the pull-request's status box here, then on the run of interest on appveyor, e.g. "Environment: PYTHON=C:\Python38-x64, PYTHON_ARCH=64". the console output of the failed run should be displayed. For the aforementioned run, the first relevant bit is probably:

[...]
Test the send method with scaling. ... ok
test_set_and_get_signals (tests.test_tester.CanToolsTesterTest)
Set and get signals. ... ok
======================================================================
FAIL: test_break_signal_name_anywhere (tests.test_convert.CanToolsConvertFullTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\cantools\tests\test_convert.py", line 1221, in test_break_signal_name_anywhere
    self.assert_file_content_equal(expected_content, fn_out)
  File "c:\projects\cantools\tests\test_convert.py", line 57, in assert_file_content_equal
    self.assertEqual(content_expected, content_is)
AssertionError: Lists differ: ['% ![882 chars]itle{Long Names Multiple Relations}', '\\date{[6513 chars]nt}'] != ['% ![882 chars]itle{Textbackslash long Names Multiple Relatio[6477 chars]nt}']
First differing element 39:
'\\title{Long Names Multiple Relations}'
'\\title{Textbackslash long Names Multiple Relations}'
  ['% !TeX program = pdflatex',
   '\\documentclass[a4paper, a5paper]{article}',
[...]

BTW: while I like the ability to generate a big PDF of the signals database of a bus in principle, this PR would benefit from some serious cleanup/squashing work before reviewing it. Also, be aware that merging it will probably have to until we split the current monolithic cantools module into several more specialized ones (e.g., cantools-core, cantools-monitor, cantools-plot, etc) because I'm too skittish to introduce a new dependency on pdflatex even if it is supposed to be optional (the appveyor test failures prove this point ;)).

bugfix for commit f3246e4

The output of the tests is written to a tmp directory
therefore the definition of \outfile changes with every test
and does not match the golden master.
Therefore I am changing the definition of \outfile
before comparing it to the golden master.
Before this commit I accomplished that with os.path.split.
That works on Linux but not on Windows.

On windows path.sep is "\", a character which is inserted by texify, e.g. "_" -> "\_".
Therefore os.path.split strips too much on Windows.
forgotten in commit d493dc8
this is a continuation of commit fa5561d

however, instead of adjusting the tests to make them pass
I think it actually makes more sense to change the behavior
of the system under test in this case.
@erzoe
Copy link
Contributor Author
erzoe commented Sep 15, 2021

@andlaus thank you for your help.

click on the "Details" link on the pull-request's status box here, then on the run of interest on appveyor, e.g. "Environment: PYTHON=C:\Python38-x64, PYTHON_ARCH=64". the console output of the failed run should be displayed.

Yes, now I see it. Weird, I thought I had done just that and nothing happened when I clicked on the job ^^"

this PR would benefit from some serious cleanup/squashing work before reviewing it

Yes, I will try to find the time to make a rebase.

Also, be aware that merging it will probably have to until we split the current monolithic cantools module into several more specialized ones (e.g., cantools-core, cantools-monitor, cantools-plot, etc) because I'm too skittish to introduce a new dependency on pdflatex even if it is supposed to be optional

Yes, it was supposed to be optional, I wouldn't have wanted a hard dependency on LaTeX either.
Sounds like a good idea to split it up. Do you have a rough plan how long that will take?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants