← Back to team overview

kicad-developers team mailing list archive

[patch 1/1] kicad-py-load-project-event.patch

 

Python:
add kicad::LoadProject event

Bugfix:
fix directory rename

---
kicad/mdiframe.cpp | 5 +++++
kicad/prjconfig.cpp | 8 ++++++++
kicad/treeprj.cpp | 2 +-
3 files changed, 14 insertions(+), 1 deletion(-)

 --------------070706010807050706020902 Content-Type: text/x-patch;
name="kicad-py-load-project-event.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="kicad-py-load-project-event.patch"

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

Python:
add kicad::LoadProject event

Bugfix:
fix directory rename

---
kicad/mdiframe.cpp | 5 +++++
kicad/prjconfig.cpp | 8 ++++++++
kicad/treeprj.cpp | 2 +-
3 files changed, 14 insertions(+), 1 deletion(-)
Index: kicad-dev/kicad/mdiframe.cpp
===================================================================
--- kicad-dev.orig/kicad/mdiframe.cpp	2007-05-02 14:40:04.000000000 +0200
+++ kicad-dev/kicad/mdiframe.cpp	2007-05-02 14:41:54.000000000 +0200
@@ -108,6 +108,10 @@
msg = wxGetCwd();
line.Printf( _("Ready\nWorking dir: %s\n"), msg.GetData());
PrintMsg(line);
+
+	#ifdef KICAD_PYTHON
+	PyHandler::GetInstance()->DeclareEvent(wxT("kicad::LoadProject"));
+	#endif
}

/***************/
@@ -370,3 +374,4 @@
}
}

+// vim: set tabstop=4 : noexpandtab :
Index: kicad-dev/kicad/prjconfig.cpp
===================================================================
--- kicad-dev.orig/kicad/prjconfig.cpp	2007-05-02 14:41:16.000000000 +0200
+++ kicad-dev/kicad/prjconfig.cpp	2007-05-02 14:43:28.000000000 +0200
@@ -3,12 +3,16 @@
/*************************************************************/


+#ifdef KICAD_PYTHON
+#include <pyhandler.h>
+#endif
#include "fctsys.h"
#include "common.h"
#include "kicad.h"
#include "protos.h"
#include "prjconfig.h"

+
/* Variables locales */


@@ -32,6 +36,9 @@
wxString msg = _("\nWorking dir: ") + wxGetCwd();
msg << _("\nProject: ") << m_PrjFileName << wxT("\n");
PrintMsg(msg);
+	#ifdef KICAD_PYTHON
+	PyHandler::GetInstance()->TriggerEvent( wxT("kicad::LoadProject"), PyHandler::Convert(m_PrjFileName) );
+	#endif
}


@@ -62,3 +69,4 @@
EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList);
}

+// vim: set tabstop=4 : noexpandtab :
Index: kicad-dev/kicad/treeprj.cpp
===================================================================
--- kicad-dev.orig/kicad/treeprj.cpp	2007-05-02 14:57:45.000000000 +0200
+++ kicad-dev/kicad/treeprj.cpp	2007-05-02 15:02:34.000000000 +0200
@@ -77,7 +77,7 @@
wxString newFile;
wxString dirs = GetDir();

-	if ( !dirs.IsEmpty() ) newFile = dirs + sep + name;
+	if ( !dirs.IsEmpty() && GetType() != TREE_DIRECTORY ) newFile = dirs + sep + name;
else newFile = name;

if ( newFile == m_FileName ) return false;
 --------------070706010807050706020902--