Commit 688dbe5d authored by jean-pierre charras's avatar jean-pierre charras

Minor cosmetic enhancement, and try to fix an issue with accelerator keys and...

Minor cosmetic enhancement, and try to fix an issue with accelerator keys and the Python scripting console
parent 2ff53e95
...@@ -105,9 +105,7 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME ...@@ -105,9 +105,7 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
protected: protected:
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
// Panel used to let user talk with internal scripting bool m_pythonPanelShow; ///< Visibility flag for Python Console
wxWindow* m_pythonPanel;
bool m_pythonPanelHidden;
#endif #endif
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
...@@ -1524,7 +1522,9 @@ public: ...@@ -1524,7 +1522,9 @@ public:
* Function ScriptingConsoleEnableDisable * Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console * enables or disabled the scripting console
*/ */
void ScriptingConsoleEnableDisable( wxCommandEvent& event ); void ScriptingConsoleEnableDisable( wxCommandEvent& aEvent );
void OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent );
void OnSelectAutoPlaceMode( wxCommandEvent& aEvent ); void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
......
...@@ -534,8 +534,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -534,8 +534,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
#if defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING_WXPYTHON)
AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
_( "&Scripting Console" ), _( "&Scripting Console" ),
_( "Show/Hide the Scripting console" ), _( "Show/Hide the Python Scripting console" ),
KiBitmap( book_xpm ) ); KiBitmap( py_script_xpm ) );
#endif #endif
wxMenu* designRulesMenu = new wxMenu; wxMenu* designRulesMenu = new wxMenu;
......
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
#include <python_scripting.h> #include <python_scripting.h>
// The name of the pane info handling the python console:
#define PYTHONCONSOLE_STRID wxT( "PythonPanel" )
#endif #endif
#include <class_draw_panel_gal.h> #include <class_draw_panel_gal.h>
...@@ -203,6 +205,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -203,6 +205,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
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 #ifdef KICAD_SCRIPTING_WXPYTHON
EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable ) EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
PCB_EDIT_FRAME::OnUpdateScriptingConsoleState )
#endif #endif
// Option toolbar // Option toolbar
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, EVT_TOOL( ID_TB_OPTIONS_DRC_OFF,
...@@ -319,10 +323,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -319,10 +323,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_rotationAngle = 900; m_rotationAngle = 900;
#ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL;
#endif
for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ )
m_Macros[i].m_Record.clear(); m_Macros[i].m_Record.clear();
...@@ -415,7 +415,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -415,7 +415,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
if( m_microWaveToolBar ) // The auxiliary vertical right toolbar (currently microwave tools) if( m_microWaveToolBar ) // The auxiliary vertical right toolbar (currently microwave tools)
m_auimgr.AddPane( m_microWaveToolBar, m_auimgr.AddPane( m_microWaveToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_microWaveToolBar" ) ).Right().Layer( 1 ).Position(1).Hide() ); wxAuiPaneInfo( vert ).Name( wxT( "m_microWaveToolBar" ) ).
Right().Layer( 1 ).Position(1).Hide() );
if( m_drawToolBar ) // The main right vertical toolbar if( m_drawToolBar ) // The main right vertical toolbar
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,
...@@ -448,18 +449,25 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -448,18 +449,25 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
#if defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING_WXPYTHON)
// Add the scripting panel // Add the scripting panel
EDA_PANEINFO pythonAuiInfo; EDA_PANEINFO pythonAuiPane;
pythonAuiInfo.ScriptingToolbarPane(); pythonAuiPane.ScriptingToolbarPane();
pythonAuiInfo.Caption( wxT( "Python Scripting" ) ); pythonAuiPane.Caption( wxT( "Python Scripting" ) );
pythonAuiInfo.MinSize( wxSize( 200, 100 ) ); pythonAuiPane.MinSize( 300, 100 );
pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) ); pythonAuiPane.BestSize( 600, 200 );
pythonAuiInfo.Hide();
// The console is not dockable. Reasons:
m_pythonPanel = CreatePythonShellWindow( this ); // * When docked there is an issue with accelerator keys used in the main menu:
m_auimgr.AddPane( m_pythonPanel, // these keys are not sent to the console, even if it has the focus
pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) ); // * The console is more easy to move, resize, ... if it is not dockable
pythonAuiPane.Float().Dockable( false );
m_pythonPanelHidden = true;
pythonAuiPane.Hide();
m_pythonPanelShow = false;
wxWindow *pythonPanel = CreatePythonShellWindow( this );
m_auimgr.AddPane( pythonPanel,
pythonAuiPane.Name( PYTHONCONSOLE_STRID ).Bottom().Layer(9) );
#endif #endif
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
...@@ -1093,16 +1101,8 @@ void PCB_EDIT_FRAME::UpdateTitle() ...@@ -1093,16 +1101,8 @@ void PCB_EDIT_FRAME::UpdateTitle()
#if defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING_WXPYTHON)
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
{ {
if ( m_pythonPanelHidden ) m_pythonPanelShow = ! m_pythonPanelShow;
{ m_auimgr.GetPane( PYTHONCONSOLE_STRID ).Show( m_pythonPanelShow );
m_auimgr.GetPane( m_pythonPanel ).Show();
m_pythonPanelHidden = false;
}
else
{
m_auimgr.GetPane( m_pythonPanel ).Hide();
m_pythonPanelHidden = true;
}
m_auimgr.Update(); m_auimgr.Update();
......
...@@ -307,16 +307,16 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() ...@@ -307,16 +307,16 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
KiBitmap( web_support_xpm ), KiBitmap( web_support_xpm ),
_( "Fast access to the Web Based FreeROUTE advanced router" ) ); _( "Fast access to the Web Based FreeROUTE advanced router" ) );
m_mainToolBar->AddSeparator();
// Access to the scripting console // Access to the scripting console
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString, m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString,
KiBitmap( py_script_xpm ), KiBitmap( py_script_xpm ),
_( "Show/Hide the Scripting console" ) ); _( "Show/Hide the Python Scripting console" ),
wxITEM_CHECK );
m_mainToolBar->AddSeparator();
#endif #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();
} }
......
...@@ -109,6 +109,12 @@ void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ) ...@@ -109,6 +109,12 @@ void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
m_SelLayerBox->SetLayerSelection( GetActiveLayer() ); m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
} }
#ifdef KICAD_SCRIPTING_WXPYTHON
void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_pythonPanelShow );
}
#endif
void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
{ {
......
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