Dialog footprint wizard selector: better dialog (displays the wizard search path list) and allows double click to select a wizard
This commit is contained in:
parent
56f8e10eb4
commit
76a82dcd3b
|
@ -101,13 +101,16 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
|||
}
|
||||
|
||||
|
||||
wxString not_loaded_wiz_names;
|
||||
pcbnewGetUnloadableScriptNames( not_loaded_wiz_names );
|
||||
|
||||
if( not_loaded_wiz_names.IsEmpty() )
|
||||
m_bsizerNotLoaded->Show( false );
|
||||
// Display info about scripts: Search paths
|
||||
wxString message;
|
||||
pcbnewGetScriptsSearchPaths( message );
|
||||
m_tcSearchPaths->SetValue( message );
|
||||
// Display info about scripts: unloadable scripts (due to syntax errors is python source)
|
||||
pcbnewGetUnloadableScriptNames( message );
|
||||
if( message.IsEmpty() )
|
||||
m_tcNotLoaded->SetValue( _( "All footprint generator scripts were loaded" ) );
|
||||
else
|
||||
m_tcNotLoaded->SetValue( not_loaded_wiz_names );
|
||||
m_tcNotLoaded->SetValue( message );
|
||||
|
||||
Center();
|
||||
}
|
||||
|
@ -129,6 +132,14 @@ void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellFpGeneratorClick( wxGridEvent& event )
|
|||
int click_row = event.GetRow();
|
||||
m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( click_row );
|
||||
m_footprintGeneratorsGrid->SelectRow( event.GetRow(), false );
|
||||
// Move the grid cursor, mainly for aesthetic reasons:
|
||||
m_footprintGeneratorsGrid->GoToCell( event.GetRow(), FP_GEN_ROW_NUMBER );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellFpGeneratorDoubleClick( wxGridEvent& event )
|
||||
{
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
|
||||
private:
|
||||
void OnCellFpGeneratorClick( wxGridEvent& event ) override;
|
||||
void OnCellFpGeneratorDoubleClick( wxGridEvent& event ) override;
|
||||
};
|
||||
|
||||
#endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_
|
||||
|
|
|
@ -16,7 +16,12 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_footprintGeneratorsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelGenerators = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerpanelGen;
|
||||
bSizerpanelGen = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_footprintGeneratorsGrid = new wxGrid( m_panelGenerators, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Grid
|
||||
m_footprintGeneratorsGrid->CreateGrid( 0, 3 );
|
||||
|
@ -26,8 +31,9 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
m_footprintGeneratorsGrid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_footprintGeneratorsGrid->SetColSize( 0, 160 );
|
||||
m_footprintGeneratorsGrid->SetColSize( 1, 325 );
|
||||
m_footprintGeneratorsGrid->SetColSize( 0, 40 );
|
||||
m_footprintGeneratorsGrid->SetColSize( 1, 160 );
|
||||
m_footprintGeneratorsGrid->SetColSize( 2, 325 );
|
||||
m_footprintGeneratorsGrid->EnableDragColMove( false );
|
||||
m_footprintGeneratorsGrid->EnableDragColSize( true );
|
||||
m_footprintGeneratorsGrid->SetColLabelSize( 20 );
|
||||
|
@ -48,21 +54,42 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
m_footprintGeneratorsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_footprintGeneratorsGrid->SetMinSize( wxSize( 485,120 ) );
|
||||
|
||||
bSizerMain->Add( m_footprintGeneratorsGrid, 1, wxALL|wxEXPAND, 5 );
|
||||
bSizerpanelGen->Add( m_footprintGeneratorsGrid, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_bsizerNotLoaded = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Not loadable:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelGenerators->SetSizer( bSizerpanelGen );
|
||||
m_panelGenerators->Layout();
|
||||
bSizerpanelGen->Fit( m_panelGenerators );
|
||||
m_notebook->AddPage( m_panelGenerators, _("Available footprint generators"), true );
|
||||
m_panelInfo = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_bsizerPanelInfo;
|
||||
m_bsizerPanelInfo = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( m_panelInfo, wxID_ANY, _("Search paths:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
m_bsizerNotLoaded->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
m_bsizerPanelInfo->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_tcNotLoaded = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_tcSearchPaths = new wxTextCtrl( m_panelInfo, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_tcSearchPaths->SetMinSize( wxSize( -1,60 ) );
|
||||
|
||||
m_bsizerPanelInfo->Add( m_tcSearchPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticText11 = new wxStaticText( m_panelInfo, wxID_ANY, _("Not loadable python scripts:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
m_bsizerPanelInfo->Add( m_staticText11, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_tcNotLoaded = new wxTextCtrl( m_panelInfo, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_tcNotLoaded->SetMinSize( wxSize( -1,60 ) );
|
||||
|
||||
m_bsizerNotLoaded->Add( m_tcNotLoaded, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
m_bsizerPanelInfo->Add( m_tcNotLoaded, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( m_bsizerNotLoaded, 0, wxEXPAND, 5 );
|
||||
m_panelInfo->SetSizer( m_bsizerPanelInfo );
|
||||
m_panelInfo->Layout();
|
||||
m_bsizerPanelInfo->Fit( m_panelInfo );
|
||||
m_notebook->AddPage( m_panelInfo, _("Messages"), false );
|
||||
|
||||
bSizerMain->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
||||
|
@ -84,11 +111,13 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
|||
|
||||
// Connect Events
|
||||
m_footprintGeneratorsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorClick ), NULL, this );
|
||||
m_footprintGeneratorsGrid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorDoubleClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_footprintGeneratorsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorClick ), NULL, this );
|
||||
m_footprintGeneratorsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorDoubleClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,171 @@
|
|||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxNotebook" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmapsize"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_notebook</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnNotebookPageChanged"></event>
|
||||
<event name="OnNotebookPageChanging"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="notebookpage" expanded="1">
|
||||
<property name="bitmap"></property>
|
||||
<property name="label">Available footprint generators</property>
|
||||
<property name="select">1</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelGenerators</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerpanelGen</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
|
@ -124,7 +289,7 @@
|
|||
<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">160,325</property>
|
||||
<property name="column_sizes">40,160,325</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
|
@ -184,7 +349,7 @@
|
|||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnGridCellChange"></event>
|
||||
<event name="OnGridCellLeftClick">OnCellFpGeneratorClick</event>
|
||||
<event name="OnGridCellLeftDClick"></event>
|
||||
<event name="OnGridCellLeftDClick">OnCellFpGeneratorDoubleClick</event>
|
||||
<event name="OnGridCellRightClick"></event>
|
||||
<event name="OnGridCellRightDClick"></event>
|
||||
<event name="OnGridCmdCellChange"></event>
|
||||
|
@ -236,15 +401,92 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="notebookpage" expanded="1">
|
||||
<property name="bitmap"></property>
|
||||
<property name="label">Messages</property>
|
||||
<property name="select">0</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelInfo</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_bsizerNotLoaded</property>
|
||||
<property name="name">m_bsizerPanelInfo</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
|
@ -277,7 +519,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Not loadable:</property>
|
||||
<property name="label">Search paths:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -331,7 +573,181 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,60</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_tcSearchPaths</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_MULTILINE|wxTE_READONLY</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Not loadable python scripts:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText11</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -421,6 +837,9 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
|
|
|
@ -20,9 +20,14 @@ class DIALOG_SHIM;
|
|||
#include <wx/font.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
@ -38,9 +43,13 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook;
|
||||
wxPanel* m_panelGenerators;
|
||||
wxGrid* m_footprintGeneratorsGrid;
|
||||
wxBoxSizer* m_bsizerNotLoaded;
|
||||
wxPanel* m_panelInfo;
|
||||
wxStaticText* m_staticText1;
|
||||
wxTextCtrl* m_tcSearchPaths;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* m_tcNotLoaded;
|
||||
wxStaticLine* m_staticline;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
|
@ -49,6 +58,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCellFpGeneratorClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnCellFpGeneratorDoubleClick( wxGridEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -201,8 +201,15 @@ bool pcbnewInitPythonScripting( const char * aUserScriptingPath )
|
|||
}
|
||||
|
||||
|
||||
void pcbnewGetUnloadableScriptNames( wxString& aNames )
|
||||
/**
|
||||
* this function runs a python method from pcbnew module, which returns a string
|
||||
* @param aMethodName is the name of the method (like "pcbnew.myfunction" )
|
||||
* @param aNames will contains the returned string
|
||||
*/
|
||||
static void pcbnewRunPythonMethodWithReturnedString( const char* aMethodName, wxString& aNames )
|
||||
{
|
||||
aNames.Clear();
|
||||
|
||||
PyLOCK lock;
|
||||
PyErr_Clear();
|
||||
|
||||
|
@ -211,10 +218,13 @@ void pcbnewGetUnloadableScriptNames( wxString& aNames )
|
|||
PyDict_SetItemString( globals, "pcbnew", builtins );
|
||||
Py_DECREF( builtins );
|
||||
|
||||
// Execute the code and get the returned data
|
||||
// Build the python code
|
||||
char cmd[1024];
|
||||
snprintf( cmd, sizeof(cmd), "result = %s()", aMethodName );
|
||||
|
||||
// Execute the python code and get the returned data
|
||||
PyObject* localDict = PyDict_New();
|
||||
PyObject* pobj = PyRun_String( "result = pcbnew.GetUnLoadableWizards()",
|
||||
Py_file_input, globals, localDict);
|
||||
PyObject* pobj = PyRun_String( cmd, Py_file_input, globals, localDict);
|
||||
Py_DECREF( globals );
|
||||
|
||||
if( pobj )
|
||||
|
@ -232,6 +242,18 @@ void pcbnewGetUnloadableScriptNames( wxString& aNames )
|
|||
}
|
||||
|
||||
|
||||
void pcbnewGetUnloadableScriptNames( wxString& aNames )
|
||||
{
|
||||
pcbnewRunPythonMethodWithReturnedString( "pcbnew.GetUnLoadableWizards", aNames );
|
||||
}
|
||||
|
||||
|
||||
void pcbnewGetScriptsSearchPaths( wxString& aNames )
|
||||
{
|
||||
pcbnewRunPythonMethodWithReturnedString( "pcbnew.GetWizardsSearchPaths", aNames );
|
||||
}
|
||||
|
||||
|
||||
void pcbnewFinishPythonScripting()
|
||||
{
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
|
|
|
@ -43,14 +43,27 @@
|
|||
#include <wx/string.h>
|
||||
#include <wx/arrstr.h>
|
||||
|
||||
/* Function pcbnewInitPythonScripting
|
||||
/**
|
||||
* Function pcbnewInitPythonScripting
|
||||
* Initializes the Python engine inside pcbnew
|
||||
*/
|
||||
|
||||
bool pcbnewInitPythonScripting( const char * aUserScriptingPath );
|
||||
void pcbnewFinishPythonScripting();
|
||||
|
||||
/**
|
||||
* Function pcbnewGetUnloadableScriptNames
|
||||
* collects the list of python scripts which could not be loaded because
|
||||
* some error (synthax error) happened
|
||||
* @param aNames is a wxString which will contain the filenames (separated by '\n')
|
||||
*/
|
||||
void pcbnewGetUnloadableScriptNames( wxString& aNames );
|
||||
|
||||
/**
|
||||
* Function pcbnewGetScriptsSearchPaths
|
||||
* collects the list of paths where python scripts are searched
|
||||
* @param aNames is a wxString which will contain the paths (separated by '\n')
|
||||
*/
|
||||
void pcbnewGetScriptsSearchPaths( wxString& aNames );
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
|
||||
void RedirectStdio();
|
||||
|
|
|
@ -59,12 +59,23 @@ KICAD_PLUGINS={} # the list of loaded footprint wizards
|
|||
"""
|
||||
NOT_LOADED_WIZARDS=""
|
||||
|
||||
""" the list of paths used to search python scripts.
|
||||
Stored here to be displayed on request in Pcbnew
|
||||
paths are separated by '\n'
|
||||
"""
|
||||
PLUGIN_DIRECTORIES_SEARCH=""
|
||||
|
||||
|
||||
def GetUnLoadableWizards():
|
||||
global NOT_LOADED_WIZARDS
|
||||
return NOT_LOADED_WIZARDS
|
||||
|
||||
|
||||
def GetWizardsSearchPaths():
|
||||
global PLUGIN_DIRECTORIES_SEARCH
|
||||
return PLUGIN_DIRECTORIES_SEARCH
|
||||
|
||||
|
||||
def ReloadPlugin(name):
|
||||
if not KICAD_PLUGINS.has_key(name):
|
||||
return False
|
||||
|
@ -144,6 +155,13 @@ def LoadPlugins(bundlepath=None):
|
|||
plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/')
|
||||
plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/plugins/')
|
||||
|
||||
global PLUGIN_DIRECTORIES_SEARCH
|
||||
PLUGIN_DIRECTORIES_SEARCH=""
|
||||
for plugins_dir in plugin_directories: # save search path list for later use
|
||||
if PLUGIN_DIRECTORIES_SEARCH != "" :
|
||||
PLUGIN_DIRECTORIES_SEARCH += "\n"
|
||||
PLUGIN_DIRECTORIES_SEARCH += plugins_dir
|
||||
|
||||
failed_wizards_list=""
|
||||
|
||||
for plugins_dir in plugin_directories:
|
||||
|
@ -176,7 +194,7 @@ def LoadPlugins(bundlepath=None):
|
|||
pass
|
||||
|
||||
global NOT_LOADED_WIZARDS
|
||||
NOT_LOADED_WIZARDS = failed_wizards_list
|
||||
NOT_LOADED_WIZARDS = failed_wizards_list # save not loaded wizards names list for later use
|
||||
|
||||
|
||||
class KiCadPlugin:
|
||||
|
|
Loading…
Reference in New Issue