diff --git a/pcbnew/scripting/python_console_frame.h b/pcbnew/scripting/python_console_frame.h index 8cb9a32ddc..042e6b07c2 100644 --- a/pcbnew/scripting/python_console_frame.h +++ b/pcbnew/scripting/python_console_frame.h @@ -38,27 +38,31 @@ * Class PYTHON_CONSOLE_FRAME is a simple derived class from wxMiniFrame * to handle the scripting python console */ +#define PC_STYLE wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER + class PYTHON_CONSOLE_FRAME : public wxMiniFrame { private: static wxSize m_frameSize; ///< The size of the frame, stored during a session static wxPoint m_framePos; ///< The position of the frame, stored during a session + wxWindow * m_pythonPanel; ///< the window managed by the python shell public: PYTHON_CONSOLE_FRAME( wxWindow* aParent, const wxString& aFramenameId ) : wxMiniFrame( aParent, wxID_ANY, wxT("Python console"), wxDefaultPosition, wxDefaultSize, - wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER|wxFRAME_FLOAT_ON_PARENT, - aFramenameId ) + PC_STYLE | wxFRAME_FLOAT_ON_PARENT, aFramenameId ) { wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + SetSizer( sizer ); + SetMinSize( wxSize( 500, 200 ) ); #if defined(KICAD_SCRIPTING_WXPYTHON) - wxWindow * pythonPanel = CreatePythonShellWindow( this ); - sizer->Add( pythonPanel, 1, wxEXPAND | wxALL, 5 ); + m_pythonPanel = CreatePythonShellWindow( this ); + sizer->Add( m_pythonPanel, 1, wxEXPAND, 0 ); +#else + m_pythonPanel = NULL; #endif - SetSizer( sizer ); - SetMinSize( wxSize( 400, 200 ) ); if( m_frameSize.x <= 0 || m_frameSize.y <= 0 ) SetSize( wxSize( 600, 300 ) ); @@ -73,13 +77,15 @@ public: Layout(); // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); + this->Connect( wxEVT_CLOSE_WINDOW, + wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); } ~PYTHON_CONSOLE_FRAME() { // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); + this->Disconnect( wxEVT_CLOSE_WINDOW, + wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); } private: diff --git a/scripting/python_scripting.cpp b/scripting/python_scripting.cpp index ccc3c0cee8..c74abf5ed5 100644 --- a/scripting/python_scripting.cpp +++ b/scripting/python_scripting.cpp @@ -233,21 +233,11 @@ wxWindow* CreatePythonShellWindow( wxWindow* parent ) "import wx\n" "from wx.py import shell, version\n" "\n" - "class PyCrustPanel(wx.Panel):\n" - "\tdef __init__(self, parent):\n" - "\t\twx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)\n" - "\t\t\n" - "\t\t\n" - "\t\tintro = \"Welcome To PyCrust %s - KiCAD Python Shell\" % version.VERSION\n" - "\t\tpycrust = shell.Shell(self, -1, introText=intro)\n" - "\t\t\n" - "\t\tsizer = wx.BoxSizer(wx.VERTICAL)\n\n" - "\t\tsizer.Add(pycrust, 1, wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, 10)\n\n" - "\t\tself.SetSizer(sizer)\n\n" + "intro = \"PyCrust %s - KiCAD Python Shell\" % version.VERSION\n" "\n" "def makeWindow(parent):\n" - " shell_window = PyCrustPanel(parent)\n" - " return shell_window\n" + " pycrust = shell.Shell(parent, -1, introText=intro)\n" + " return pycrust\n" "\n";