7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 09:51:53 +00:00

Re-work filtering of temp-dir messages in jobset outputs.

(Also rationalises some of the output reporting
for consistency.)
This commit is contained in:
Jeff Young 2025-01-17 13:07:04 +00:00
parent f7295eefdb
commit 232542f42b
10 changed files with 77 additions and 28 deletions

View File

@ -741,6 +741,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
if( !res )
return CLI::EXIT_CODES::ERR_UNKNOWN;
m_reporter->Report( wxString::Format( _( "Wrote bill of materials to '%s'." ), outPath ),
RPT_SEVERITY_ACTION );
return CLI::EXIT_CODES::OK;
}
@ -811,6 +814,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
if( !res )
return CLI::EXIT_CODES::ERR_UNKNOWN;
m_reporter->Report( wxString::Format( _( "Wrote bill of materials to '%s'." ), outPath ),
RPT_SEVERITY_ACTION );
return CLI::EXIT_CODES::OK;
}
@ -1167,6 +1173,9 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
}
m_reporter->Report( wxString::Format( _( "Saved ERC Report to %s\n" ), outPath ),
RPT_SEVERITY_ACTION );
if( ercJob->m_exitCodeViolations )
{
if( markersProvider->GetCount() > 0 )

View File

@ -161,7 +161,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
}
else
{
aReporter->ReportTail( _( "Success." ), RPT_SEVERITY_INFO );
aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
}
if( output.GetCount() )

View File

@ -580,7 +580,7 @@ void SCH_PLOTTER::createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts,
if( aReporter )
{
aReporter->ReportTail( _( "Done" ), RPT_SEVERITY_INFO );
aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
}
restoreEnvironment( nullptr, oldsheetpath );

View File

@ -52,12 +52,10 @@ extern KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> Jobset
class DIALOG_OUTPUT_RUN_RESULTS : public DIALOG_OUTPUT_RUN_RESULTS_BASE
{
public:
DIALOG_OUTPUT_RUN_RESULTS( wxWindow* aParent,
JOBSET* aJobsFile,
JOBSET_OUTPUT* aOutput ) :
DIALOG_OUTPUT_RUN_RESULTS_BASE( aParent ),
m_jobsFile( aJobsFile ),
m_output( aOutput )
DIALOG_OUTPUT_RUN_RESULTS( wxWindow* aParent, JOBSET* aJobsFile, JOBSET_OUTPUT* aOutput ) :
DIALOG_OUTPUT_RUN_RESULTS_BASE( aParent ),
m_jobsFile( aJobsFile ),
m_output( aOutput )
{
m_staticTextOutputName->SetLabel( wxString::Format( _( "Output: %s" ),
aOutput->GetDescription() ) );
@ -93,10 +91,19 @@ public:
}
SetupStandardButtons( { { wxID_OK, _( "Close" ) } } );
finishDialogSettings();
}
void onJobListSize( wxSizeEvent& event ) override
{
int width = m_jobList->GetSize().x;
width -= m_jobList->GetColumnWidth( 0 );
width -= m_jobList->GetColumnWidth( 1 );
virtual void OnJobListItemSelected( wxListEvent& event ) override
m_jobList->SetColumnWidth( 2, width );
}
void OnJobListItemSelected( wxListEvent& event ) override
{
int itemIndex = event.GetIndex();
@ -120,7 +127,6 @@ public:
m_textCtrlOutput->SetValue( _( "No output messages" ) );
}
}
}
private:

View File

@ -240,10 +240,12 @@ DIALOG_OUTPUT_RUN_RESULTS_BASE::DIALOG_OUTPUT_RUN_RESULTS_BASE( wxWindow* parent
bSizer16 = new wxBoxSizer( wxHORIZONTAL );
m_jobList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
bSizer16->Add( m_jobList, 1, wxALL|wxEXPAND, 5 );
bSizer16->Add( m_jobList, 3, wxALL|wxEXPAND, 5 );
m_textCtrlOutput = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_BESTWRAP|wxTE_MULTILINE|wxTE_READONLY );
bSizer16->Add( m_textCtrlOutput, 1, wxALL|wxEXPAND, 5 );
m_textCtrlOutput->SetMinSize( wxSize( 420,-1 ) );
bSizer16->Add( m_textCtrlOutput, 4, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bSizer16, 1, wxEXPAND, 5 );
@ -264,6 +266,7 @@ DIALOG_OUTPUT_RUN_RESULTS_BASE::DIALOG_OUTPUT_RUN_RESULTS_BASE( wxWindow* parent
// Connect Events
m_jobList->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnButtonOk ), NULL, this );
}
@ -271,6 +274,7 @@ DIALOG_OUTPUT_RUN_RESULTS_BASE::~DIALOG_OUTPUT_RUN_RESULTS_BASE()
{
// Disconnect Events
m_jobList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnJobListItemSelected ), NULL, this );
m_jobList->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::onJobListSize ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTPUT_RUN_RESULTS_BASE::OnButtonOk ), NULL, this );
}

