footprint wizard python plugins management: Fix a memory leak. Remove useless and outdated code, and add a minor enhancement.
Make a string translatable in a pcbnew info dialog.
This commit is contained in:
parent
53b8a8ca96
commit
ea6b03cd5f
|
@ -699,17 +699,17 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
|||
{
|
||||
case INCHES:
|
||||
absformatter = wxT( "X %.6f Y %.6f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
absformatter = wxT( "X %.6f Y %.6f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
|
||||
locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
absformatter = wxT( "X %f Y %f" );
|
||||
locformatter = wxT( "dx %f dy %f dist %f" );
|
||||
locformatter = wxT( "dx %f dy %f dist %f" );
|
||||
break;
|
||||
|
||||
case DEGREES:
|
||||
|
|
|
@ -34,12 +34,13 @@
|
|||
#include <dialog_footprint_wizard_list.h>
|
||||
#include <class_footprint_wizard.h>
|
||||
|
||||
#define ROW_NAME 0
|
||||
#define ROW_DESCR 1
|
||||
|
||||
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
||||
: DIALOG_FOOTPRINT_WIZARD_LIST_BASE( aParent )
|
||||
{
|
||||
SetFocus();
|
||||
int n_wizards = FOOTPRINT_WIZARDS::GetSize();
|
||||
|
||||
// Current wizard selection, empty or first
|
||||
|
@ -50,8 +51,6 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
|||
|
||||
// Choose selection mode and insert the needed rows
|
||||
|
||||
m_footprintWizardsGrid->SetColSize( 0, 0 ); // hide the preview for now
|
||||
|
||||
m_footprintWizardsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
|
||||
m_footprintWizardsGrid->InsertRows( 0, n_wizards, true );
|
||||
|
||||
|
@ -63,8 +62,8 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
|||
wxString description = wizard->GetDescription();
|
||||
wxString image = wizard->GetImage();
|
||||
|
||||
m_footprintWizardsGrid->SetCellValue( i, 1, name );
|
||||
m_footprintWizardsGrid->SetCellValue( i, 2, description );
|
||||
m_footprintWizardsGrid->SetCellValue( i, ROW_NAME, name );
|
||||
m_footprintWizardsGrid->SetCellValue( i, ROW_DESCR, description );
|
||||
|
||||
}
|
||||
|
||||
|
@ -72,6 +71,8 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
|||
m_footprintWizardsGrid->ClearSelection();
|
||||
m_footprintWizardsGrid->SelectRow( 0, false );
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Center();
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,15 +88,3 @@ FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard()
|
|||
{
|
||||
return m_FootprintWizard;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( wxID_CANCEL );
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="minimum_size">400,200</property>
|
||||
<property name="name">DIALOG_FOOTPRINT_WIZARD_LIST_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">404,200</property>
|
||||
<property name="size">501,273</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Footprint Wizards</property>
|
||||
|
@ -121,10 +121,10 @@
|
|||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="col_label_size">20</property>
|
||||
<property name="col_label_values">"Preview" "Name" "Description"</property>
|
||||
<property name="col_label_values">"Name" "Description"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
|
||||
<property name="cols">3</property>
|
||||
<property name="column_sizes">80,80,325</property>
|
||||
<property name="cols">2</property>
|
||||
<property name="column_sizes">160,325</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
|
@ -275,7 +275,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline1</property>
|
||||
<property name="name">m_staticline</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -334,11 +334,11 @@
|
|||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick">OnCancelClick</event>
|
||||
<event name="OnCancelButtonClick"></event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
<event name="OnOKButtonClick">OnOpenButtonClick</event>
|
||||
<event name="OnOKButtonClick"></event>
|
||||
<event name="OnSaveButtonClick"></event>
|
||||
<event name="OnYesButtonClick"></event>
|
||||
</object>
|
||||
|
|
|
@ -40,8 +40,6 @@ public:
|
|||
|
||||
private:
|
||||
void OnCellWizardClick( wxGridEvent& event );
|
||||
void OnOpenButtonClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
#endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_
|
||||
|
|
|
@ -19,22 +19,20 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
m_footprintWizardsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_footprintWizardsGrid->CreateGrid( 0, 3 );
|
||||
m_footprintWizardsGrid->CreateGrid( 0, 2 );
|
||||
m_footprintWizardsGrid->EnableEditing( false );
|
||||
m_footprintWizardsGrid->EnableGridLines( true );
|
||||
m_footprintWizardsGrid->EnableDragGridSize( false );
|
||||
m_footprintWizardsGrid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_footprintWizardsGrid->SetColSize( 0, 80 );
|
||||
m_footprintWizardsGrid->SetColSize( 1, 80 );
|
||||
m_footprintWizardsGrid->SetColSize( 2, 325 );
|
||||
m_footprintWizardsGrid->SetColSize( 0, 160 );
|
||||
m_footprintWizardsGrid->SetColSize( 1, 325 );
|
||||
m_footprintWizardsGrid->EnableDragColMove( false );
|
||||
m_footprintWizardsGrid->EnableDragColSize( true );
|
||||
m_footprintWizardsGrid->SetColLabelSize( 20 );
|
||||
m_footprintWizardsGrid->SetColLabelValue( 0, _("Preview") );
|
||||
m_footprintWizardsGrid->SetColLabelValue( 1, _("Name") );
|
||||
m_footprintWizardsGrid->SetColLabelValue( 2, _("Description") );
|
||||
m_footprintWizardsGrid->SetColLabelValue( 0, _("Name") );
|
||||
m_footprintWizardsGrid->SetColLabelValue( 1, _("Description") );
|
||||
m_footprintWizardsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
|
||||
// Rows
|
||||
|
@ -51,8 +49,8 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
|
||||
bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
|
@ -71,15 +69,11 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
|
||||
// Connect Events
|
||||
m_footprintWizardsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_footprintWizardsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -37,20 +37,18 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
|
|||
|
||||
protected:
|
||||
wxGrid* m_footprintWizardsGrid;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticLine* m_staticline;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCellWizardClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOpenButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Wizards"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 404,200 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Wizards"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,273 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_FOOTPRINT_WIZARD_LIST_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
#include <dialogs/dialog_footprint_wizard_list.h>
|
||||
#include <base_units.h>
|
||||
|
||||
#define NEXT_PART 1
|
||||
#define NEW_PART 0
|
||||
#define PREVIOUS_PART -1
|
||||
|
||||
|
||||
void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -154,13 +150,12 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint()
|
|||
|
||||
void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
|
||||
{
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard =
|
||||
new DIALOG_FOOTPRINT_WIZARD_LIST( this );
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST wizardSelector( this );
|
||||
|
||||
if( selectWizard->ShowModal() != wxID_OK )
|
||||
if( wizardSelector.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
FOOTPRINT_WIZARD* footprintWizard = selectWizard->GetWizard();
|
||||
FOOTPRINT_WIZARD* footprintWizard = wizardSelector.GetWizard();
|
||||
|
||||
if( footprintWizard )
|
||||
{
|
||||
|
@ -169,8 +164,8 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
|
|||
}
|
||||
else
|
||||
{
|
||||
m_wizardName = wxT( "" );
|
||||
m_wizardDescription = wxT( "" );
|
||||
m_wizardName.Empty();
|
||||
m_wizardDescription.Empty();
|
||||
}
|
||||
|
||||
ReloadFootprint();
|
||||
|
@ -207,7 +202,7 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
|
|||
wxArrayString arr;
|
||||
wxArrayString ptList = footprintWizard->GetParameterTypes( page );
|
||||
|
||||
for( int i = 0; i<n; i++ )
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
wxString value = m_parameterGrid->GetCellValue( i, 1 );
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file modview_frame.cpp
|
||||
* @file footprint_wizard_frame.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
@ -40,7 +40,6 @@
|
|||
#include <class_module.h>
|
||||
#include <module_editor_frame.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include "footprint_wizard_frame.h"
|
||||
#include <footprint_info.h>
|
||||
|
@ -93,26 +92,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/*
|
||||
* This emulates the zoom menu entries found in the other KiCad applications.
|
||||
* The library viewer does not have any menus so add an accelerator table to
|
||||
* the main frame.
|
||||
*/
|
||||
static wxAcceleratorEntry accels[] =
|
||||
{
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET )
|
||||
};
|
||||
|
||||
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
|
||||
|
||||
#define EXTRA_BORDER_SIZE 2
|
||||
|
||||
|
||||
#define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
|
||||
|
||||
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
||||
|
@ -127,8 +106,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|||
if( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL )
|
||||
SetModal( true );
|
||||
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
||||
m_configPath = wxT( "FootprintWizard" );
|
||||
m_showAxis = true; // true to draw axis.
|
||||
|
||||
|
@ -176,9 +153,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|||
|
||||
DisplayWizardInfos();
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->SetAcceleratorTable( table );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
EDA_PANEINFO horiztb;
|
||||
|
@ -230,7 +204,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|||
|
||||
Show( true );
|
||||
|
||||
this->SelectFootprintWizard();
|
||||
SelectFootprintWizard();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -247,6 +247,7 @@ static bool scriptingSetup()
|
|||
// [KICAD_PATH]/scripting/plugins
|
||||
// Add this default search path:
|
||||
path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" );
|
||||
|
||||
#elif defined( __WXMAC__ )
|
||||
// User plugin folder is ~/Library/Application Support/kicad/scripting/plugins
|
||||
path_frag = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" );
|
||||
|
@ -275,6 +276,7 @@ static bool scriptingSetup()
|
|||
|
||||
// set $PYTHONPATH
|
||||
wxSetEnv( "PYTHONPATH", pypath );
|
||||
|
||||
#else
|
||||
// Add this default search path:
|
||||
path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" );
|
||||
|
@ -317,16 +319,17 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
|||
|
||||
if( !FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ) )
|
||||
{
|
||||
DisplayInfoMessage( NULL, wxT(
|
||||
DisplayInfoMessage( NULL, _(
|
||||
"You have run Pcbnew for the first time using the "
|
||||
"new footprint library table method for finding "
|
||||
"footprints. Pcbnew has either copied the default "
|
||||
"new footprint library table method for finding footprints.\n"
|
||||
"Pcbnew has either copied the default "
|
||||
"table or created an empty table in the kicad configuration "
|
||||
"folder. You must first configure the library "
|
||||
"folder.\n"
|
||||
"You must first configure the library "
|
||||
"table to include all footprint libraries not "
|
||||
"included with KiCad. See the \"Footprint Library "
|
||||
"Table\" section of the CvPcb or Pcbnew documentation for "
|
||||
"more information." ) );
|
||||
"included with KiCad.\n"
|
||||
"See the \"Footprint Library Table\" section of"
|
||||
"the CvPcb or Pcbnew documentation for more information." ) );
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
|
|
Loading…
Reference in New Issue