Show warning dialog message when is not possible to create the BOM file.
This commit is contained in:
parent
fa060c7c58
commit
08a01bb667
|
@ -342,8 +342,13 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
|
|||
m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
|
||||
#endif
|
||||
|
||||
bool status = false;
|
||||
|
||||
if( m_parent->ReadyToNetlist( _( "Generating BOM requires a fully annotated schematic." ) ) )
|
||||
m_parent->WriteNetListFile( NET_TYPE_BOM, fullfilename, GNL_OPT_BOM|GNL_ALL, &reporter );
|
||||
status = m_parent->WriteNetListFile( NET_TYPE_BOM, fullfilename, GNL_OPT_BOM|GNL_ALL, &reporter );
|
||||
|
||||
if( !status )
|
||||
DisplayError( this, _( "Failed to create file." ) );
|
||||
|
||||
m_Messages->SetValue( reportmsg );
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
if( diag != 0 )
|
||||
{
|
||||
msg.Printf( _( "Command error. Return code %d." ), diag );
|
||||
res = false;
|
||||
aReporter->ReportTail( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
else
|
||||
|
@ -171,7 +172,9 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
|
|||
}
|
||||
else
|
||||
{
|
||||
wxExecute( commandLine, m_exec_flags );
|
||||
int diag = wxExecute( commandLine, m_exec_flags );
|
||||
if( diag != 0 )
|
||||
res = false;
|
||||
}
|
||||
|
||||
DefaultExecFlags(); // Reset flags to default after executing
|
||||
|
|
|
@ -66,12 +66,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print( __file__, ":", e, sys.stderr )
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# subset the components to those wanted in the BOM, controlled
|
||||
# by <configure> block in kicad_netlist_reader.py
|
||||
|
@ -151,3 +153,6 @@ for group in grouped:
|
|||
writerow( out, row )
|
||||
|
||||
f.close()
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -32,12 +32,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# Create a new csv writer object to use as the output formatter
|
||||
out = csv.writer(f, lineterminator='\n', delimiter=',', quotechar='\"', quoting=csv.QUOTE_ALL)
|
||||
|
@ -76,4 +78,5 @@ for group in grouped:
|
|||
fromNetlistText( c.getField("Vendor") ),
|
||||
c.getDNPString()])
|
||||
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -71,12 +71,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# Create a new csv writer object to use as the output formatter
|
||||
out = csv.writer(f, lineterminator='\n', delimiter=',', quotechar='\"', quoting=csv.QUOTE_ALL)
|
||||
|
@ -115,3 +117,6 @@ for group in grouped:
|
|||
out.writerow(row)
|
||||
|
||||
index += 1
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
||||
|
|
|
@ -34,12 +34,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print( __file__, ":", e, sys.stderr )
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# Create a new csv writer object to use as the output formatter
|
||||
out = csv.writer(f, lineterminator='\n', delimiter=',', quotechar="\"", quoting=csv.QUOTE_ALL)
|
||||
|
@ -65,3 +67,6 @@ for c in components:
|
|||
writerow( out, [c.getRef(), c.getValue(), c.getFootprint(), c.getDatasheet(),
|
||||
c.getField("Manufacturer"), c.getField("Vendor"), c.getDNPString()])
|
||||
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -49,12 +49,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_write(sys.argv[2], 'wb')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, file=sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
components = net.getInterestingComponents( excludeBOM=True )
|
||||
|
||||
|
@ -106,3 +108,6 @@ if sys.version_info[0] < 3:
|
|||
else:
|
||||
f.write(html.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -85,12 +85,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_write(sys.argv[2], 'wb')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, file=sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# Output a set of rows for a header providing general information
|
||||
html = html.replace('<!--SOURCE-->', net.getSource())
|
||||
|
@ -139,3 +141,6 @@ if sys.version_info[0] < 3:
|
|||
else:
|
||||
f.write(html.encode('utf-8'))
|
||||
f.close
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -33,12 +33,14 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w' )
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
# Create a new csv writer object to use as the output formatter, although we
|
||||
# are created a tab delimited list instead!
|
||||
|
@ -65,3 +67,6 @@ writerow( out, ['Ref', 'Value', 'Part', 'Footprint', 'Description', 'Vendor', 'D
|
|||
for c in components:
|
||||
writerow( out, [c.getRef(), c.getValue(), c.getLibName() + ":" + c.getPartName(),
|
||||
c.getFootprint(), c.getDescription(), c.getField("Vendor"), c.getDNPString()])
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -34,12 +34,14 @@ netlist = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = open(sys.argv[2], 'wb')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
components = netlist.getInterestingComponents( excludeBoard=True )
|
||||
|
||||
|
@ -108,3 +110,6 @@ row += '\n)\n'
|
|||
|
||||
f.write(row.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -34,12 +34,14 @@ netlist = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = open(sys.argv[2], 'wb')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
components = netlist.getInterestingComponents( excludeBoard=True )
|
||||
|
||||
|
@ -117,3 +119,6 @@ row += '\n.END\n'
|
|||
|
||||
f.write(row.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -34,12 +34,14 @@ netlist = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = open(sys.argv[2], 'wb')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
components = netlist.getInterestingComponents( excludeBoard=True )
|
||||
|
||||
|
@ -96,3 +98,6 @@ row += '*END*\n'
|
|||
|
||||
f.write(row.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -18,11 +18,16 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = open(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print( __file__, ":", e, sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
print(net.formatXML(), file=f)
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
|
@ -61,14 +61,19 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
|
|||
|
||||
# Open a file to write to, if the file cannot be opened output to stdout
|
||||
# instead
|
||||
canOpenFile = True
|
||||
try:
|
||||
f = open(sys.argv[2], 'w')
|
||||
except IOError:
|
||||
e = "Can't open output file for writing: " + sys.argv[2]
|
||||
print(__file__, ":", e, file=sys.stderr)
|
||||
f = sys.stdout
|
||||
canOpenFile = False
|
||||
|
||||
for c in net.components:
|
||||
c.checkvalue()
|
||||
|
||||
print(net.formatXML(), file=f)
|
||||
|
||||
if not canOpenFile:
|
||||
sys.exit(1)
|
Loading…
Reference in New Issue