Auto-edit job properties and then description after creation.

This commit is contained in:
Jeff Young 2025-01-01 19:15:33 +00:00
parent 530a66a489
commit c5ae32c51c
15 changed files with 49 additions and 43 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024-2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -101,7 +101,7 @@ public:
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
void SetDirty() { m_dirty = true; }
void SetDirty( bool aFlag = true ) { m_dirty = aFlag; }
bool GetDirty() const { return m_dirty; }
wxString GetFullName() const { return m_fileNameWithoutPath; }

View File

@ -275,8 +275,7 @@ DIALOG_EXPORT_NETLIST::DIALOG_EXPORT_NETLIST( SCH_EDIT_FRAME* aEditFrame, wxWind
m_MessagesBox->Hide();
m_outputPath->SetValue( m_job->GetOutputPath() );
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
// custom netlist (external invokes, not supported)
auto it = jobNetlistNameLookup.find( m_job->format );

View File

@ -96,8 +96,7 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* aEditFrame, wxWind
m_sdbSizer1Apply->Hide();
m_openFileAfterPlot->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
}
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017-2025, 2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -395,8 +395,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent,
m_buttonApply->Hide();
m_buttonExport->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
SetTitle( _( "BOM Export Job" ) );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2025, 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -97,7 +97,7 @@ EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER( KIWAY* aKiway ) :
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPythonBom, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
});
Register( "netlist",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportNetlist, this, std::placeholders::_1 ),
@ -132,19 +132,19 @@ EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER( KIWAY* aKiway ) :
DIALOG_PLOT_SCHEMATIC dlg( editFrame, aParent, plotJob );
dlg.ShowModal();
return false;
return true;
} );
Register( "symupgrade",
std::bind( &EESCHEMA_JOBS_HANDLER::JobSymUpgrade, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
} );
Register( "symsvg",
std::bind( &EESCHEMA_JOBS_HANDLER::JobSymExportSvg, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
} );
Register( "erc", std::bind( &EESCHEMA_JOBS_HANDLER::JobSchErc, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024-2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -672,7 +672,7 @@ void PANEL_JOBS::buildOutputList()
}
void PANEL_JOBS::OpenJobOptionsForListItem( size_t aItemIndex )
bool PANEL_JOBS::OpenJobOptionsForListItem( size_t aItemIndex )
{
JOBSET_JOB& job = m_jobsFile->GetJobs()[aItemIndex];
@ -682,11 +682,11 @@ void PANEL_JOBS::OpenJobOptionsForListItem( size_t aItemIndex )
{
EnsurePcbSchFramesOpen();
bool changes = m_frame->Kiway().ProcessJobConfigDialog( iface, job.m_job.get(), m_frame );
if( changes )
if( m_frame->Kiway().ProcessJobConfigDialog( iface, job.m_job.get(), m_frame ) )
{
m_jobsFile->SetDirty();
UpdateTitle();
return true;
}
}
else
@ -697,9 +697,12 @@ void PANEL_JOBS::OpenJobOptionsForListItem( size_t aItemIndex )
JOB_SPECIAL_EXECUTE* specialJob = static_cast<JOB_SPECIAL_EXECUTE*>( job.m_job.get() );
DIALOG_SPECIAL_EXECUTE dialog( m_frame, specialJob );
dialog.ShowModal();
return dialog.ShowModal() == wxID_OK;
}
}
return false;
}
@ -748,10 +751,24 @@ void PANEL_JOBS::OnAddJobClick( wxCommandEvent& aEvent )
if( !jobKey.IsEmpty() )
{
int row = m_jobsFile->GetJobs().size();
bool wasDirty = m_jobsFile->GetDirty();
JOB* job = JOB_REGISTRY::CreateInstance<JOB>( jobKey );
m_jobsFile->AddNewJob( jobKey, job );
rebuildJobList();
if( OpenJobOptionsForListItem( row ) )
{
rebuildJobList();
m_jobsGrid->SetGridCursor( row, 1 );
m_jobsGrid->EnableCellEditControl();
}
else
{
m_jobsFile->RemoveJob( row );
m_jobsFile->SetDirty( wasDirty );
}
}
}
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2024-2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -72,7 +72,7 @@ public:
JOBSET* GetJobsFile() { return m_jobsFile.get(); }
void OpenJobOptionsForListItem( size_t aItemIndex );
bool OpenJobOptionsForListItem( size_t aItemIndex );
void OnJobButtonDelete( wxCommandEvent& aEvent ) override;
protected:

View File

@ -70,7 +70,7 @@ DIALOG_EXPORT_2581::DIALOG_EXPORT_2581( PCB_EDIT_FRAME* aParent ) :
}
DIALOG_EXPORT_2581::DIALOG_EXPORT_2581(JOB_EXPORT_PCB_IPC2581* aJob, PCB_EDIT_FRAME* aEditFrame,
DIALOG_EXPORT_2581::DIALOG_EXPORT_2581( JOB_EXPORT_PCB_IPC2581* aJob, PCB_EDIT_FRAME* aEditFrame,
wxWindow* aParent ) :
DIALOG_EXPORT_2581_BASE( aParent ),
m_parent( aEditFrame ),
@ -78,8 +78,7 @@ DIALOG_EXPORT_2581::DIALOG_EXPORT_2581(JOB_EXPORT_PCB_IPC2581* aJob, PCB_EDIT_FR
{
m_browseButton->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
m_outputFileName->SetValue( m_job->GetOutputPath() );

View File

@ -57,8 +57,7 @@ DIALOG_EXPORT_ODBPP::DIALOG_EXPORT_ODBPP( PCB_EDIT_FRAME* aParent ) :
{
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
SetupStandardButtons( { { wxID_OK, _( "Export" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
wxString path = m_parent->GetLastPath( LAST_PATH_ODBPP );
@ -90,8 +89,7 @@ DIALOG_EXPORT_ODBPP::DIALOG_EXPORT_ODBPP( JOB_EXPORT_PCB_ODB* aJob, PCB_EDIT_FRA
{
m_browseButton->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
m_outputFileName->SetValue( m_job->GetOutputPath() );

View File

@ -114,8 +114,7 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
SetTitle( m_job->GetOptionsDialogTitle() );
m_browseButton->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
}
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and

View File

@ -74,8 +74,7 @@ DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION( JOB_EXPORT_PCB_POS
m_messagesPanel->Hide();
initDialog();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Centre();

View File

@ -100,8 +100,7 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_
bMainSizer->Remove( bMsgSizer );
m_messagesBox->Hide();
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Cancel" ) } } );
SetupStandardButtons();
m_buttonsSizer->Layout();
SetReturnCode( 1 );

View File

@ -223,8 +223,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
if( m_job )
{
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
}
else
{

View File

@ -66,8 +66,7 @@ DIALOG_RENDER_JOB::DIALOG_RENDER_JOB( wxWindow* aParent, JOB_PCB_RENDER* aJob )
for( const auto& [k, name] : sideMap )
m_choiceSide->Append( wxGetTranslation( name ) );
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
{ wxID_CANCEL, _( "Close" ) } } );
SetupStandardButtons();
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -141,7 +141,7 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
std::bind( &PCBNEW_JOBS_HANDLER::JobExportGencad, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
} );
Register( "dxf", std::bind( &PCBNEW_JOBS_HANDLER::JobExportDxf, this, std::placeholders::_1 ),
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
@ -222,13 +222,13 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
std::bind( &PCBNEW_JOBS_HANDLER::JobExportFpUpgrade, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
} );
Register( "fpsvg",
std::bind( &PCBNEW_JOBS_HANDLER::JobExportFpSvg, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return false;
return true;
} );
Register( "drc", std::bind( &PCBNEW_JOBS_HANDLER::JobExportDrc, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool