← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH 4/4 (master)] Make help message of BOM dialog translatable.

 

On 9/25/2018 3:36 PM, seth@xxxxxxxxxxxxx wrote:
> Hi Konstantin-
> 
> First, sorry for getting your given name incorrect in my previous message!
> 
> Next, while I think that this patch is generally correct, I don't think
> we should have this help dialog here anymore.  The information it
> provides is out of date and doesn't relate directly to the dialog box. 
> The detailed descriptions of XSLT and the intermediate format belong in
> the user manual.  The only thing that we should be adding here for help
> is how to use the dialog to generate a BOM.
> 
> Also, the link to the answer doesn't go to a useful page anymore.  I
> think we should remove this help dialog all together.

I agree which is why I didn't move forward with his original patch.
Ideally, the help button would open the documentation to the correct
section and translation but given that our documentation tends to be out
of date, I'm not sure how useful this would be.

> 
> -Seth
> 
> BTW, Patches 1 and 3 look good and I'll push them shortly.
> 
> On 2018-09-25 07:17, Baranovskiy Konstantin wrote:
>> For more details see:
>> https://lists.launchpad.net/kicad-developers/msg36544.html
>> ---
>>  eeschema/CMakeLists.txt               |  17 --
>>  eeschema/dialogs/dialog_bom.cpp       | 214 ++++++++++++++++++-
>>  eeschema/dialogs/dialog_bom_help.html | 286 --------------------------
>>  3 files changed, 208 insertions(+), 309 deletions(-)
>>  delete mode 100644 eeschema/dialogs/dialog_bom_help.html
>>
>> diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
>> index 84e4923f0..33e6bfae5 100644
>> --- a/eeschema/CMakeLists.txt
>> +++ b/eeschema/CMakeLists.txt
>> @@ -253,23 +253,6 @@ else()
>>      set( EESCHEMA_RESOURCES eeschema.rc )
>>  endif()
>>
>> -# Create a C++ compilable string initializer containing html text
>> into a *.h file:
>> -add_custom_command(
>> -    OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
>> -    COMMAND ${CMAKE_COMMAND}
>> -       
>> -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html
>> -       
>> -DoutputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
>> -        -P ${CMAKE_MODULE_PATH}/Html2C.cmake
>> -    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html
>> -    COMMENT "creating
>> ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
>> -       from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html"
>> -    )
>> -
>> -set_source_files_properties( dialogs/dialog_bom.cpp
>> -    PROPERTIES
>> -        OBJECT_DEPENDS
>> ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
>> -    )
>> -
>>  if( APPLE )
>>      # setup bundle
>>      set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns )
>> diff --git a/eeschema/dialogs/dialog_bom.cpp
>> b/eeschema/dialogs/dialog_bom.cpp
>> index d095681f7..caadec739 100644
>> --- a/eeschema/dialogs/dialog_bom.cpp
>> +++ b/eeschema/dialogs/dialog_bom.cpp
>> @@ -46,10 +46,6 @@
>>  #define BOM_PLUGINS_KEY wxT("bom_plugins")
>>  #define BOM_PLUGIN_SELECTED_KEY wxT("bom_plugin_selected")
>>
>> -const char * s_bomHelpInfo =
>> -#include <dialog_bom_help_html.h>
>> -;
>> -
>>  #include <dialog_bom_cfg_lexer.h>
>>
>>  using namespace T_BOMCFG_T;
>> @@ -632,11 +628,217 @@ void DIALOG_BOM::OnEditPlugin( wxCommandEvent&
>> event )
>>
>>  void DIALOG_BOM::OnHelp( wxCommandEvent& event )
>>  {
>> +    wxString msg = _( "<h1>1 - Full documentation:</h1>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "The <i><b>Eeschema documentation</b></i> describes this "
>> +              "<b>intermediate netlist and gives examples.</b>" );
>> +    msg << wxT( "<br>" );
>> +    msg << _( "See also " );
>> +    msg << wxT(
>> "<i>https://answers.launchpad.net/kicad/+faq/2265</i>" );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h1>2 - The intermediate Netlist File</h1>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "BOM files (and netlist files) can be created from an "
>> +              "Intermediate netlist file created by Eeschema." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "This file uses XML syntax and is called the
>> intermediate "
>> +              "netlist. The intermediate netlist includes a large
>> amount of "
>> +              "data about your board and because of this, it can be
>> used with "
>> +              "post-processing to create a BOM or other reports." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "Depending on the output (BOM or netlist), different
>> subsets of "
>> +              "the complete Intermediate Netlist file will be used in
>> the "
>> +              "post-processing." );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h1>3 - Conversion to a new format</h1>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "By applying a post-processing filter to the
>> Intermediate "
>> +              "netlist file you can generate foreign netlist files as
>> well as "
>> +              "BOM files. Because this conversion is a text to text "
>> +              "transformation." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "This post-processing filter can be written using "
>> +              "<b>Python</b>, <b>XSLT</b>, or any other tool capable
>> of "
>> +              "taking XML as input." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "XSLT itself is a XML language very suitable for XML "
>> +              "transformations. There is a free program called "
>> +              "<i>xsltproc</i> that you can download and install. The "
>> +              "xsltproc program can be used to read the Intermediate
>> XML "
>> +              "netlist input file, apply a style-sheet to transform
>> the "
>> +              "input, and save the results in an output file. Use of
>> xsltproc "
>> +              "requires a style-sheet file using XSLT conventions.
>> The full "
>> +              "conversion process is handled by Eeschema, after it is "
>> +              "configured once to run xsltproc in a specific way." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "A Python script is somewhat more easy to create." );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h1>4 - Initialization of the dialog window</h1>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "You should add a new pluging (a script) in plugin list
>> by "
>> +            "clicking on the Add Plugin button." );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h2>4.1 - Plugin Configuration Parameters</h2>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "The Eeschema plug-in configuration dialog requires the "
>> +              "following information:" );
>> +    msg << wxT( "<ul><li>" );
>> +    msg << _( "The title: for instance, the name of the netlist
>> format." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "The command line to launch the converter (usually a
>> script)." );
>> +    msg << wxT( "</li></ul>" );
>> +    msg << wxT( "<br><br>" );
>> +    msg << wxT( "<b><i>" );
>> +    msg << _( "Note (Windows only):" );
>> +    msg << wxT( "</i></b>" );
>> +    msg << wxT( "<br>" );
>> +    msg << wxT( "<i>" );
>> +    msg << _( "By default, command line runs with hidden console
>> window and "
>> +              "output is redirected to \"Plugin info\" field. To show
>> the "
>> +              "window of the running command, set the checkbox \"Show
>> console "
>> +              "window\"." );
>> +    msg << wxT( "</i>" );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "Once you click on the generate button the following
>> will happen:" );
>> +    msg << wxT( "<ol><li>" );
>> +    msg << _( "Eeschema creates an intermediate netlist file *.xml,
>> for "
>> +              "instance <i>test.xml.</i>" );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "Eeschema runs the script from the command line to
>> create the "
>> +              "final output file." );
>> +    msg << wxT( "</li></ol>" );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h2>4.2 - Generate netlist files with the command
>> line</h2>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "Assuming we are using the program <i>xsltproc.exe</i>
>> to apply "
>> +              "the sheet style to the intermediate file,
>> <i>xsltproc.exe</i> "
>> +              "is executed with the following command." );
>> +    msg << wxT( "<br><br><samp>" );
>> +    msg << _( "xsltproc.exe -o &lt; output filename &gt; &lt;
>> style-sheet "
>> +              "filename &gt; &lt; input XML file to convert &gt;" );
>> +    msg << wxT( "</samp><br><br>" );
>> +    msg << _( "On Windows the command line is the following." );
>> +    msg << wxT( "<br><br><samp> f:\\kicad\\bin\\xsltproc.exe -o &ldquo;"
>> +                "%O&rdquo; f:\\kicad\\bin\\plugins\\"
>> +                "myconverter.xsl &ldquo;%I&rdquo; </samp><br><br>" );
>> +    msg << _( "On Linux the command becomes as following." );
>> +    msg << wxT( "<br><br><samp> xsltproc -o &ldquo;%O&rdquo;
>> /usr/local/kicad/"
>> +                "bin/plugins/myconverter.xsl &ldquo;%I&rdquo;
>> </samp><br><br>" );
>> +    msg << _( "where <i>myconverter.xsl</i> is the style-sheet that
>> you are "
>> +              "applying." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "Do not forget the double quotes around the file names,
>> this "
>> +              "allows them to have spaces after the substitution by
>> Eeschema." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "If a Python script is used, the command line is
>> something like "
>> +              "(depending on the Python script):" );
>> +    msg << wxT( "<br><br><samp> python f:\\kicad\\bin\\plugins\\"
>> +                "bom-in-python\\myconverter.py &ldquo;%I&rdquo;&ldquo;"
>> +                "%O&rdquo; </samp><br><br>" );
>> +    msg << _( "or" );
>> +    msg << wxT( "<br><br><samp> python /usr/local/kicad/bin/plugins/"
>> +                "bom-in-python/myconverter.py &ldquo;%I&rdquo; &ldquo;"
>> +                "%O&rdquo; </samp><br><br>" );
>> +    msg << _( "The command line format accepts parameters for
>> filenames:" );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "The supported formatting parameters are." );
>> +    msg << wxT( "<br>" );
>> +    msg << wxT( "<ul><li>" );
>> +    msg << _( "<b>%B</b> =&gt; base filename of selected output file,
>> minus "
>> +              "path and extension." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "<b>%P</b> =&gt; project directory, without name and
>> without "
>> +              "trailing '/'." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "<b>%I</b> =&gt; complete filename and path of the
>> temporary "
>> +              "input file (the intermediate net file)." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "<b>%O</b> =&gt; complete filename and path (but without "
>> +              "extension) of the user chosen output file." );
>> +    msg << wxT( "</li></ul>" );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "<b>%I</b> will be replaced by the actual intermediate
>> file "
>> +              "name (usually the full root sheet filename with
>> extension "
>> +              "&ldquo;.xml&rdquo;)" );
>> +    msg << wxT( "<br>" );
>> +    msg << _( "<b>%O</b> will be replaced by the actual output file
>> name "
>> +              "(the full root sheet filename minus extension)." );
>> +    msg << wxT( "<br>" );
>> +    msg << _( "<b>%B</b> will be replaced by the actual output short
>> file "
>> +              "name (the short root sheet filename minus extension)." );
>> +    msg << wxT( "<br>" );
>> +    msg << _( "<b>%P</b> will be replaced by the actual current
>> project path." );
>> +
>> +    msg << _( "<h2>4.3 - Command line format:</h2>" );
>> +    msg << _( "<h3>4.3.1 - Remark:</h3>" );
>> +    msg << _( "Most of time, the created file must have an extension, "
>> +              "depending on its type." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "Therefore you have to add to the option
>> <i><b>%O</b></i> the "
>> +              "right file extension." );
>> +    msg << wxT( "<br><br>" );
>> +    msg << _( "For instance:" );
>> +    msg << wxT( "<ul><li>" );
>> +    msg << _( "<i><b>%O.csv</b></i> to create a .csv file (comma
>> separated "
>> +              "value file)." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "<i><b>%O.html</b></i> to create a .html file." );
>> +    msg << wxT( "</li><li>" );
>> +    msg << _( "<i><b>%O.bom</b></i> to create a .bom file." );
>> +    msg << wxT( "</li></ul>" );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h3>4.3.2 - Example for <i>xsltproc:</i></h3>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "The command line format for xsltproc is the
>> following:" );
>> +    msg << wxT( "<br><br><samp>" );
>> +    msg << _( " &lt; path of xsltproc &gt; xsltproc &lt; xsltproc "
>> +                "parameters &gt;" );
>> +    msg << wxT( "</samp><br><br>" );
>> +    msg << _( "On Windows:" );
>> +    msg << wxT( "<br><br><samp> f:\\kicad\\bin\\xsltproc.exe -o "
>> +                "&ldquo;%O.bom&rdquo; f:\\kicad\\bin\\"
>> +                "plugins\\netlist_form_pads-pcb.xsl &ldquo;%I&rdquo; "
>> +                "</samp><br><br>" );
>> +    msg << _( "On Linux:" );
>> +    msg << wxT( "<br><br><samp> xsltproc -o &ldquo;%O.bom&rdquo;
>> /usr/local/"
>> +                "kicad/bin/plugins/netlist_form_pads-pcb.xsl
>> &ldquo;%I&rdquo; "
>> +                "</samp><br><br>" );
>> +    msg << _( "The above examples assume xsltproc is installed on
>> your PC "
>> +              "under Windows xsl exe files located in " );
>> +    msg << wxT( "kicad\\bin\\<b>plugins\\</b>." );
>> +    msg << wxT( "</p>" );
>> +
>> +    msg << _( "<h3>4.3.3 - Example for <i>python</i> scripts:</h3>" );
>> +    msg << wxT( "<p>" );
>> +    msg << _( "The command line format for python is something like:" );
>> +    msg << wxT( "<br><br><samp>" );
>> +    msg << _( "python &lt; script file name &gt; &lt; input filename
>> &gt; "
>> +              "&lt; output filename &gt;" );
>> +    msg << wxT( "</samp><br><br>" );
>> +    msg << _( "On Windows:" );
>> +    msg << wxT( "<br><br><samp> python.exe f:\\kicad\\bin/plugins\\"
>> +                "bom-in-python\\my_python_script.py &ldquo;%I&rdquo; "
>> +                "&ldquo;%O.html&rdquo; </samp><br><br>" );
>> +    msg << _( "On Linux:" );
>> +    msg << wxT( "<br><br><samp> python /usr/local/kicad/bin/plugins/"
>> +                "bom-in-python/my_python_script.py &ldquo;%I&rdquo; "
>> +                "&ldquo;%O.csv&rdquo; </samp><br><br>" );
>> +    msg << _( "Assuming python is installed on your PC, and python
>> scripts "
>> +              "are located in " );
>> +    msg << wxT( "<i><b>kicad\\bin\\plugins\\bom-in-python\\</b></i>." );
>> +    msg << wxT( "</p>" );
>> +
>> +
>>      HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help") );
>>      help_Dlg.SetDialogSizeInDU( 500, 350 );
>>
>> -    wxString msg = FROM_UTF8(s_bomHelpInfo);
>> -    help_Dlg.m_htmlWindow->AppendToPage( msg );
>> +    help_Dlg.AddHTML_Text( msg );
>>      help_Dlg.ShowModal();
>>  }
>>
>> diff --git a/eeschema/dialogs/dialog_bom_help.html
>> b/eeschema/dialogs/dialog_bom_help.html
>> deleted file mode 100644
>> index cd6169a2c..000000000
>> --- a/eeschema/dialogs/dialog_bom_help.html
>> +++ /dev/null
>> @@ -1,286 +0,0 @@
>> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> -<html>
>> -<head>
>> -    <meta http-equiv="content-type" content="text/html;
>> charset=windows-1252"/>
>> -    <title>kicad help</title>
>> -    <meta name="generator" content="LibreOffice 4.3.5.2 (Windows)"/>
>> -    <meta name="created" content="00:00:00"/>
>> -    <meta name="changed" content="2015-05-27T11:29:49.733000000"/>
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2015-05-27T10:36:10.287000000">
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2015-05-27T09:45:48.809000000">
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2015-05-27T09:29:26.026000000">
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2014-12-03T20:04:24.723000000">
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2014-12-03T20:04:06.003000000">
>> -    <meta name="created" content="00:00:00">
>> -    <meta name="changed" content="2014-12-03T19:59:24.882000000">
>> -    <style type="text/css">
>> -        @page { margin: 2cm }
>> -        p { margin-bottom: 0.21cm; color: #000000; widows: 0;
>> orphans: 0;
>> page-break-before: auto; page-break-after: auto }
>> -        p.western { font-family: "Arial", sans-serif; font-size: 10pt;
>> so-language: en-US }
>> -        h1 { color: #000000 }
>> -        h1.western { font-family: "Times New Roman", serif }
>> -        h2 { color: #000000 }
>> -        h2.western { font-family: "Times New Roman", serif;
>> font-size: 20pt }
>> -        h2.cjk { font-family: "SimSun"; font-size: 14pt }
>> -        h2.ctl { font-family: "Mangal"; font-size: 14pt }
>> -        h3 { background: transparent; color: #000000 }
>> -        h3.western { font-family: "Times New Roman", serif; font-size:
>> 16pt; font-style: italic }
>> -        h3.cjk { font-family: "SimSun" }
>> -        h3.ctl { font-family: "Mangal" }
>> -        a:link { color: #004586; text-decoration: none }
>> -        a.western:link { font-family: "Liberation Sans", sans-serif;
>> so-language: zxx; font-style: italic }
>> -        a.sdfootnotesym-western { font-family: "DejaVu Serif", serif }
>> -    </style>
>> -</head>
>> -<body lang="en-AU" text="#000000" link="#004586" dir="ltr">
>> -<h1 class="western"><a name="__RefHeading__2925_482973253"></a>1 -
>> -Full documentation:</h1>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><span style="font-weight: normal">The
>> -</span><i><b>Eeschema documentation</b></i> <span style="font-weight:
>> normal">describes
>> -this </span><b>intermediate netlist and gives examples<br></b><span
>> style="font-weight: normal">See
>> -also
>> </span><i><b>https://answers.launchpad.net/kicad/+faq/2265</b></i></font></font></p>
>>
>> -<h1 class="western"><i>2 - </i>The intermediate Netlist File</h1>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">BOM
>> -files (and netlist files) can be created from an Intermediate netlist
>> -file created by Eeschema.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">This
>> -file uses XML syntax and is called the intermediate netlist. The
>> -intermediate netlist includes a large amount of data about your board
>> -and because of this, it can be used with post-processing to create a
>> -BOM or other reports.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Depending
>> -on the output (BOM or netlist), different subsets of the complete
>> -Intermediate Netlist file will be used in the
>> post-processing.</font></font></p>
>> -<h1 class="western">3 - Conversion to a new format</h1>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">By
>> -applying a post-processing filter to the Intermediate netlist file
>> -you can generate foreign netlist files as well as BOM files. Because
>> -this conversion is a text to text transformation.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">this
>> -post-processing filter can be written using <b>Python</b>, <b>XSLT</b>,
>> -or any other tool capable of taking XML as input.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">XSLT
>> -itself is a XML language very suitable for XML transformations. There
>> -is a free program called </span></span></span><i><span
>> style="font-weight: normal">xsltproc</span></i><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">that
>> -you can download and install. The</span></span></span><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">xsltproc
>> -program can be used to read the Intermediate XML netlist input file,
>> -apply</span></span></span><span style="font-variant: normal">
>> </span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">a
>> -style-sheet to transform the input, and save the results in an output
>> -file. Use of xsltproc requires a style-sheet file using XSLT
>> -conventions. The full conversion process is
>> handled</span></span></span><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">by
>> -Eeschema, after it is configured once to run xsltproc in a specific
>> -way.</span></span></span></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm;
>> font-variant: normal; font-style: normal; font-weight: normal; widows:
>> 0; orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">A
>> -Python script is somewhat more easy to create.</font></font></p>
>> -<h1 class="western">4 - Initialization of the dialog window</h1>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">You
>> -should add a new pluging (a script) in plugin list by clicking on the
>> -Add Plugin button.</font></font></p>
>> -<h2 class="western">4.1 - Plugin Configuration Parameters</h2>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">The
>> -Eeschema plug-in configuration dialog requires the following
>> -information:</font></font></p>
>> -<ul>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3"
>> style="font-size: 12pt">The
>> -    title: for instance, the name of the netlist
>> format.</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3"
>> style="font-size: 12pt">The
>> -    command line to launch the converter (usually a
>> script).</font></font></p>
>> -</ul>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b><i>Note (Windows only):</i></b></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm;
>> margin-top: 0cm; margin-left: 1cm; widows: 0; orphans: 0;
>> page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><i>By default, command line runs with hidden console window and
>> output is redirected to "Plugin info" field. To show the window of the
>> running command, set the checkbox "Show console
>> window".</i></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Once
>> -you click on the generate button the following will
>> happen:</font></font></p>
>> -<ol>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Eeschema
>> -    creates an intermediate netlist file *.xml, for instance
>> <i>test.xml.</i></font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Eeschema
>> -    runs the script from the command line to create the final output
>> -    file.</font></font></p>
>> -</ol>
>> -<h2 class="western">4.2 - Generate netlist files with the command
>> -line</h2>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Assuming
>> -we are using the program <i>xsltproc.exe</i><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal">to
>> -apply the sheet style to the intermediate file,
>> </span></span><i>xsltproc.exe</i><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal">is
>> -executed with the following command.</span></span></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">xsltproc.exe
>> --o &lt; output filename &gt; &lt; style-sheet filename &gt; &lt;
>> -input XML file to convert &gt;</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Windows the command line is the
>> following.<br><i>f:/kicad/bin/xsltproc.exe
>> --o &ldquo;%O&rdquo; f:/kicad/bin/plugins/myconverter.xsl
>> &ldquo;%I&rdquo;</i></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Linux the command becomes as following.<br><i>xsltproc -o
>> &ldquo;%O&rdquo;
>> -/usr/local/kicad/bin/plugins/myconverter .xsl
>> &ldquo;%I&rdquo;<br>w</i><span style="font-variant: normal"><span
>> style="font-style: normal"><span style="font-weight: normal">here
>> -</span></span></span><span style="font-variant: normal"><i><span
>> style="font-weight: normal">myconverter</span></i></span><i><span
>> style="font-weight: normal">.xsl</span></i><span style="font-variant:
>> normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">is
>> -the style-sheet that you are
>> applying.</span></span></span></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">Do
>> -not forget the double quotes</span></span></span><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">around
>> -the file names, this allows them to have spaces after the
>> -substitution by Eeschema.</span></span></span></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm;
>> font-variant: normal; font-style: normal; font-weight: normal; widows:
>> 0; orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">If
>> -a Python script is used, the command line is something like
>> -(depending on the Python script):</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><i>python</i>
>> -<i>f:/kicad/bin/plugins/bom-in-python/myconverter.py</i>
>> -&ldquo;<i>%I&rdquo;&ldquo;%O&rdquo;<br>or<br>python</i>
>> -<i>/usr/local/kicad/bin/plugins/bom-in-python/myconverter .xsl
>> &ldquo;%I&rdquo;
>> -&ldquo;%O&rdquo; </i></font></font>
>> -</p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">The
>> -command line format accepts parameters for filenames:</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">The
>> -supported formatting parameters are.</font></font></p>
>> -<ul>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b>%B</b>
>> -    =&gt; base filename of selected output file, minus path and
>> extension.</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b>%P</b>
>> -    =&gt; project directory, without name and without trailing
>> '/'.</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b>%I
>> -    </b>=&gt; complete filename and path of the temporary input file
>> -    (the intermediate net file).</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b>%O</b>
>> -    =&gt; complete filename and path (but without extension) of the user
>> -    chosen output file.</font></font></p>
>> -</ul>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><b>%I</b>
>> -will be replaced by the actual intermediate file name<span
>> style="font-variant: normal"><span style="font-style: normal"><span
>> style="font-weight: normal">(usually
>> -the full root sheet filename with extension
>> &ldquo;.xml&rdquo;)</span></span></span><br><span style="font-variant:
>> normal"><span style="font-style: normal"><b>%O</b></span></span><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">will
>> -be replaced by the actual output file name (the full root sheet
>> -filename minus extension).<br></span></span></span><span
>> style="font-variant: normal"><span style="font-style:
>> normal"><b>%B</b></span></span><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">will
>> -be replaced by the actual output short file
>> name</span></span></span><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">(the
>> -short root sheet filename minus
>> extension).<br></span></span></span><span style="font-variant:
>> normal"><span style="font-style: normal"><b>%P</b></span></span><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">will
>> -be replaced by the actual current project
>> path.</span></span></span></font></font></p>
>> -<h2 class="western">4.3 - Command line format:</h2>
>> -<h3 class="western">4.3.1 - Remark:</h3>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Most
>> -of time, the created file must have an extension, depending on its
>> -type.<br>Therefore you have to add to the option <i><b>%O</b></i> the
>> -right file extension.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">For
>> -instance:</font></font></p>
>> -<ul>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><i><b>%O.csv</b></i>
>> -    to create a .csv file (comma separated value
>> file).</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><i><b>%O.html</b></i>
>> -    to create a .html file.</font></font></p>
>> -    <li/>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -    <font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><i><b>%O.bom</b></i>
>> -    to create a .bom file.</font></font></p>
>> -</ul>
>> -<h3 class="western">4.3.2 Example for<i> </i><span
>> style="font-variant: normal"><i>xsltproc:</i></span></h3>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><span style="font-variant: normal"><span style="font-style:
>> normal">The
>> -command line format for xsltproc is the following:<br>&lt; path of
>> -</span></span>xsltproc &gt; <span style="font-variant: normal"><span
>> style="font-style: normal">xsltproc
>> -&lt; </span></span>xsltproc parameters &gt;</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Windows:<br><i><b>f:/kicad/bin/xsltproc.exe -o
>> &ldquo;%O.bom</b></i>&rdquo;
>> -<i><b>f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl
>> &ldquo;%I&rdquo;</b></i></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Linux:<br><i><b>xsltproc -o &ldquo;%O.bom</b></i>&rdquo;
>> -<i><b>/usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl
>> &ldquo;%I&rdquo;</b></i></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt"><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">The
>> -above examples assume</span></span></span><span style="font-variant:
>> normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">xsltproc
>> -is installed on your PC under Windows xsl</span></span></span><span
>> style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight:
>> normal">exe</span></span></span><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal"><span style="font-weight: normal">files
>> -located in kicad/bin</span></span></span><span style="font-variant:
>> normal"><i><b>plugins/</b></i></span><span style="font-variant:
>> normal"><span style="font-style: normal"><span style="font-weight:
>> normal">.</span></span></span></font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0">
>> -<br/>
>> -
>> -</p>
>> -<h3 class="western">4.3.3 <i>Example fo</i><span style="font-variant:
>> normal"><i>r
>> -python scripts:</i></span></h3>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">The
>> -command line format for python is something like:<br><span
>> style="font-variant: normal"><span style="font-style:
>> normal">python</span></span><span style="font-variant: normal">
>> -</span><span style="font-variant: normal"><span style="font-style:
>> normal">&lt;
>> -script file name </span></span>&gt; &lt; input filename &gt; &lt;
>> -output filename &gt;</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Windows:<br><i><b>python.exe f:/kicad/bin/plugins
>> -/bom-in-python/my_python_script.py</b></i> &ldquo;<i><b>%I&rdquo;
>> -&ldquo;%O.html</b></i>&rdquo;</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">On
>> -Linux:<br><i><b>python</b></i> <i><b>/usr/local/kicad/bin/plugins
>> -/bom-in-python/my_python_script.py</b></i> &ldquo;<i><b>%I&rdquo;
>> -&ldquo;%O.csv</b></i>&rdquo;</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<font face="Times New Roman, serif"><font size="3" style="font-size:
>> 12pt">Assuming
>> -python is installed on your PC, and python scripts are located in
>> -<i><b>kicad/bin/plugins /bom-in-python/</b></i>.</font></font></p>
>> -<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0;
>> orphans: 0; page-break-before: auto; page-break-after: auto">
>> -<br/>
>> -
>> -</p>
>> -</body>
>> -</html>
> 
> _______________________________________________
> 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