From f4cc9b86e31e6bcbcda9b0fb8659c66abfc266d6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 1 Mar 2021 16:53:12 +0000 Subject: [PATCH] Inform user (and bail on UpdatePCB) if annotation failed. Fixes https://gitlab.com/kicad/code/kicad/issues/7310 --- pcbnew/pcb_edit_frame.cpp | 31 ++++++++++++++----------------- pcbnew/pcb_edit_frame.h | 5 ----- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 9b369b9f3f..3053d8393f 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1374,18 +1374,26 @@ bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, const wxStrin { if( !TestStandalone() ) { - DisplayError( this, _( "Cannot update the PCB because PCB editor is opened in stand-alone " - "mode. In order to create or update PCBs from schematics, you " - "must launch the KiCad project manager and create a project." ) ); - return false; //Not in standalone mode + DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in " + "stand-alone mode. In order to create or update PCBs from " + "schematics, you must launch the KiCad project manager and " + "create a project." ) ); + return false; // Not in standalone mode } - Raise(); //Show + Raise(); // Show std::string payload( aAnnotateMessage ); Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this ); + if( payload == aAnnotateMessage ) + { + Raise(); + DisplayErrorMessage( this, aAnnotateMessage ); + return false; + } + try { auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) ); @@ -1394,6 +1402,7 @@ bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, const wxStrin } catch( const IO_ERROR& ) { + Raise(); assert( false ); // should never happen return false; } @@ -1402,18 +1411,6 @@ bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, const wxStrin } -void PCB_EDIT_FRAME::DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimestamps ) -{ - BOARD_NETLIST_UPDATER updater( this, GetBoard() ); - updater.SetLookupByTimestamp( aUseTimestamps ); - updater.SetDeleteUnusedComponents( false ); - updater.SetReplaceFootprints( true ); - updater.SetDeleteSinglePadNets( false ); - updater.SetWarnPadNoNetInNetlist( false ); - updater.UpdateNetlist( aNetlist ); -} - - void PCB_EDIT_FRAME::RunEeschema() { wxString msg; diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 37ee125037..ab1ba13eb9 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -764,11 +764,6 @@ public: */ bool TestStandalone( void ); - /** - * An automated version of UpdatePCBFromNetlist which skips the UI dialog. - */ - void DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimestamps ); - /** * Read a netlist from a file into a #NETLIST object. *