Added a button to open output directory in plot dialog

Shows a bitmap button next to the output location string, allowing the user to quickly view the generated file location

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17659
This commit is contained in:
IkomaSo
2024-10-27 23:33:24 +00:00
committed by Seth Hillbrand
parent 26094762ee
commit f5765bac7f
13 changed files with 210 additions and 4 deletions
+23
View File
@@ -271,6 +271,7 @@ void DIALOG_PLOT::init_Dialog()
m_zoneFillCheck->SetValue( cfg->m_Plot.check_zones_before_plotting );
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
m_openDirButton->SetBitmap( KiBitmapBundle( BITMAPS::small_new_window ) );
// m_PSWidthAdjust is stored in mm in user config
m_PSWidthAdjust = KiROUND( cfg->m_Plot.ps_fine_width_adjust * pcbIUScale.IU_PER_MM );
@@ -1387,6 +1388,28 @@ void DIALOG_PLOT::onRunDRC( wxCommandEvent& event )
}
void DIALOG_PLOT::onOpenOutputDirectory( wxCommandEvent& event )
{
std::function<bool( wxString* )> textResolver = [&]( wxString* token ) -> bool
{
return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
};
wxString path = m_outputDirectoryName->GetValue();
path = ExpandTextVars( path, &textResolver );
path = ExpandEnvVarSubstitutions( path, &Prj() );
path = Prj().AbsolutePath( path );
if( !wxDirExists( path ) )
{
DisplayError( this, wxString::Format( _( "Directory '%s' does not exist." ), path ) );
return;
}
wxLaunchDefaultApplication( path );
}
void DIALOG_PLOT::onBoardSetup( wxHyperlinkEvent& aEvent )
{
PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );