← Back to team overview

kicad-developers team mailing list archive

Re: Re: [patch 1/1] kicad-kicad-py-runscript.patch

 

devid_spagni wrote:
> --- In kicad-devel@xxxxxxxxxxxxxxx, Florian Delizy <fdy@...> wrote:
> 
>> This patch adds a Run Python Script button in kicad
>>
>> 
>
> Wonderful !!!
> But where is a patch ?
>
> Bye
> Devid
> 
Hum, I received it from the ML but here it is again ...

(I attached both the first and the second one, apply first 
python-support then py-runscript)

BTW, I am working on adding multiple files support to the kicad project 
(and some binding regarding the file type, I hope it will be ready soon).

 --------------070802080609000609070401 Content-Type: text/x-patch;
name="kicad-kicad-py-runscript.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="kicad-kicad-py-runscript.patch"

Subject: [patch @num@/@total@] @name@

This patch adds a Run Python Script button in kicad

(stack on preceding python-support patch)

python patch#2

---
bitmaps/icon_python.xpm | 107 ++++++++++++++++++++++++++++++++++++++++++++++++
include/bitmaps.h | 1 
include/id.h | 1 
kicad/buildmnu.cpp | 10 ++++
kicad/mdiframe.cpp | 22 +++++++++
5 files changed, 140 insertions(+), 1 deletion(-)


Index: kicad-dev/bitmaps/icon_python.xpm
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kicad-dev/bitmaps/icon_python.xpm	2007-04-19 21:10:39.000000000 +0200
@@ -0,0 +1,107 @@
+/* XPM */
+static char * icon_python_xpm[] = {
+"32 32 72 1",
+" c None",
+".	c #7EA5C6",
+"+	c #6495BD",
+"@	c #4383B6",
+"#	c #437FB2",
+"$	c #6491B5",
+"%	c #7DA1BF",
+"&	c #3882BE",
+"*	c #387CB5",
+"=	c #3779AF",
+"-	c #3776AB",
+";	c #4988BB",
+">	c #CDDFEE",
+",	c #F7F7FF",
+"'	c #82ADD1",
+")	c #3773A5",
+"!	c #7096B5",
+"~	c #4385BB",
+"{	c #FFFFFF",
+"]	c #F6F5F5",
+"^	c #3C729E",
+"/	c #9BBDDA",
+"(	c #366D9C",
+"_	c #387FBA",
+":	c #5A91BF",
+"<	c #376A94",
+"[	c #FFED60",
+"}	c #FFE659",
+"|	c #F8E16E",
+"1	c #FFEB5E",
+"2	c #FFE354",
+"3	c #4489C0",
+"4	c #3885C3",
+"5	c #FFDB4C",
+"6	c #FBCE47",
+"7	c #FFD544",
+"8	c #72A0C5",
+"9	c #507CA1",
+"0	c #FFE052",
+"a	c #FFD040",
+"b	c #F5D98D",
+"c	c #7F9EB8",
+"d	c #F1ECDA",
+"e	c #FFCC3B",
+"f	c #FBC840",
+"g	c #FBD54F",
+"h	c #FCC539",
+"i	c #4379A7",
+"j	c #DCE1E7",
+"k	c #FAE262",
+"l	c #FFC532",
+"m	c #FBC037",
+"n	c #80A6C6",
+"o	c #FFBC29",
+"p	c #F7CD74",
+"q	c #427DAE",
+"r	c #FABE40",
+"s	c #FFB521",
+"t	c #497FAC",
+"u	c #FFCD57",
+"v	c #FFE097",
+"w	c #FFD67B",
+"x	c #FFD849",
+"y	c #FFFBF2",
+"z	c #F7DE92",
+"A	c #FFCF6A",
+"B	c #FFEDC8",
+"C	c #FFE4AC",
+"D	c #F7D284",
+"E	c #FFB531",
+"F	c #F7D47B",
+"G	c #FDBE2E",
+" ",
+" ",
+" .+@###$% ",
+" &&&**==--- ",
+" ;&>,'*===))))! ",
+" ~&{{]==--))))^ ",
+" &&'/@===)))((( ",
+" __**===)))(((( ",
+" ((((( ",
+" :&&&**====)))(((<<[[}}| ",
+" &&&&&**===)))(((<<<11}22 ",
+" 34&__***---))(((<<<<222556 ",
+" 4&&&**====)))((<<<<<225557 ",
+" 84&&***==--))(((<<<<900577ab ",
+" ~&&&**===)))(((<<<<cd5577aef ",
+" ___**====)))((<<<<9dg577eeeh ",
+" __***==ijk[[[[[}225557aeelll ",
+" @_**===j|[[[[[}}00577aeelllm ",
+" n*==---k[[[[}}225577aellllop ",
+" **=---}[[[[}225577eelllloo ",
+" q===))[[[[}225577aeellloor ",
+" --)))[[}}00577aeelllooos ",
+" tiii11}005566fffffmmmmp ",
+" 22255 ",
+" 225557aeelllom ",
+" 00557aeeeuvwoo ",
+" gx77aeelly{{sm ",
+" z77aellllABCsD ",
+" 6ellloossE ",
+" FmGoop ",
+" ",
+" "};
Index: kicad-dev/include/bitmaps.h
===================================================================
--- kicad-dev.orig/include/bitmaps.h	2007-04-19 21:07:27.000000000 +0200
+++ kicad-dev/include/bitmaps.h	2007-04-19 21:08:21.000000000 +0200
@@ -143,6 +143,7 @@
#include "../bitmaps/icon_kicad.xpm"
#include "../bitmaps/icon_pcbnew.xpm"
#include "../bitmaps/icon_modedit.xpm"
+	#include "../bitmaps/icon_python.xpm"
#include "../bitmaps/Info.xpm"
#include "../bitmaps/mirepcb.xpm"
#include "../bitmaps/icon_3d.xpm"
Index: kicad-dev/include/id.h
===================================================================
--- kicad-dev.orig/include/id.h	2007-04-19 21:13:04.000000000 +0200
+++ kicad-dev/include/id.h	2007-04-19 21:13:21.000000000 +0200
@@ -14,6 +14,7 @@
ID_TO_GERBVIEW,
ID_TO_PCB,
ID_TO_CVPCB,
+	ID_RUN_PYTHON,
ID_MAIN_MENUBAR,
ID_ON_ZOOM_SELECT,
ID_ON_GRID_SELECT,
Index: kicad-dev/kicad/buildmnu.cpp
===================================================================
--- kicad-dev.orig/kicad/buildmnu.cpp	2007-04-19 21:05:18.000000000 +0200
+++ kicad-dev/kicad/buildmnu.cpp	2007-04-19 21:17:30.000000000 +0200
@@ -75,6 +75,10 @@
EVT_BUTTON(ID_TO_EESCHEMA, WinEDA_MainFrame::Process_Fct)
EVT_BUTTON(ID_TO_GERBVIEW, WinEDA_MainFrame::Process_Fct)

+#ifdef KICAD_PYTHON
+	EVT_BUTTON(ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct)
+#endif
+
END_EVENT_TABLE()


@@ -304,6 +308,12 @@
BITMAP(icon_gerbview_xpm), pos );
Butt->SetToolTip(_("GerbView ( Gerber viewer )"));

+	#ifdef KICAD_PYTHON
+	pos.x += width + SEPAR;
+	Butt = new wxBitmapButton(m_CommandWin, ID_RUN_PYTHON, //ID_TO_RUNPYTHON,
+	BITMAP(icon_python_xpm), pos );
+	Butt->SetToolTip(_("Run Python Script"));
+	#endif
}


Index: kicad-dev/kicad/mdiframe.cpp
===================================================================
--- kicad-dev.orig/kicad/mdiframe.cpp	2007-04-19 21:18:03.000000000 +0200
+++ kicad-dev/kicad/mdiframe.cpp	2007-04-19 21:28:50.000000000 +0200
@@ -6,6 +6,10 @@
#pragma implementation
#endif

+#ifdef KICAD_PYTHON
+#include <pyhandler.h>
+#endif
+
#include "fctsys.h"

#include "common.h"
@@ -17,7 +21,6 @@

#include "kicad.h"

-
/****************/
/* Constructeur */
/****************/
@@ -318,6 +321,23 @@
}
break;

