Commit f80357cb authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

pcbnew: Show/Hide button for scripting console

parent c7d6dad7
...@@ -89,6 +89,7 @@ protected: ...@@ -89,6 +89,7 @@ protected:
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
// Panel used to let user talk with internal scripting // Panel used to let user talk with internal scripting
wxWindow* m_pythonPanel; wxWindow* m_pythonPanel;
bool m_pythonPanelHidden;
#endif #endif
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
...@@ -1397,6 +1398,12 @@ public: ...@@ -1397,6 +1398,12 @@ public:
// Autoplacement: // Autoplacement:
void AutoPlace( wxCommandEvent& event ); void AutoPlace( wxCommandEvent& event );
/**
* Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console
*/
void ScriptingConsoleEnableDisable( wxCommandEvent& event );
void OnSelectAutoPlaceMode( wxCommandEvent& aEvent ); void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
/** /**
......
...@@ -554,6 +554,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -554,6 +554,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Fast access to the Web Based FreeROUTE advanced router" ), _( "Fast access to the Web Based FreeROUTE advanced router" ),
KiBitmap( web_support_xpm ) ); KiBitmap( web_support_xpm ) );
#ifdef KICAD_SCRIPTING_WXPYTHON
/* Scripting */
AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
_( "&Scripting Console" ),
_( "Show/Hide the Scripting console" ),
KiBitmap( book_xpm ) );
#endif
/* Design Rules menu /* Design Rules menu
*/ */
wxMenu* designRulesMenu = new wxMenu; wxMenu* designRulesMenu = new wxMenu;
......
...@@ -174,7 +174,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -174,7 +174,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool )
#ifdef KICAD_SCRIPTING_WXPYTHON
EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable )
#endif
// Option toolbar // Option toolbar
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, EVT_TOOL( ID_TB_OPTIONS_DRC_OFF,
PCB_EDIT_FRAME::OnSelectOptionToolbar ) PCB_EDIT_FRAME::OnSelectOptionToolbar )
...@@ -410,11 +412,13 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -410,11 +412,13 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
pythonAuiInfo.Caption( wxT( "Python Scripting" ) ); pythonAuiInfo.Caption( wxT( "Python Scripting" ) );
pythonAuiInfo.MinSize( wxSize( 200, 100 ) ); pythonAuiInfo.MinSize( wxSize( 200, 100 ) );
pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) ); pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) );
pythonAuiInfo.Hide();
m_pythonPanel = CreatePythonShellWindow( this ); m_pythonPanel = CreatePythonShellWindow( this );
m_auimgr.AddPane( m_pythonPanel, m_auimgr.AddPane( m_pythonPanel,
pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) ); pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) );
m_pythonPanelHidden = true;
#endif #endif
...@@ -786,6 +790,24 @@ void PCB_EDIT_FRAME::UpdateTitle() ...@@ -786,6 +790,24 @@ void PCB_EDIT_FRAME::UpdateTitle()
SetTitle( title ); SetTitle( title );
} }
#ifdef KICAD_SCRIPTING_WXPYTHON
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
{
if ( m_pythonPanelHidden )
{
m_auimgr.GetPane( m_pythonPanel ).Show();
m_pythonPanelHidden = false;
}
else
{
m_auimgr.GetPane( m_pythonPanel ).Hide();
m_pythonPanelHidden = true;
}
m_auimgr.Update();
}
#endif
void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
{ {
......
...@@ -235,6 +235,7 @@ enum pcbnew_ids ...@@ -235,6 +235,7 @@ enum pcbnew_ids
ID_TOOLBARH_PCB_MODE_MODULE, ID_TOOLBARH_PCB_MODE_MODULE,
ID_TOOLBARH_PCB_MODE_TRACKS, ID_TOOLBARH_PCB_MODE_TRACKS,
ID_TOOLBARH_PCB_FREEROUTE_ACCESS, ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
......
* finish wizard implementation
* cleanup * think about documentation, how to do it
* better build script helpers * toolbar button and menu for scripting console
* Action plugins:
right click hooks,
toolbar hooks,
menu hooks,
* IO plugins
* better footprint wizard (preview in footprint wizard list)
pcb = pcbnew.GetBoard() import pcbnew
m = pcb.m_Modules pcb = pcbnew.GetBoard()
while m: for m in pcb.GetModules():
print m.GetPosition() print m.GetPosition()
p = m.m_Pads for p in m.GetPads()
while p:
print "p=>",p.GetPosition(),p.GetPadName() print "p=>",p.GetPosition(),p.GetPadName()
print p.GetPosition() print p.GetPosition()
p = p.Next()
m = m.Next()
pcb = pcbnew.GetBoard() import pcbnew
m = pcb.m_Modules.item() pcb = pcbnew.GetBoard()
while m: for m in pcb.GetModules():
print m.GetReference(),"(",m.GetValue(),") at ", m.GetPosition() print m.GetReference(),"(",m.GetValue(),") at ", m.GetPosition()
m.SetValue("pepe") for p in m.GetPads()
p = m.m_Pads.item()
while p:
print " pad",p.GetPadName(), "at",p.GetPosition() print " pad",p.GetPadName(), "at",p.GetPosition()
p = p.Next()
m = m.Next()
...@@ -300,6 +300,14 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() ...@@ -300,6 +300,14 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
// Access to the scripting console
#ifdef KICAD_SCRIPTING_WXPYTHON
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString,
KiBitmap( book_xpm ),
_( "Show/Hide the Scripting console" ) );
m_mainToolBar->AddSeparator();
#endif
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_mainToolBar->Realize(); m_mainToolBar->Realize();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment