leoheck / kiri

Kiri is a visual tool designed for reviewing schematics and layouts of KiCad projects that are version-controlled with Git.
MIT License
476 stars 32 forks source link

Fix filenames of artifacts #79

Closed MarcelRobitaille closed 1 year ago

MarcelRobitaille commented 1 year ago

kicad-cli exports sheets as <project-name>-<sheet-title>.svg. The frontend expects <sheet-filename>.svg.

This pull request uses the sch_pages file to rename the former into the latter.

For example, if I have a project called Blinky and a sheet with the filename led_drivers.kicad_sch but the name LED Drivers, kicad-cli will save this to Blinky-LED Drivers.svg instead of led_drivers.svg.

I think this is what you tried to do with:

for kicad_sch in \"${SVG1_DIR_PATH}\"/*; do
    rename "s/${proj_name_1}-//g" "${kicad_sch}"
done

but that only works if the title matches the filename.

For me these often do not match. I like to keep my filenames in snake case and my titles with capitalization and spaces.

leoheck commented 1 year ago

I like this way better indeed. But something made me not use the file name. I can remember why. I want to test this a bit before merging it.

leoheck commented 1 year ago

Could you try to add something for me here in this PR? When you hover the mouse over the pages on the front end, it would be good to have the file_path which is the second column of the sch_pages. Then we are going to have a second piece of information with the tooltip.

MarcelRobitaille commented 1 year ago

But something made me not use the file name. I can remember why.

One consequence of using the file name is that if you use the same hierarchical sheet in multiple places, it will only show up once. This could cause unnecessary diffs too since the reference designators will change between instances.

I only renamed the svgs to match the file name because that's what the frontend is requesting according to the 404s in the network tab of dev tools.

I am not sure how this tooltip information gets to the frontend or how to change it. Could you give me a hint?

leoheck commented 1 year ago

I am not sure how this tooltip information gets to the frontend or how to change it. Could you give me a hint?

When using Kicad 5 only, the tooltips are the file path but for Kicad 6/7 they are just the filename.

I have these 2 repos if you want to compare the result.

There is this insert_pages_html (page 160) function that creates those tooltips.

I thought this would be a related issue, but since it is not something generated here, let's address this in a new PR, later.

MarcelRobitaille commented 1 year ago

I thought this would be a related issue, but since it is not something generated here, let's address this in a new PR, later.

Ok, sounds good

MarcelRobitaille commented 1 year ago

@leoheck if that tooltip is being addressed in a future PR, do you think this can be merged?

leoheck commented 1 year ago

I fixed the tooltip, it is already in the master/main (whatever the stupid name is now). I did not merge this because I am not sure it works everywhere and because sometimes it puts messages on my screen. So I am not sure it is working fine yet.

MarcelRobitaille commented 1 year ago

Which kind of messages does it put and can I help to test it more thoroughly?

leoheck commented 1 year ago

You have to test on other repositories.

-- Leandro Heck

On Wed, Apr 5, 2023 at 6:13 PM Marcel Robitaille @.***> wrote:

Which kind of messages does it put and can I help to test it more thoroughly?

— Reply to this email directly, view it on GitHub https://github.com/leoheck/kiri/pull/79#issuecomment-1498168975, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJX7YG3QLOLX63VM4YD7OTW7XOBPANCNFSM6AAAAAAWN23ANA . You are receiving this because you were mentioned.Message ID: @.***>

leoheck commented 1 year ago

Hey, I am closing this PR. your work was merged externally. Could you check using the main branch if it is still working for you? It looks good to me tho.

MarcelRobitaille commented 1 year ago

Seems to be working for me. Thank you!

leoheck commented 1 year ago

Thank you for the donation. Today is my birthday and it was a nice coincidence.

MarcelRobitaille commented 1 year ago

What a nice coincidence. I'm glad I put it off so long then