Jobset output path includes the filename.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19659
This commit is contained in:
Jeff Young 2025-01-17 12:54:20 +00:00
parent 692f19358b
commit f7295eefdb
5 changed files with 26 additions and 80 deletions

View File

@ -118,8 +118,8 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
{
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
{
int idx =
m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
int idx = m_colorTheme->Append( settings->GetName(),
static_cast<void*>( settings ) );
if( settings->GetFilename() == cfg->m_PlotPanel.color_theme )
m_colorTheme->SetSelection( idx );
@ -181,7 +181,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
#ifdef __WINDOWS__
path.Replace( '/', '\\' );
#endif
m_outputDirectoryName->SetValue( path );
m_outputPath->SetValue( path );
}
else if( m_job )
{
@ -223,7 +223,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// And then hide it
m_plotFormatOpt->Hide();
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
m_outputPath->SetValue( m_job->GetConfiguredOutputPath() );
}
}
@ -232,10 +232,10 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
* @todo Copy of DIALOG_PLOT::onOutputDirectoryBrowseClicked in dialog_plot.cpp, maybe merge to
* a common method.
*/
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
void DIALOG_PLOT_SCHEMATIC::onOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
// Build the absolute path of current output directory to preselect it in the file browser.
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
wxString path = ExpandEnvVarSubstitutions( m_outputPath->GetValue(), &Prj() );
// When editing a schematic that is not part of a project in the stand alone mode, the
// project path is not defined so point to the users document path to save the plot files.
@ -246,7 +246,7 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
else
{
// Build the absolute path of current output directory to preselect it in the file browser.
path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
path = ExpandEnvVarSubstitutions( m_outputPath->GetValue(), &Prj() );
path = Prj().AbsolutePath( path );
}
@ -276,7 +276,7 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
dirName.MakeRelativeTo( defaultPath );
}
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
m_outputPath->SetValue( dirName.GetFullPath() );
}
@ -402,7 +402,7 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
aSettings->SetBackgroundColor( COLOR4D::UNSPECIFIED );
// Plot directory
wxString path = m_outputDirectoryName->GetValue();
wxString path = m_outputPath->GetValue();
path.Replace( '\\', '/' );
SCHEMATIC_SETTINGS& settings = m_editFrame->Schematic().Settings();
@ -452,7 +452,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
m_job->m_PDFMetadata = m_plotPDFMetadata->GetValue();
m_job->m_plotDrawingSheet = m_plotDrawingSheet->GetValue();
m_job->m_plotAll = true;
m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
m_job->SetConfiguredOutputPath( m_outputPath->GetValue() );
m_job->m_HPGLPlotOrigin =
static_cast<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>( m_plotOriginOpt->GetSelection() );
@ -502,18 +502,6 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
}
void DIALOG_PLOT_SCHEMATIC::setHpglPenWidth()
{
m_HPGLPenSize = m_penWidth.GetDoubleValue();
if( m_HPGLPenSize > schIUScale.mmToIU( 2 ) )
m_HPGLPenSize = schIUScale.mmToIU( 2 );
if( m_HPGLPenSize < schIUScale.mmToIU( 0.01 ) )
m_HPGLPenSize = schIUScale.mmToIU( 0.01 );
}
wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
{
wxString msg;
@ -530,7 +518,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
return schematic.ResolveTextVar( &schematic.CurrentSheet(), token, 0 );
};
wxString path = m_outputDirectoryName->GetValue();
wxString path = m_outputPath->GetValue();
path = ExpandTextVars( path, &textResolver );
path = ExpandEnvVarSubstitutions( path, &Prj() );

View File

@ -24,9 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_plot_schematic.h
*/
#ifndef __DIALOG_PLOT_SCHEMATIC__
#define __DIALOG_PLOT_SCHEMATIC__
@ -37,7 +34,6 @@
#include <sch_plotter.h>
class PDF_PLOTTER;
class SCH_REPORTER;
class SCH_EDIT_FRAME;
class SCH_SCREEN;
class SCH_SHEET_PATH;
@ -76,7 +72,7 @@ private:
/**
* Set the m_outputDirectoryName variable to the selected directory from directory dialog.
*/
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
PLOT_FORMAT GetPlotFileFormat();
@ -84,49 +80,10 @@ private:
void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); }
bool getOpenFileAfterPlot() { return m_openFileAfterPlot->GetValue(); }
void setOpenFileAfterPlot( bool aOpenFileAfterPlot ) { m_openFileAfterPlot->SetValue( aOpenFileAfterPlot ); }
void setHpglPenWidth();
void setOpenFileAfterPlot( bool aOpen ) { m_openFileAfterPlot->SetValue( aOpen ); }
void plotSchematic( bool aPlotAll );
// HPGLGetPlotOriginAndUnits
HPGL_PLOT_ORIGIN_AND_UNITS getPlotOriginAndUnits()
{
switch( m_plotOriginOpt->GetSelection() )
{
case 0:
default: return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT;
case 1: return HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER;
case 2: return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
case 3: return HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT;
}
}
void setPlotOriginAndUnits( HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits )
{
switch( aOriginAndUnits )
{
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
default:
m_plotOriginOpt->SetSelection( 0 );
break;
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
m_plotOriginOpt->SetSelection( 1 );
break;
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
m_plotOriginOpt->SetSelection( 2 );
break;
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
m_plotOriginOpt->SetSelection( 3 );
break;
}
}
/**
* Determine the best absolute path to plot files given the contents of the path
* edit control.
@ -145,14 +102,15 @@ private:
*/
wxString getOutputPath();
SCH_EDIT_FRAME* m_editFrame;
bool m_configChanged; // true if a project config param has changed
PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format
private:
SCH_EDIT_FRAME* m_editFrame;
bool m_configChanged; // true if a project config param has changed
PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format
static HPGL_PAGE_SIZE m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize;
UNIT_BINDER m_defaultLineWidth;
UNIT_BINDER m_penWidth;
double m_HPGLPenSize;
UNIT_BINDER m_defaultLineWidth;
UNIT_BINDER m_penWidth;
JOB_EXPORT_SCH_PLOT* m_job;
};

View File

@ -26,10 +26,10 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
m_outputPathLabel->Wrap( -1 );
bSizerDir->Add( m_outputPathLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the schematic main file location.") );
m_outputPath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputPath->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the schematic main file location.") );
bSizerDir->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 4 );
bSizerDir->Add( m_outputPath, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 4 );
m_browseButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerDir->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );

View File

@ -178,7 +178,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_outputDirectoryName</property>
<property name="name">m_outputPath</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -46,7 +46,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
protected:
wxStaticText* m_outputPathLabel;
wxTextCtrl* m_outputDirectoryName;
wxTextCtrl* m_outputPath;
STD_BITMAP_BUTTON* m_browseButton;
wxBoxSizer* m_optionsSizer;
wxRadioBox* m_plotFormatOpt;