Steffen-W / Import-LIB-KiCad-Plugin

Helps to import KiCad component libraries imported from ultralibrarian and snapeda zipfiles.
GNU General Public License v3.0
78 stars 8 forks source link

Bug fixes for Auto Path Creation (for 2024.08.03) #22

Closed udu3324 closed 3 months ago

udu3324 commented 3 months ago

I made it so the auto KiCad setting tick is saved in the backend to fix showing the wrong value when closing and reopening the GUI. It is also set true in the backend to default automatically creating a path. This shouldn't impact users who have already had their paths set.

I have fixed the naming convention for the symbol lib name path as it appended "_kicad_sym" which it didn't before. image

Sadly, I can't test out the changes as i am having troubles trying to run the generate_zip.sh on wsl.

I also suggest making it more apparent to the user that they need to close all of KiCad out (not just pcb editor) to make the changes to the path save. (red text in the logs, pointers, etc.)

Steffen-W commented 3 months ago

Hi @udu3324,

many thanks for your changes. Regarding the generation, I have tried it once on windows. It didn't work immediately for me either, but it was easy to solve.

sed -i 's/\r$//' generate_zip.sh

Changes the line ending and then ./generate_zip.sh should work normally. I guess you cloned it under windows and only started wsl it afterward.

Before I merge it, can you explain to me briefly what exactly the error was before you created the second commit? I had used the dot as a separator because the file modification of the function was also transferred.

impart_action.py#L128-L135

        libname = os.path.join(DEST_PATH, name + ".lib")
        if os.path.isfile(libname):
            msg += setting.check_symbollib(name + ".lib", add_if_possible)

        libname = os.path.join(DEST_PATH, name + "_kicad_sym.kicad_sym")
        if os.path.isfile(libname):
            libname = name + "_kicad_sym.kicad_sym"
            msg += setting.check_symbollib(libname, add_if_possible)

Admittedly, I am also not satisfied with the code in my place. But I'm trying to switch to the new lib version anyway and then this problem will disappear.

regarding autoLib, do you think the implementation is secure enough to take this as a default setting? I would be happy to join you. Saving the last setting in the background makes sense in any case!

Many thanks for your collaboration

udu3324 commented 3 months ago

Before I merge it, can you explain to me briefly what exactly the error was before you created the second commit? I had used the dot as a separator because the file modification of the function was also transferred.

The second commit removes the "_kicad_sym" in the name of the path entry as it wasn't there before the update. before auto lib feature: image after: (my commit removes the underlined red) image

regarding autoLib, do you think the implementation is secure

I have looked over check_footprintlib and check_symbollib and they look good.

Steffen-W commented 3 months ago

I think I have understood you. The "_kicad_sym" is there for compatibility reasons. Maybe you haven't been using the plugin that long and have never imported the old format. I have also had complaints about this. But I have to manage the conversion from the old to the new format. I'm actively working on that. In any case, the aim is to remove the "_kicad_sym" from both the file name and the naming in the near future.

Steffen-W commented 3 months ago

Hi @udu3324,

I've made a lot of improvements that I'm sure you'll like. I think it would be great if you could try out the plugin on your site before I distribute it via KiCad. tag/2024.08.13

udu3324 commented 3 months ago

@Steffen-W There seems to be a bug with this release. It looks like non-existing paths are not handled correctly. I use a custom path for my imported libs instead of the default path of a users directory. image

Steffen-W commented 3 months ago

I have the suspicion that you have not yet specified the link folder via the button below. The location you selected should actually be used. But of course I have to add a query whether the location exists. I never use the default location myself. Select your folder as the destination and it should work. If the error occurred when starting. Please create the default folder, just so that the plugin runs at all.

Thank you for trying out the plugin so quickly. If you managed to start the plugin. Please check if the easyeda import works for you. Unfortunately, it is not without its dependencies.

udu3324 commented 3 months ago

The error happens before anything could be set yet. image The workaround of creating the default folder works, but i still think the paths should be checked if they are real first before saving it.

I mainly use SnapEDA to source my files but can't find EasyEDA's footprint searcher page to test the import function.

Steffen-W commented 3 months ago

I am now checking the existence of the folder (BUGFIX: ..). Thank you for testing. I have corrected the zip file to import and here to donwnloade (Import-LIB-KiCad-Plugin.zip).

If you could test the plugin again, I would be grateful.