View File

@ -1440,7 +1440,7 @@
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">3</property>
<object class="wxListCtrl" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1499,12 +1499,13 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnListItemSelected">OnJobListItemSelected</event>
<event name="OnSize">onJobListSize</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">4</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1540,7 +1541,7 @@
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">420,-1</property>
<property name="moveable">1</property>
<property name="name">m_textCtrlOutput</property>
<property name="pane_border">1</property>

View File

@ -124,6 +124,7 @@ class DIALOG_OUTPUT_RUN_RESULTS_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void OnJobListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void onJobListSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnButtonOk( wxCommandEvent& event ) { event.Skip(); }

View File

@ -144,13 +144,24 @@ int JOBS_RUNNER::runSpecialCopyFiles( const JOBSET_JOB* aJob, PROJECT* aProject
class JOBSET_OUTPUT_REPORTER : public WX_STRING_REPORTER
{
public:
JOBSET_OUTPUT_REPORTER( const wxString& aTempDirPath ) :
m_tempDirPath( aTempDirPath )
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity ) override
{
if( aSeverity == RPT_SEVERITY_ERROR || aSeverity == RPT_SEVERITY_WARNING )
WX_STRING_REPORTER::Report( aText, aSeverity );
wxString text( aText );
return *this;
if( aSeverity == RPT_SEVERITY_ACTION )
text.Replace( m_tempDirPath, wxEmptyString );
return WX_STRING_REPORTER::Report( text, aSeverity );
}
private:
wxString m_tempDirPath;
};
@ -173,6 +184,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
aOutput->m_lastRunReporters.clear();
wxString tempDirPath = tmp.GetFullPath();
if( !wxFileName::Mkdir( tempDirPath, wxS_DIR_DEFAULT ) )
{
if( m_reporter )
@ -251,7 +263,7 @@ bool JOBS_RUNNER::RunJobsForOutput( JOBSET_OUTPUT* aOutput, bool aBail )
if( !reporterToUse || reporterToUse == &NULL_REPORTER::GetInstance() )
{
reporterToUse = new JOBSET_OUTPUT_REPORTER;
reporterToUse = new JOBSET_OUTPUT_REPORTER( tempDirPath );
aOutput->m_lastRunReporters[job.m_id] = reporterToUse;
}

View File

@ -358,7 +358,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
}
msg.Printf( _( "Front (top side) placement file: '%s'." ), filename );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
@ -380,7 +380,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
// Display results
msg.Printf( _( "Back (bottom side) placement file: '%s'." ), filename );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
@ -389,7 +389,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
msg.Printf( _( "Full component count: %d." ), fullcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
m_reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
return true;
}
@ -491,14 +491,14 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
else
msg.Printf( _( "Front (top side) placement file: '%s'." ), fn.GetFullPath() );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
if( singleFile )
{
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
m_reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
return true;
}
@ -537,7 +537,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( !singleFile )
{
msg.Printf( _( "Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
msg.Printf( _( "Component count: %d." ), fpcount );
m_reporter->Report( msg, RPT_SEVERITY_INFO );
@ -550,7 +550,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
m_reporter->Report( msg, RPT_SEVERITY_INFO );
}
m_reporter->Report( _( "File generation successful." ), RPT_SEVERITY_INFO );
m_reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
return true;
}

View File

@ -398,7 +398,13 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob )
!aStepJob->m_vrmlModelDir.IsEmpty(), aStepJob->m_vrmlRelativePaths,
aStepJob->m_vrmlModelDir, originX, originY );
if( !success )
if ( success )
{
m_reporter->Report( wxString::Format( _( "Successfully exported VRML to %s" ),
outPath ),
RPT_SEVERITY_INFO );
}
else
{
m_reporter->Report( _( "Error exporting VRML" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_UNKNOWN;
@ -680,7 +686,12 @@ int PCBNEW_JOBS_HANDLER::JobExportRender( JOB* aJob )
: wxBITMAP_TYPE_JPEG );
}
if( !success )
if( success )
{
m_reporter->Report( _( "Successfully created 3D render image" ) + wxS( "\n" ),
RPT_SEVERITY_INFO );
}
else
{
m_reporter->Report( _( "Error creating 3D render image" ) + wxS( "\n" ),
RPT_SEVERITY_ERROR );
@ -1104,6 +1115,8 @@ int PCBNEW_JOBS_HANDLER::JobExportGencad( JOB* aJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
}
m_reporter->Report( _( "Successfully created genCAD file\n" ), RPT_SEVERITY_INFO );
return CLI::EXIT_CODES::OK;
}
@ -1796,6 +1809,9 @@ int PCBNEW_JOBS_HANDLER::JobExportDrc( JOB* aJob )
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
}
m_reporter->Report( wxString::Format( _( "Saved DRC Report to %s\n" ), outPath ),
RPT_SEVERITY_ACTION );
if( drcJob->m_exitCodeViolations )
{
if( markersProvider->GetCount() > 0 || ratsnestProvider->GetCount() > 0