Moving checking the rules up a level so we can properly exit DRC dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/5778
This commit is contained in:
parent
3e366a901f
commit
5ad76a237e
|
@ -40,6 +40,7 @@
|
||||||
#include <widgets/ui_common.h>
|
#include <widgets/ui_common.h>
|
||||||
#include <widgets/progress_reporter.h>
|
#include <widgets/progress_reporter.h>
|
||||||
#include <drc/drc_engine.h>
|
#include <drc/drc_engine.h>
|
||||||
|
#include <dialogs/panel_setup_rules_base.h>
|
||||||
#include <tools/drc_tool.h>
|
#include <tools/drc_tool.h>
|
||||||
#include <kiplatform/ui.h>
|
#include <kiplatform/ui.h>
|
||||||
|
|
||||||
|
@ -199,12 +200,30 @@ void DIALOG_DRC::syncCheckboxes()
|
||||||
|
|
||||||
void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
DRC_TOOL* drcTool = m_parentFrame->GetToolManager()->GetTool<DRC_TOOL>();
|
DRC_TOOL* drcTool = m_brdEditor->GetToolManager()->GetTool<DRC_TOOL>();
|
||||||
bool testTracksAgainstZones = m_cbReportTracksToZonesErrors->GetValue();
|
bool testTracksAgainstZones = m_cbReportTracksToZonesErrors->GetValue();
|
||||||
bool refillZones = m_cbRefillZones->GetValue();
|
bool refillZones = m_cbRefillZones->GetValue();
|
||||||
bool reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
|
bool reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
|
||||||
bool testFootprints = m_cbTestFootprints->GetValue();
|
bool testFootprints = m_cbTestFootprints->GetValue();
|
||||||
|
|
||||||
|
// This is not the time to have stale or buggy rules. Ensure they're up-to-date
|
||||||
|
// and that they at least parse.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
drcTool->GetDRCEngine()->InitEngine( m_parentFrame->Prj().AbsolutePath( "drc-rules" ) );
|
||||||
|
}
|
||||||
|
catch( PARSE_ERROR& pe )
|
||||||
|
{
|
||||||
|
// Shouldn't be necessary, but we get into all kinds of wxWidgets window ordering
|
||||||
|
// issues (on at least OSX) if we don't.
|
||||||
|
drcTool->DestroyDRCDialog();
|
||||||
|
|
||||||
|
m_brdEditor->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR,
|
||||||
|
pe.lineNumber, pe.byteIndex );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_drcRun = false;
|
m_drcRun = false;
|
||||||
m_footprintTestsRun = false;
|
m_footprintTestsRun = false;
|
||||||
m_cancelled = false;
|
m_cancelled = false;
|
||||||
|
|
|
@ -33,10 +33,8 @@
|
||||||
#include <dialog_drc.h>
|
#include <dialog_drc.h>
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
#include <widgets/progress_reporter.h>
|
#include <widgets/progress_reporter.h>
|
||||||
#include <drc/drc_engine.h>
|
|
||||||
#include <drc/drc_results_provider.h>
|
#include <drc/drc_results_provider.h>
|
||||||
#include <netlist_reader/pcb_netlist.h>
|
#include <netlist_reader/pcb_netlist.h>
|
||||||
#include <dialogs/panel_setup_rules_base.h>
|
|
||||||
|
|
||||||
DRC_TOOL::DRC_TOOL() :
|
DRC_TOOL::DRC_TOOL() :
|
||||||
PCB_TOOL_BASE( "pcbnew.DRCTool" ),
|
PCB_TOOL_BASE( "pcbnew.DRCTool" ),
|
||||||
|
@ -143,24 +141,6 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksA
|
||||||
NETLIST netlist;
|
NETLIST netlist;
|
||||||
wxWindowDisabler disabler( /* disable everything except: */ m_drcDialog );
|
wxWindowDisabler disabler( /* disable everything except: */ m_drcDialog );
|
||||||
|
|
||||||
// This is not the time to have stale or buggy rules. Ensure they're up-to-date
|
|
||||||
// and that they at least parse.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_drcEngine->InitEngine( m_editFrame->Prj().AbsolutePath( "drc-rules" ) );
|
|
||||||
}
|
|
||||||
catch( PARSE_ERROR& pe )
|
|
||||||
{
|
|
||||||
// Shouldn't be necessary, but we get into all kinds of wxWidgets window ordering
|
|
||||||
// issues (on at least OSX) if we don't.
|
|
||||||
DestroyDRCDialog();
|
|
||||||
|
|
||||||
m_editFrame->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR,
|
|
||||||
pe.lineNumber, pe.byteIndex );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_drcRunning = true;
|
m_drcRunning = true;
|
||||||
|
|
||||||
if( aRefillZones )
|
if( aRefillZones )
|
||||||
|
|
|
@ -110,6 +110,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void DestroyDRCDialog();
|
void DestroyDRCDialog();
|
||||||
|
|
||||||
|
std::shared_ptr<DRC_ENGINE> GetDRCEngine() { return m_drcEngine; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the DRC tests.
|
* Run the DRC tests.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue