← Back to team overview

kicad-developers team mailing list archive

Re: pcbnew file import plugins

 

Le 04/03/2016 03:19, Adam Wolf a écrit :
> Regardless of the load times and such, I think an import option vs an open
> option is a very good idea, in terms of UI and user-friendliness, even if
> no other changes are made.

Thanks.
In fact, many users are unaware of import capabilities of Pcbnew (both
for board files and for footprint libraries).
The previous Load board file dialog is not very explicit and shows all
file types only when you already know you can import files.
So I just modified the File menu (in rev 6608) to break the load board
command to load board (only for Kicad board files) and Import board
files (for other board files).
The Import board file is now clearly shown.

There is no actual feature change, and enhancements in plugins (better
warning messages when the wrong plugin type is selected for instance)
are welcome (I am not volunteer to work on that).

> 
> On Thu, Mar 3, 2016 at 7:59 PM, Tiger12506 <tiger12506@xxxxxxxxx> wrote:
> 
>> This email is merely a suggestion.
>>
>> I would personally approach it by having each plugin determine the file's
>> eligibility to be parsed. After all, who can know better than the parser
>> author whether or not a file will be successfully parsed by a plugin? I
>> would NOT suggest having any assumptions made by the calling code -- one
>> email I think hinted that you could read a section of file and then pass in
>> a string to the plugin function -- but NO, because who knows how far to
>> read in to the file but the author of the plugin? Who knows what encoding
>> that file is in? The person in the best position to answer that question is
>> the plugin author.
>>
>> If a plugin writer does not provide an implementation for that function,
>> then the base class can do whatever you want it to do -- make an educated
>> guess, rely entirely on file types, prompt the user, anything you want.
>>
>> I doubt that testing file types is going to be your most computationally
>> intensive task when loading imported files.
>>
>> Perhaps the one true answer (lol) is a mixture of the two. Why not order
>> the plugins to test against based on the file extension? Though file
>> extensions are not the best indicators of a file type, it should narrow it
>> down to a couple plugins. Each could open,read a dozen bytes,close in a
>> milliseconds.


-- 
Jean-Pierre CHARRAS


References