← Back to team overview

kicad-developers team mailing list archive

Re: pcbnew file import plugins

 

2016-03-02 9:21 GMT+01:00 Simon Wells <swel024@xxxxxxxxx>:
> After looking into and discussing
> https://bugs.launchpad.net/kicad/+bug/1551628 with nick i am not sure
> the filter is the best way of advising kicad of which plugin to use
>
> I was thinking the best way to solve this would be for each of the
> plugins to have a static
>  "bool CanYouHandleThis"
> function (obviously with a better name) and when a file is loaded each
> of the plugins are checked to see if they understand the file,

Yes, I think this is a proper way to do this. After all, it is the
plugin that knows if it can parse the file, so having a
CanYouHandleThis to sanity check the file or whatever it does to say,
"Yay, I can handle this file!", would be a good idea, it could
possibly also be used to do some better error reporting to the user.
Say; the user tries to open an eagle v5 .brd file which is not
supported, it could possibly detect the version type of the file and
import the user that the file he is trying to open is v5 and only v6
is supported for example.

> With each of the responses if they are all no, then a error can be
> reported, and for any that are yes the loading can then be handed off
> to it/them (if dynamic plugins are enabled at some point in the future
> (which you would really need some sort of what can you read interface
> anyway) then you may get to the point where multiple can handle a
> single file)

If multiple plugins can handle a file, how would you handle that
situation seamlessly?

> This would allow the user to not have to set the filter which i am not
> sure many people would think as the problem anyway as far as i am
> aware its not the normal method for setting what type a file is. And
> also move away from blindly trusting extensions

Blindly trusting extensions is indeed problematic as we already have seen :)

> Thanks
>
> Simon
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References