+#ifdef KICAD_PYTHON
+	case ID_RUN_PYTHON:
+	{
+	wxString script = EDA_FileSelector( _("Execute Python Script:"),
+	wxEmptyString,	/* Chemin par defaut */
+	wxEmptyString,	/* nom fichier par defaut */
+	wxT( ".py" ),	/* extension par defaut */
+	wxT("*.py"), /* Masque d'affichage */
+	this,
+	wxFD_OPEN,
+	FALSE
+	);
+	if ( script.IsEmpty() ) break;
+	PyHandler::GetInstance()->RunScript( script );
+	}
+	break;
+#endif
case ID_BROWSE_AN_SELECT_FILE:
{
wxString mask(wxT("*")), extension;
 --------------070802080609000609070401 Content-Type: text/x-patch;
name="kicad-python-support.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="kicad-python-support.patch"

Subject: [patch @num@/@total@] @name@ Python Binding Start

---
3d-viewer/makefile.gtk | 1 
3d-viewer/makefile.include | 2 
common/edaappl.cpp | 14 +++
common/makefile.include | 8 +-
common/pyhandler.cpp | 148 ++++++++++++++++++++++++++++++++++++++++++
cvpcb/makefile.include | 2 
eeschema/makefile.include | 2 
eeschema/plugins/makefile.gtk | 2 
gerbview/makefile.include | 2 
include/appl_wxstruct.h | 1 
include/pyhandler.h | 47 +++++++++++++
kicad/makefile.include | 2 
libs.linux | 17 ++++
pcbnew/makefile.include | 2 
share/infospgm.cpp | 11 +++
15 files changed, 251 insertions(+), 10 deletions(-)

This patch adds a PyHandler class to handle all python bindings, and modify the build system (currently only for linux gtk) to handle python 2.4 libs

to compile with python you'll first need to have boost.python installed on your system (with its dev files) as well as python itself, then edit libs.linux
and set KICAD_PYTHON to 1 (or to anything)

then you'll just have to build it 

At running time, kcad now looks for a script 'scripts/kicad_startup.py' in it's data directory, and 'scripts/<name>.py', where <name> is the app name, then run all those scripts.
There is currently nothing exposed from Kicad to Python (more to come)
Index: kicad-dev/libs.linux
===================================================================
--- kicad-dev.orig/libs.linux	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/libs.linux	2007-04-18 20:54:26.000000000 +0200
@@ -7,6 +7,8 @@
OBJSUFF = .o
FINAL = 1

+# You must comment or uncommen tthis line to disable/enable python support
+KICAD_PYTHON = 1

# You must comment or uncomment this line for dynamic or static link
# dynamic link is less difficult than static link
@@ -69,11 +71,22 @@
endif


+#ifdef KICAD_PYTHON
+
+PYLIBS= -L/usr/lib
+PYLIBS+= -L /usr/include/python
+PYLIBS+= -lpython2.4
+PYLIBS+= -lboost_python
+EXTRACPPFLAGS+=-I /usr/include/python2.4 -DKICAD_PYTHON -fno-strict-aliasing -ggdb
+
+#endif
+
# attention à l'ordre des libairies
LIBS = -L/usr/local/lib -L/usr/X11R6/lib\
$(EXTRALIBS) $(WXSYSLIB)\
-	$(LIBSTDC)
+	$(LIBSTDC) $(PYLIBS)

LIBS_WITH_GL = -L/usr/local/lib -L/usr/X11R6/lib\
$(EXTRALIBS) $(WXSYSLIB_WITH_GL)\
-	$(LIBSTDC)
+	$(LIBSTDC) $(PYLIBS)
+
Index: kicad-dev/eeschema/plugins/makefile.gtk
===================================================================
--- kicad-dev.orig/eeschema/plugins/makefile.gtk	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/eeschema/plugins/makefile.gtk	2007-04-18 20:54:26.000000000 +0200
@@ -16,7 +16,7 @@
all: netlist_form_pads-pcb

netlist_form_pads-pcb: netlist_form_pads-pcb.cpp makefile.gtk
-	gcc -D__UNIX__ -Wall netlist_form_pads-pcb.cpp -o netlist_form_pads-pcb $(LIBSTDC)
+	gcc -D__UNIX__ -Wall netlist_form_pads-pcb.cpp -o netlist_form_pads-pcb $(LIBSTDC) $(CXXFLAGS)

install:
cp -v netlist_form_pads-pcb $(KICAD_BIN)/plugins/
Index: kicad-dev/common/makefile.include
===================================================================
--- kicad-dev.orig/common/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/common/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,4 +1,4 @@
-EXTRACPPFLAGS= -I$(SYSINCLUDE) -I./ -Ibitmaps -I../include
+EXTRACPPFLAGS+= -I$(SYSINCLUDE) -I./ -Ibitmaps -I../include

COMMON = ../include/colors.h

@@ -34,6 +34,10 @@
base_screen.o\
dcsvg.o

+ifdef KICAD_PYTHON
+OBJECTS+= pyhandler.o
+endif
+
gr_basic.o: gr_basic.cpp ../include/gr_basic.h $(DEPEND)

confirm.o: confirm.cpp $(COMMON)
@@ -85,3 +89,5 @@
eda_dde.o: eda_dde.cpp $(COMMON) ../include/eda_dde.h

displlst.o: displlst.cpp $(COMMON)
+
+pyhandler.o: pyhandler.cpp $(COMMON) ../include/pyhandler.h
Index: kicad-dev/3d-viewer/makefile.include
===================================================================
--- kicad-dev.orig/3d-viewer/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/3d-viewer/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,5 +1,5 @@
EXTRALIBS =
-EXTRACPPFLAGS= -I./ -I../include -I../common -I../pcbnew
+EXTRACPPFLAGS+= -I./ -I../include -I../common -I../pcbnew

OBJECTS3D =	3d_frame.o 3d_read_mesh.o 3d_canvas.o trackball.o 3d_aux.o\
3d_draw.o 3d_toolbar.o 3d_class.o
Index: kicad-dev/cvpcb/makefile.include
===================================================================
--- kicad-dev.orig/cvpcb/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/cvpcb/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,7 +1,7 @@
# makefile pour cvpcb (mingw)
OBJSUFF = o

-EXTRACPPFLAGS = -DCVPCB -I./ -I../cvpcb -I../include -Ibitmaps -I../pcbnew -I../3d-viewer
+EXTRACPPFLAGS += -DCVPCB -I./ -I../cvpcb -I../include -Ibitmaps -I../pcbnew -I../3d-viewer
EXTRALIBS = ../common/common.a

LIBVIEWER3D = ../3d-viewer/3d-viewer.a
Index: kicad-dev/eeschema/makefile.include
===================================================================
--- kicad-dev.orig/eeschema/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/eeschema/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -3,7 +3,7 @@
FINAL = 1

EESCHEMA_FLAGS= -DEESCHEMA
-EXTRACPPFLAGS=$(KICAD_FLAGS) $(EESCHEMA_FLAGS) -I./ -Ibitmaps -I../include -I../eeschema
+EXTRACPPFLAGS+=$(KICAD_FLAGS) $(EESCHEMA_FLAGS) -I./ -Ibitmaps -I../include -I../eeschema
EXTRALIBS = ../common/common.a

# DEPEND = program.h general.h
Index: kicad-dev/gerbview/makefile.include
===================================================================
--- kicad-dev.orig/gerbview/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/gerbview/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,5 +1,5 @@
EXTRALIBS = ../common/common.a
-EXTRACPPFLAGS= -DGERBVIEW -DPCBNEW -I./ -I../gerbview -I../include\
+EXTRACPPFLAGS+= -DGERBVIEW -DPCBNEW -I./ -I../gerbview -I../include\
-I../share -I../pcbnew -I../3d-viewer

#COMMON = pcbnew.h struct.h
Index: kicad-dev/kicad/makefile.include
===================================================================
--- kicad-dev.orig/kicad/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/kicad/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,5 +1,5 @@
EXTRALIBS = ../common/common.a
-EXTRACPPFLAGS= -DKICAD -I./ -Ibitmaps -I../include -I../kicad -I../share
+EXTRACPPFLAGS+= -DKICAD -I./ -Ibitmaps -I../include -I../kicad -I../share

DEPEND =

Index: kicad-dev/pcbnew/makefile.include
===================================================================
--- kicad-dev.orig/pcbnew/makefile.include	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/pcbnew/makefile.include	2007-04-18 20:54:26.000000000 +0200
@@ -1,5 +1,5 @@
EXTRALIBS = ../common/common.a
-EXTRACPPFLAGS= -DPCBNEW -I./ -Ibitmaps -I../include -I../share -I../pcbnew -I../3d-viewer
+EXTRACPPFLAGS+= -DPCBNEW -I./ -Ibitmaps -I../include -I../share -I../pcbnew -I../3d-viewer

#COMMON = pcbnew.h struct.h class_pad.h class_module.h class_text_mod.h \
#	class_edge_mod.h class_equipot.h
Index: kicad-dev/common/pyhandler.cpp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kicad-dev/common/pyhandler.cpp	2007-04-19 20:23:38.000000000 +0200
@@ -0,0 +1,148 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/dir.h>
+#include <wx/utils.h>
+
+#include <pyhandler.h>
+#include <iostream>
+
+#include "fctsys.h"
+#include "common.h"
+
+using namespace boost::python;
+
+PyHandler* PyHandler::m_instance = NULL;
+
+PyHandler * PyHandler::GetInstance()
+/* Singleton implementation */
+{
+	if ( !PyHandler::m_instance )
+	{
+	PyHandler::m_instance = new PyHandler();
+	}
+	return PyHandler::m_instance;
+}
+
+PyHandler::PyHandler()
+/* Init the Python env */
+{
+	Py_Initialize();
+}
+
+PyHandler::~PyHandler()
+/* Closes the Python env */
+{
+	Py_Finalize();
+}
+
+void PyHandler::RunBaseScripts( const wxString & base )
+/* Run scripts looking in 'base' directory */
+{
+
+	// check if we can have a kicad_startup.py around ?
+	wxString script = base + wxString::FromAscii( "scripts/kicad_startup.py" );
+	if ( wxFileExists( script ) ) RunScript( script );
+
+	// First find scripts/<name>.py and run it if found :
+
+	script = base + wxString::FromAscii( "scripts/" ) + m_appName + wxString::FromAscii(".py");
+	if ( wxFileExists( script ) ) RunScript( script );
+
+	// Now lets see if we can find a suitable plugin directory (plugin/<name>) somewhere
+
+	wxString pluginDir = base + wxString::FromAscii( "plugins/" ) + m_appName;
+	if ( wxDirExists( pluginDir ) )
+	{
+	// We do have a systemwide plugin dir, let's find files in it
+	wxArrayString pluginList;
+	wxDir::GetAllFiles( pluginDir, &pluginList, wxString::FromAscii("*.py") );
+
+	for ( unsigned int i = 0; i < pluginList.Count() ; i++ )
+	{
+	RunScript( pluginList[i] );
+	}
+	}
+}
+
+void PyHandler::AddModule( void (* initfunc)() )
+{
+	if (initfunc) initfunc();
+}
+
+
+void PyHandler::RunScripts()
+/* Run application startup scripts */
+{
+	// SYSTEMWIDE:
+
+	wxString dataPath = ReturnKicadDatasPath();
+	if ( wxDirExists( dataPath ) )	RunBaseScripts( dataPath );
+
+	// USER Scripts:
+	wxString userDir = wxGetUserHome() + wxString::FromAscii("/.kicad.d/");
+	if ( wxDirExists( userDir ) ) RunBaseScripts( userDir );
+	userDir = wxGetUserHome() + wxString::FromAscii("/_kicad_d/");
+	if ( wxDirExists( userDir ) ) RunBaseScripts( userDir );
+
+}
+
+bool PyHandler::RunScript( const wxString & name )
+/* Run the script specified by 'name' */
+{
+ object module(( handle<>(borrowed(PyImport_AddModule("__main__")))));
+ object ns = module.attr( "__dict__" );
+
+ FILE * file = fopen( name.fn_str(), "r" );
+
+ if ( !file )
+ {
+ // do something
+ std::cout << "Unable to Load " << name.fn_str() << "\n";
+ return false;
+ }
+
+	try
+	{
+ handle<> ignored( ( PyRun_File( file, name.fn_str(), Py_file_input, ns.ptr(), ns.ptr() ) ) );
+	}
+	catch ( error_already_set )
+	{
+	PyErr_Print(); // should be printed into an error message ...
+	fclose( file );
+	return false;
+	}
+
+	fclose( file );
+	return true;
+}
+
+void PyHandler::SetAppName( const wxString & name )
+/* Set the application name in the python scope */
+{
+	m_appName = name;
+ object module(( handle<>(borrowed(PyImport_AddModule("__main__")))));
+ object ns = module.attr( "__dict__" );
+	try {
+	ns["kicadApp"] = std::string( name.ToAscii() );
+	}
+	catch (error_already_set)
+	{
+	PyErr_Print();
+	}
+}
+
+const char * PyHandler::GetVersion()
+{
+	return Py_GetVersion();
+}
+// vim: set tabstop=4 :
Index: kicad-dev/include/pyhandler.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kicad-dev/include/pyhandler.h	2007-04-19 20:28:02.000000000 +0200
@@ -0,0 +1,47 @@
+	/****************************/
+	/*	pyhandler.h	*/
+	/****************************/
+
+#ifndef PYHANDLER_H
+#define PYHANDLER_H
+
+#include <boost/python.hpp>
+#include <Python.h>
+
+#include <wx/string.h>
+
+class PyHandler
+{
+
+	private:
+	static PyHandler * m_instance;
+
+	protected:
+	PyHandler();
+
+	wxString m_appName;
+	void RunBaseScripts( const wxString & base );
+
+	public:
+	// Singletton handling:
+	static PyHandler * GetInstance();
+	~PyHandler();
+
+	// Scope params/handling:
+	void SetAppName( const wxString & name );
+	void AddModule( void (* initfunc)(void) );
+
+	// Script
+	void RunScripts();
+	bool RunScript( const wxString & name );
+
+	// Common Informations
+	const char * GetVersion();
+
+};
+
+
+#define KICAD_PY_BIND_MODULE( mod ) PyHandler::GetInstance()->AddModule( init#mod )
+
+// vim: set tabstop=4 :
+#endif
Index: kicad-dev/share/infospgm.cpp
===================================================================
--- kicad-dev.orig/share/infospgm.cpp	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/share/infospgm.cpp	2007-04-18 20:54:26.000000000 +0200
@@ -7,6 +7,10 @@
#include "gr_basic.h"
#include "common.h"

+#ifdef KICAD_PYTHON
+#include <pyhandler.h>
+#endif
+
// Import:
extern wxString g_Main_Title;

@@ -47,6 +51,13 @@
#else
Msg << wxT(" - Ansi version");
#endif
+
+#ifdef KICAD_PYTHON
+	Msg << wxT("\n");
+	Msg << wxT( "python : " );
+	Msg << wxString::FromAscii( PyHandler::GetInstance()->GetVersion() );
+#endif
+
Msg << wxT("\n\n") << _("Author:");
Msg << wxT("JP CHARRAS\n\n") << _("Based on wxWidgets ");
Msg << wxMAJOR_VERSION << wxT(".") <<
Index: kicad-dev/3d-viewer/makefile.gtk
===================================================================
--- kicad-dev.orig/3d-viewer/makefile.gtk	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/3d-viewer/makefile.gtk	2007-04-18 20:54:26.000000000 +0200
@@ -17,6 +17,7 @@

include makefile.include

+CPPFLAGS+= $(EXTRACPPFLAGS)

$(TARGET).a: $(OBJECTS3D) makefile.gtk makefile.include
rm -f $@
Index: kicad-dev/common/edaappl.cpp
===================================================================
--- kicad-dev.orig/common/edaappl.cpp	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/common/edaappl.cpp	2007-04-18 20:54:26.000000000 +0200
@@ -8,6 +8,10 @@
#define EDA_BASE
#define COMMON_GLOBL

+#ifdef KICAD_PYTHON
+#include <pyhandler.h>
+#endif
+
#include "fctsys.h"
#include <wx/image.h>
#include "wx/html/htmlwin.h"
@@ -166,6 +170,7 @@
if ( atof("0,1") ) g_FloatSeparator = ','; // Nombres flottants = 0,1
else g_FloatSeparator = '.';

+	PyHandler::GetInstance()->SetAppName( name );
}


@@ -590,3 +595,12 @@
}


+int WinEDA_App::OnRun(void)
+/* Run init scripts */
+{
+	#ifdef KICAD_PYTHON
+	PyHandler::GetInstance()->RunScripts();
+	#endif
+	return wxApp::OnRun();
+}
+
Index: kicad-dev/include/appl_wxstruct.h
===================================================================
--- kicad-dev.orig/include/appl_wxstruct.h	2007-04-18 20:54:12.000000000 +0200
+++ kicad-dev/include/appl_wxstruct.h	2007-04-18 20:54:26.000000000 +0200
@@ -63,6 +63,7 @@
WinEDA_App(void);
~WinEDA_App(void);
bool OnInit(void);
+	int OnRun(void);

bool SetBinDir(void);
void InitEDA_Appl(const wxString & name);
 --------------070802080609000609070401-- 




References