← Back to team overview

kicad-developers team mailing list archive

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

 

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(-)


 --------------080609090505010007050602 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;
 --------------080609090505010007050602-- 




Follow ups