Clean up error messages.
Convert a lot of nags to InfoBar errors/warnings/messages, and some that never should have been exposed to wxFAIL_MSGs.
This commit is contained in:
parent
35a1b8a353
commit
88635ee5b6
|
@ -45,6 +45,7 @@
|
|||
#include <tool/tool_dispatcher.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <wx/display.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/string.h>
|
||||
|
@ -699,6 +700,24 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
|
|||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg )
|
||||
{
|
||||
GetInfoBar()->ShowMessageFor( aErrorMsg, 5000, wxICON_ERROR );
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg )
|
||||
{
|
||||
GetInfoBar()->ShowMessageFor( aWarningMsg, 5000, wxICON_WARNING );
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg )
|
||||
{
|
||||
GetInfoBar()->ShowMessageFor( aMsg, 10000, wxICON_INFORMATION );
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, FILE_HISTORY* aFileHistory )
|
||||
{
|
||||
if( !aFileHistory )
|
||||
|
|
|
@ -111,7 +111,7 @@ void LIB_EDIT_FRAME::ExportPart()
|
|||
|
||||
if( !part )
|
||||
{
|
||||
DisplayError( this, _( "There is no symbol selected to save." ) );
|
||||
ShowInfoBarError( _( "There is no symbol selected to save." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ wxString LIB_EDIT_FRAME::SelectLibraryFromList()
|
|||
|
||||
if( prj.SchSymbolLibTable()->IsEmpty() )
|
||||
{
|
||||
DisplayError( this, _( "No symbol libraries are loaded." ) );
|
||||
ShowInfoBarError( _( "No symbol libraries are loaded." ) );
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ void LIB_EDIT_FRAME::savePartAs()
|
|||
|
||||
if( new_name.IsEmpty() )
|
||||
{
|
||||
DisplayError( this, _( "No symbol name specified. Symbol could not be saved." ) );
|
||||
// This is effectively a cancel. No need to nag the user about it.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,7 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
|
|||
|
||||
if( !aNewFile && ( aLibrary.empty() || !prj.SchSymbolLibTable()->HasLibrary( aLibrary ) ) )
|
||||
{
|
||||
DisplayError( this, _( "No library specified." ) );
|
||||
ShowInfoBarError( _( "No library specified." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( m_frame, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
|
||||
wxFAIL_MSG( "SCH_EDIT_FRAME::CreateNewText() unknown layer type" );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <class_library.h>
|
||||
#include <confirm.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <connection_graph.h>
|
||||
#include <dialogs/dialog_fields_editor_global.h>
|
||||
#include <dialogs/dialog_page_settings.h>
|
||||
|
@ -916,7 +917,7 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( conn->Name( true ).IsEmpty() )
|
||||
{
|
||||
DisplayError( m_frame, _( "Net must be labelled to assign a netclass." ) );
|
||||
m_frame->ShowInfoBarError( _( "Net must be labelled to assign a netclass." ) );
|
||||
highlightNet( m_toolMgr, CLEAR );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -261,8 +261,8 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
|
|||
if( !success )
|
||||
{
|
||||
delete drill_layer;
|
||||
msg.Printf( _( "File %s not found" ), aFullFileName );
|
||||
DisplayError( this, msg );
|
||||
msg.Printf( _( "File %s not found." ), aFullFileName );
|
||||
ShowInfoBarError( msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
|
|||
if( layerId < 0 )
|
||||
{
|
||||
delete drill_layer;
|
||||
DisplayError( this, _( "No room to load file" ) );
|
||||
ShowInfoBarError( _( "No empty layers to load file into." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLa
|
|||
if( m_fp == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Cannot create file \"%s\"" ), GetChars( m_pcb_file_name ) );
|
||||
msg.Printf( _( "Cannot create file \"%s\"" ), m_pcb_file_name );
|
||||
DisplayError( m_gerbview_frame, msg );
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
|
|||
{
|
||||
delete gerber;
|
||||
msg.Printf( _( "File \"%s\" not found" ), GERBER_FullFileName );
|
||||
DisplayError( this, msg, 10 );
|
||||
ShowInfoBarError( msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -343,6 +343,10 @@ public:
|
|||
|
||||
WX_INFOBAR* GetInfoBar() { return m_infoBar; }
|
||||
|
||||
void ShowInfoBarError( const wxString& aErrorMsg );
|
||||
void ShowInfoBarWarning( const wxString& aWarningMsg );
|
||||
void ShowInfoBarMsg( const wxString& aMsg );
|
||||
|
||||
/**
|
||||
* Returns the settings object used in SaveSettings(), and is overloaded in
|
||||
* KICAD_MANAGER_FRAME
|
||||
|
|
|
@ -77,7 +77,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
|
||||
if( GetBoard()->Modules().empty() )
|
||||
{
|
||||
DisplayError( this, _( "Cannot export BOM: there are no footprints in the PCB" ) );
|
||||
ShowInfoBarError( _( "Cannot export BOM: there are no footprints on the PCB." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
|
|||
}
|
||||
catch( std::bad_function_call& )
|
||||
{
|
||||
DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
|
||||
wxFAIL_MSG( "Error running MODULE::RunOnChildren" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ void PCB_GROUP::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFuncti
|
|||
}
|
||||
catch( std::bad_function_call& )
|
||||
{
|
||||
DisplayError( NULL, wxT( "Error running PCB_GROUP::RunOnChildren" ) );
|
||||
wxFAIL_MSG( "Error running PCB_GROUP::RunOnChildren" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,6 +312,6 @@ void PCB_GROUP::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFun
|
|||
}
|
||||
catch( std::bad_function_call& )
|
||||
{
|
||||
DisplayError( NULL, wxT( "Error running PCB_GROUP::RunOnDescendants" ) );
|
||||
wxFAIL_MSG( "Error running PCB_GROUP::RunOnDescendants" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
else
|
||||
{
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
DisplayError( this, _( "No more item to show" ), 10 );
|
||||
m_frame->ShowInfoBarMsg( _( "No more item to show" ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
else
|
||||
{
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
DisplayError( this, _( "No more item to show" ), 10 );
|
||||
m_frame->ShowInfoBarMsg( _( "No more item to show" ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
m_frame->SetStatusText( wxEmptyString );
|
||||
|
||||
msg.Printf( _( "\"%s\" not found" ), searchString );
|
||||
DisplayError( this, msg, 10 );
|
||||
m_frame->ShowInfoBarMsg( msg );
|
||||
|
||||
m_status->SetLabel( _( "No hits" ) );
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow()
|
|||
! m_zonesettings.GetDoNotAllowFootprints() &&
|
||||
! m_zonesettings.GetDoNotAllowCopperPour() )
|
||||
{
|
||||
DisplayError( NULL, _("Tracks, vias, and pads are allowed. The keepout will have no effect." ) );
|
||||
DisplayError( NULL, _("No items are disallowed. The keepout will have no effect." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1745,7 +1745,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( NULL, wxT( "Error: unknown pad type" ) );
|
||||
wxFAIL_MSG( "DIALOG_PAD_PROPERTIES::transferDataToPad: unknown pad type" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1252,7 +1252,8 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( NULL, wxString::Format( "Type Edge Module %d invalid.", PtStruct->Type() ) );
|
||||
wxFAIL_MSG( wxString::Format( "Type Edge Module %d invalid.",
|
||||
PtStruct->Type() ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,9 +435,8 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary( const wxString& aLibName,
|
|||
{
|
||||
if( !writable )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Library \"%s\" is read only, not writable" ),
|
||||
libPath );
|
||||
DisplayError( this, msg );
|
||||
wxString msg = wxString::Format( _( "Library \"%s\" is read only." ), libPath );
|
||||
ShowInfoBarError( msg );
|
||||
return wxEmptyString;
|
||||
}
|
||||
else
|
||||
|
@ -586,8 +585,8 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aC
|
|||
|
||||
if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Library '%s' is read only" ), nickname );
|
||||
DisplayError( this, msg );
|
||||
wxString msg = wxString::Format( _( "Library '%s' is read only." ), nickname );
|
||||
ShowInfoBarError( msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -779,7 +778,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
|
||||
if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
|
||||
{
|
||||
DisplayErrorMessage( this, _( "No board currently open." ) );
|
||||
ShowInfoBarError( _( "No board currently open." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
|
|||
if ( !inductorModule || !errorMessage.IsEmpty() )
|
||||
{
|
||||
if ( !errorMessage.IsEmpty() )
|
||||
DisplayError( &editFrame, errorMessage );
|
||||
editFrame.ShowInfoBarError( errorMessage );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -266,13 +266,13 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
|
|||
|
||||
if( ( ShapeSize.x ) == 0 || ( ShapeSize.y == 0 ) )
|
||||
{
|
||||
DisplayError( &editFrame, _( "Shape has a null size!" ) );
|
||||
editFrame.ShowInfoBarError( _( "Shape has a null size!" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( PolyEdges.size() == 0 )
|
||||
{
|
||||
DisplayError( &editFrame, _( "Shape has no points!" ) );
|
||||
editFrame.ShowInfoBarError( _( "Shape has no points!" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -728,22 +728,22 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
|||
// Cannot place microvias or blind vias if not allowed (obvious)
|
||||
if( ( viaType == VIATYPE::BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
|
||||
{
|
||||
DisplayError( frame(),
|
||||
_( "Blind/buried vias have to be enabled in Board Setup > Design Rules > Constraints." ) );
|
||||
frame()->ShowInfoBarError( _( "Blind/buried vias have to be enabled in "
|
||||
"Board Setup > Design Rules > Constraints." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( ( viaType == VIATYPE::MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
|
||||
{
|
||||
DisplayError( frame(),
|
||||
_( "Microvias have to be enabled in Board Setup > Design Rules > Constraints." ) );
|
||||
frame()->ShowInfoBarError( _( "Microvias have to be enabled in "
|
||||
"Board Setup > Design Rules > Constraints." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Can only place through vias on 2-layer boards
|
||||
if( ( viaType != VIATYPE::THROUGH ) && ( layerCount <= 2 ) )
|
||||
{
|
||||
DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
|
||||
frame()->ShowInfoBarError( _( "Only through vias are allowed on 2 layer boards." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
|||
if( ( viaType == VIATYPE::MICROVIA ) && ( currentLayer > In1_Cu )
|
||||
&& ( currentLayer < layerCount - 2 ) )
|
||||
{
|
||||
DisplayError( frame(), _( "Microvias can be placed only between the outer layers "
|
||||
frame()->ShowInfoBarError( _( "Microvias can only be placed between the outer layers "
|
||||
"(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
|
||||
return false;
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ bool ROUTER_TOOL::prepareInteractive()
|
|||
|
||||
if( !IsCopperLayer( routingLayer ) )
|
||||
{
|
||||
DisplayError( frame(), _( "Tracks on Copper layers only" ) );
|
||||
frame()->ShowInfoBarError( _( "Tracks on Copper layers only" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,15 +59,7 @@ using P_S_C = PCB_SELECTION_CONDITIONS;
|
|||
|
||||
bool CONVERT_TOOL::Init()
|
||||
{
|
||||
m_selectionTool =
|
||||
static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
|
||||
|
||||
if( !m_selectionTool )
|
||||
{
|
||||
DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||
m_frame = getEditFrame<PCB_BASE_FRAME>();
|
||||
|
||||
// Create a context menu and make it available through selection tool
|
||||
|
|
Loading…
Reference in New Issue