← Back to team overview

kicad-developers team mailing list archive

Re: Project templates (related to the modal dialog thread)


On 25 May 2012 17:00, Brian Sidebotham <brian.sidebotham@xxxxxxxxx> wrote:
> On 22 May 2012 11:26, Brian Sidebotham <brian.sidebotham@xxxxxxxxx> wrote:
>> On 16 May 2012 10:50, Brian Sidebotham <brian.sidebotham@xxxxxxxxx> wrote:
>>> Hi Guys,
>>> I've had a change to put a proposal of the functionality together
>>> which I think covers most stuff. I've attached a txt file incase the
>>> text below doesn't come out very well.
>>> I think the functionality will be great for a lot of users of KiCad.
>>> Let me know if I should convert this to a blueprint on Launchpad.
>>>    Proposal
>>>    --------
>>>    To add new project template functionality to KiCad to facilitate the easy
>>>    setup of projects which have common attributes such as pre-defined board
>>>    outlines, connector posisitions, schematic elements, design rules, etc.
>>>    Definitions
>>>    -----------
>>>    A template is a directory of files, which includes a directory of metadata.
>>>    The template system name (SYSNAME) is the directory name under which the
>>>    template files are stored. The metadata directory (METADIR) contains
>>>    pre-defined files which provide information about the template.
>>>    All files and directories in a template are copied to the new project path
>>>    when a project is created using a template, except METADIR.
>>>    All files and directories which start with SYSNAME will have SYSNAME
>>>    replaced by the new project filename, excluding the file extension.
>>>    Metadata
>>>    --------
>>>    A template's METADIR must contain the required files, and might optionally
>>>    contain any of the optional files
>>>        Required Files
>>>        ~~~~~~~~~~~~~~
>>>        /info.html  - Contains html formatted information about the template
>>>                which is used by the user to determine if the template is what
>>>                they are after. The <title> tag determines the actual name of
>>>                the template that is exposed to the user for template selection.
>>>                Using html to format this document means that images can be
>>>                inlined without having to invent a new scheme.
>>>                Only HTML supported by wxHTML can be used to format this
>>>                document.
>>>        Optional Files
>>>        ~~~~~~~~~~~~~~
>>>        /icon.png   - A 64 x 64px PNG icon file which is used as a clickable
>>>                icon in the template selection dialog.
>>>    Operation
>>>    ---------
>>>    The KiCad File menu will be modified to change New from a menu item to a
>>>    pop-out menu item, in the same manor as Open Recent. There will be two
>>>    options on the pop-out menu:
>>>    Blank -> Will act exactly the same as the current new menu item so
>>> that anyone
>>>    who wishes to create a blank project won't have their settings lost or feel
>>>    alienated.
>>>    From Template -> Will open the template selection dialog.
>>>    The template selection dialog will have a list of icons on the left, and a
>>>    wxHTML window to the right. A single click on a template's icon on the left
>>>    will load that templates info.html metadata file and display it in the
>>>    wxHTML window.
>>>    A double click on a template's icon will start the new project creation and
>>>    will open a new file dialog. If the user selects a valid location for the
>>>    new project, the template will be copied to the new project location
>>>    (excluding METADIR as mentioned earlier) and any files that match the string
>>>    replacement rules will be renamed to reflect the new project's name.
>>>    The list of available templates will be gathered from the following sources:
>>>    wxStandardPaths::GetExecutableDir()/../share/template/
>>>    wxStandardPaths::GetUserDataDir()/templates/
>>>    wxGetEnv(wxT("KICAD_TEMPLATES"))
>> No news is good news! ;-)
>> I'm starting to implement this now.
>> Best Regards, Brian.
> This is now mostly working, I've just got the new template selector
> dialog to finish off. The GUI bits always seem to take a while to
> finish!
> Best Regards, Brian.

Hi Guys,

Just another ping! Code is on-going - sorry the wxWidgets GUI stuff
takes ages to do; Especially as there is essentially a custom tabbed
selection widget. Still, I've learnt a lot about wxWidgets and it's
getting close to completion now.

A preview (with random icons!) can be seen:

I have yet to scrape the html for the project title to print under the
icons (I now don't fancy doing this through wxHtml as their custom tag
handling looks awful!). A simple regex will do the trick easy enough
though. Once that's done and some code tidying is done I'll prep the
patch. Probably another week or so before I can do that.

Best Regards,


Follow ups