Allow XLS netlist exporters to specify a file extension.

Fixes: lp:1591779
* https://bugs.launchpad.net/kicad/+bug/1591779
This commit is contained in:
Jeff Young 2018-03-26 00:51:16 +01:00
parent c8c5b5da07
commit ba49bd0386
3 changed files with 12 additions and 3 deletions

View File

@ -55,7 +55,7 @@
#include <netlist_exporters/netlist_exporter_pspice.h> #include <netlist_exporters/netlist_exporter_pspice.h>
#include <eeschema_id.h> #include <eeschema_id.h>
#include <wx/regex.h>
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins #define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
@ -580,8 +580,17 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
break; break;
default: // custom, NET_TYPE_CUSTOM1 and greater default: // custom, NET_TYPE_CUSTOM1 and greater
{
wxString command = currPage->m_CommandStringCtrl->GetValue();
wxRegEx extRE( wxT( ".*\\.([[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]]?)\\.xslt?\".*" ) );
if( extRE.Matches( command ) )
fileExt = extRE.GetMatch( command, 1 );
title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() ); title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
} }
break;
}
fn.SetExt( fileExt ); fn.SetExt( fileExt );

View File

@ -9,7 +9,7 @@ set( XSL_SCRIPTS_LIST
xsl_scripts/netlist_form_cadstar-RINF.xsl xsl_scripts/netlist_form_cadstar-RINF.xsl
xsl_scripts/netlist_form_cadstar.xsl xsl_scripts/netlist_form_cadstar.xsl
xsl_scripts/netlist_form_OrcadPcb2.xsl xsl_scripts/netlist_form_OrcadPcb2.xsl
xsl_scripts/netlist_form_pads-pcb.xsl xsl_scripts/netlist_form_pads-pcb.asc.xsl
xsl_scripts/bom_with_title_block_2_csv.xsl xsl_scripts/bom_with_title_block_2_csv.xsl
) )

View File

@ -15,7 +15,7 @@
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/> <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/export"> <xsl:template match="/export">
<xsl:text>*PADS-PCB*&nl;*PART*&nl;</xsl:text> <xsl:text>!PADS-POWERPCB-V2.0-MILS!&nl;*PART*&nl;</xsl:text>
<xsl:apply-templates select="components/comp"/> <xsl:apply-templates select="components/comp"/>
<xsl:text>&nl;*NET*&nl;</xsl:text> <xsl:text>&nl;*NET*&nl;</xsl:text>
<xsl:apply-templates select="nets/net"/> <xsl:apply-templates select="nets/net"/>