On 13/12/15 01:20, Wayne Stambaugh wrote:
I just tried this.  Nice!  This is definitely nicer than the Python
shell we are using.  I'm with Nick, where's the patch?

On 12/12/2015 10:00 AM
Attached is A ROUGH PATCH, but its not correct yet. I am posting it for comments, and maybe someone can help explain my problem??

I am getting unexplained assertions in the kicad menu.
With this patch, the first time the "Tools" menu is accessed no problem.
If the Python Console is opened, then the very next access to the tools menu gives: ../src/gtk/menu.cpp(745): assert "Assert failure" failed in Check(): can't check this item

I am also getting assertions when i expand some items in the "Namespace":

../src/gtk/colour.cpp(218): assert "IsOk()" failed in Alpha(): invalid colour
../src/gtk/colour.cpp(207): assert "IsOk()" failed in Blue(): invalid colour
../src/gtk/colour.cpp(196): assert "IsOk()" failed in Green(): invalid colour ../src/gtk/colour.cpp(233): assert "IsOk()" failed in GetPixel(): invalid colour
../src/gtk/colour.cpp(185): assert "IsOk()" failed in Red(): invalid colour
../src/gtk/colour.cpp(185): assert "IsOk()" failed in Red(): invalid colour
../src/gtk/colour.cpp(196): assert "IsOk()" failed in Green(): invalid colour
../src/gtk/colour.cpp(207): assert "IsOk()" failed in Blue(): invalid colour

I don't know whats causing those. Also, i will probably move the setting of the frame name inside CreatePythonShellWindow.

Doing it this way removes the need for the PYTHON_CONSOLE_FRAME and assuming I can get it to work without causing assertions, then that whole file could be removed.

IF I can get this to work, I would like to add features such as:

Startup scripts which execute the first time the window is opened.
Saving and restoring of the windows settings.
Saving and restoring of the history.
Making the About Dialog more descriptive/meainingful.

I think that:
Settings/History would be stored in the users kicad config directory.
Startup scripts would also be there.

I would also like to add the users kicad config directory and the current project path to the search path, so that user scripts could be stored with their project or with their kicad settings.

Steven.
=== modified file 'pcbnew/pcbframe.cpp'
--- pcbnew/pcbframe.cpp	2015-11-29 06:56:27 +0000
+++ pcbnew/pcbframe.cpp	2015-12-13 07:17:14 +0000
@@ -990,7 +990,11 @@
     bool pythonPanelShown = true;
 
     if( pythonPanelFrame == NULL )
-        pythonPanelFrame = new PYTHON_CONSOLE_FRAME( this, pythonConsoleNameId() );
+    {
+//      pythonPanelFrame = new PYTHON_CONSOLE_FRAME( this, pythonConsoleNameId() );
+        pythonPanelFrame = CreatePythonShellWindow( this );
+        pythonPanelFrame->SetName(pythonConsoleNameId());
+    }
     else
         pythonPanelShown = ! pythonPanelFrame->IsShown();
 

=== modified file 'scripting/python_scripting.cpp'
--- scripting/python_scripting.cpp	2015-08-24 18:32:56 +0000
+++ scripting/python_scripting.cpp	2015-12-13 07:19:47 +0000
@@ -231,16 +231,16 @@
 {
     const char* pycrust_panel =
         "import wx\n"
-        "from wx.py import shell, version\n"
+        "from wx.py import editor, version\n"
         "\n"
         "intro = \"PyCrust %s - KiCAD Python Shell\" % version.VERSION\n"
         "\n"
         "def makeWindow(parent):\n"
-        "    pycrust = shell.Shell(parent, -1, introText=intro)\n"
+        "    pycrust = editor.EditorNotebookFrame(parent, id=-1, title=intro)\n"
+        "    pycrust.Show()\n"
         "    return pycrust\n"
         "\n";
 
-
     wxWindow*   window = NULL;
     PyObject*   result;
 

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to