Don't overload error dialog.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18195
This commit is contained in:
parent
cb41b53ab7
commit
441da8dfb6
|
@ -350,6 +350,22 @@ void SIMULATOR_FRAME::UpdateTitle()
|
|||
}
|
||||
|
||||
|
||||
// Don't let the dialog grow too tall: you may not be able to get to the OK button
|
||||
#define MAX_MESSAGES 20
|
||||
|
||||
void SIMULATOR_FRAME::showNetlistErrors( const wxString& aErrors )
|
||||
{
|
||||
wxArrayString lines = wxSplit( aErrors, '\n' );
|
||||
|
||||
if( lines.size() > MAX_MESSAGES )
|
||||
{
|
||||
lines.RemoveAt( MAX_MESSAGES, lines.size() - MAX_MESSAGES );
|
||||
lines.Add( wxS( "..." ) );
|
||||
}
|
||||
|
||||
DisplayErrorMessage( this, _( "Errors during netlist generation." ), wxJoin( lines, '\n' ) );
|
||||
}
|
||||
|
||||
|
||||
bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimOptions )
|
||||
{
|
||||
|
@ -365,7 +381,7 @@ bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimO
|
|||
if( !m_simulator->Attach( m_circuitModel, aSimCommand, aSimOptions, Prj().GetProjectPath(),
|
||||
s_reporter ) )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Errors during netlist generation.\n\n" ) + s_errors );
|
||||
showNetlistErrors( s_errors );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -375,10 +391,12 @@ bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimO
|
|||
|
||||
void SIMULATOR_FRAME::ReloadSimulator( const wxString& aSimCommand, unsigned aSimOptions )
|
||||
{
|
||||
s_errors.clear();
|
||||
|
||||
if( !m_simulator->Attach( m_circuitModel, aSimCommand, aSimOptions, Prj().GetProjectPath(),
|
||||
s_reporter ) )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Errors during netlist generation.\n\n" ) + s_errors );
|
||||
showNetlistErrors( s_errors );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,8 +588,7 @@ bool SIMULATOR_FRAME::EditAnalysis()
|
|||
if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS,
|
||||
s_reporter ) )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Errors during netlist generation.\n\n" )
|
||||
+ s_errors );
|
||||
showNetlistErrors( s_errors );
|
||||
}
|
||||
|
||||
dlg.SetSimCommand( simTab->GetSimCommand() );
|
||||
|
|
|
@ -196,6 +196,8 @@ private:
|
|||
|
||||
void setupUIConditions() override;
|
||||
|
||||
void showNetlistErrors( const wxString& aErrors );
|
||||
|
||||
bool canCloseWindow( wxCloseEvent& aEvent ) override;
|
||||
void doCloseWindow() override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue