Don't nag the user about file extensions. Just fix it.
Fixes https://gitlab.com/kicad/code/kicad/issues/8067
This commit is contained in:
parent
7a4f5be37e
commit
2fc34de1be
|
@ -249,8 +249,6 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
||||||
|
|
||||||
// Ensure filepath is not empty. (In normal use will be caught by grid validators,
|
// Ensure filepath is not empty. (In normal use will be caught by grid validators,
|
||||||
// but unedited data from existing files can be bad.)
|
// but unedited data from existing files can be bad.)
|
||||||
|
|
||||||
// @todo What happens when there are invalid file name characters?
|
|
||||||
if( newRelativeNativeFilename.IsEmpty() )
|
if( newRelativeNativeFilename.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "A sheet must have a valid file name." ) );
|
wxMessageBox( _( "A sheet must have a valid file name." ) );
|
||||||
|
@ -614,16 +612,6 @@ void DIALOG_SHEET_PROPERTIES::OnGridCellChanging( wxGridEvent& event )
|
||||||
wxMessageBox( _( "A sheet must have a file specified." ) );
|
wxMessageBox( _( "A sheet must have a file specified." ) );
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFileName fn = textControl->GetValue();
|
|
||||||
|
|
||||||
if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Sheet filename must have a '.kicad_sch' extension." ) );
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( success && control && control->GetValidator() )
|
if( success && control && control->GetValidator() )
|
||||||
|
|
|
@ -471,7 +471,24 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FDC_VALUE:
|
case FDC_VALUE:
|
||||||
field.SetText( aValue );
|
{
|
||||||
|
wxString value( aValue );
|
||||||
|
|
||||||
|
if( m_parentType == SCH_SHEET_T && aRow == SHEETFILENAME )
|
||||||
|
{
|
||||||
|
wxFileName fn( value );
|
||||||
|
|
||||||
|
// It's annoying to throw up nag dialogs when the extension isn't right. Just
|
||||||
|
// fix it.
|
||||||
|
if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
|
||||||
|
{
|
||||||
|
fn.SetExt( KiCadSchematicFileExtension );
|
||||||
|
value = fn.GetFullPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
field.SetText( value );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FDC_SHOWN:
|
case FDC_SHOWN:
|
||||||
|
|
|
@ -87,7 +87,7 @@ SCH_FIELD_VALIDATOR::SCH_FIELD_VALIDATOR( const SCH_FIELD_VALIDATOR& aValidator
|
||||||
bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
|
bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
|
||||||
{
|
{
|
||||||
// If window is disabled, simply return
|
// If window is disabled, simply return
|
||||||
if( !m_validatorWindow->IsEnabled() || !m_validatorWindow->IsShown() )
|
if( !m_validatorWindow->IsEnabled() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
wxTextEntry * const text = GetTextEntry();
|
wxTextEntry * const text = GetTextEntry();
|
||||||
|
|
Loading…
Reference in New Issue