move Python.h up so things would even compile
This commit is contained in:
parent
74f295d649
commit
b0b3a6d5d3
|
@ -1,103 +1,115 @@
|
|||
/****************************/
|
||||
/* pyhandler.h */
|
||||
/****************************/
|
||||
/****************************/
|
||||
/* pyhandler.h */
|
||||
/****************************/
|
||||
|
||||
#ifndef PYHANDLER_H
|
||||
#define PYHANDLER_H
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <Python.h>
|
||||
#include <wx/wxPython/wxPython.h>
|
||||
#include <vector>
|
||||
|
||||
/* Use the boost library : */
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
|
||||
class PyHandler
|
||||
{
|
||||
|
||||
typedef void (*initfunc_t )();
|
||||
|
||||
private:
|
||||
static PyHandler * m_instance;
|
||||
bool m_ModulesLoaded;
|
||||
int m_current;
|
||||
PyThreadState* m_mainTState;
|
||||
private:
|
||||
static PyHandler* m_instance;
|
||||
bool m_ModulesLoaded;
|
||||
int m_current;
|
||||
PyThreadState* m_mainTState;
|
||||
|
||||
protected:
|
||||
PyHandler();
|
||||
protected:
|
||||
PyHandler();
|
||||
|
||||
wxString m_appName;
|
||||
void RunBaseScripts( const wxString & base );
|
||||
wxString m_appName;
|
||||
void RunBaseScripts( const wxString& base );
|
||||
|
||||
// Modules
|
||||
struct ModuleRecord
|
||||
// Modules
|
||||
struct ModuleRecord
|
||||
{
|
||||
wxString name;
|
||||
std::vector< initfunc_t > registry;
|
||||
|
||||
ModuleRecord( const wxString &modName ) :
|
||||
name( modName )
|
||||
{
|
||||
wxString name;
|
||||
std::vector< initfunc_t > registry;
|
||||
}
|
||||
|
||||
ModuleRecord( const wxString & modName ) : name(modName) {}
|
||||
};
|
||||
std::vector< ModuleRecord > m_ModuleRegistry;
|
||||
void DoInitModules();
|
||||
};
|
||||
|
||||
// Events
|
||||
struct Event
|
||||
std::vector< ModuleRecord > m_ModuleRegistry;
|
||||
|
||||
void DoInitModules();
|
||||
|
||||
// Events
|
||||
struct Event
|
||||
{
|
||||
wxString key;
|
||||
std::vector< boost::python::object > functors;
|
||||
|
||||
Event( const wxString &strKey ) :
|
||||
key( strKey )
|
||||
{
|
||||
wxString key;
|
||||
std::vector< boost::python::object > functors;
|
||||
}
|
||||
};
|
||||
|
||||
Event( const wxString & strKey ) : key( strKey ) {}
|
||||
};
|
||||
std::vector< Event > m_EventRegistry;
|
||||
std::vector< Event > m_EventRegistry;
|
||||
|
||||
public:
|
||||
// Singletton handling:
|
||||
static PyHandler * GetInstance();
|
||||
public:
|
||||
|
||||
~PyHandler();
|
||||
// Singletton handling:
|
||||
static PyHandler* GetInstance();
|
||||
|
||||
// Scope params/handling:
|
||||
void SetAppName( const wxString & name );
|
||||
~PyHandler();
|
||||
|
||||
void AddToModule( const wxString & name, initfunc_t initfunc );
|
||||
int GetModuleIndex( const wxString & name ) const;
|
||||
// Scope params/handling:
|
||||
void SetAppName( const wxString& name );
|
||||
|
||||
// Script and direct call
|
||||
void RunScripts();
|
||||
bool RunScript( const wxString & name );
|
||||
bool RunSimpleString( const wxString & code );
|
||||
void AddToModule( const wxString& name, initfunc_t initfunc );
|
||||
int GetModuleIndex( const wxString& name ) const;
|
||||
|
||||
// Common Informations
|
||||
const char * GetVersion();
|
||||
// Script and direct call
|
||||
void RunScripts();
|
||||
bool RunScript( const wxString& name );
|
||||
bool RunSimpleString( const wxString& code );
|
||||
|
||||
void InitNextModule();
|
||||
// Common Informations
|
||||
const char* GetVersion();
|
||||
|
||||
// Event triggering
|
||||
void InitNextModule();
|
||||
|
||||
// - C++ interface
|
||||
void DeclareEvent( const wxString & key );
|
||||
void TriggerEvent( const wxString & key );
|
||||
void TriggerEvent( const wxString & key, const boost::python::object & param );
|
||||
int GetEventIndex( const wxString & key );
|
||||
// Event triggering
|
||||
|
||||
// - Py Interface
|
||||
void RegisterCallback ( const wxString & key, const boost::python::object & obj );
|
||||
void UnRegisterCallback( const wxString & key, const boost::python::object & obj );
|
||||
// - C++ interface
|
||||
void DeclareEvent( const wxString& key );
|
||||
void TriggerEvent( const wxString& key );
|
||||
void TriggerEvent( const wxString& key,
|
||||
const boost::python::object& param );
|
||||
int GetEventIndex( const wxString& key );
|
||||
|
||||
// Object conversions
|
||||
// - Py Interface
|
||||
void RegisterCallback( const wxString& key,
|
||||
const boost::python::object& obj );
|
||||
void UnRegisterCallback( const wxString& key,
|
||||
const boost::python::object& obj );
|
||||
|
||||
// - Py -> C++
|
||||
static wxString MakeStr( const boost::python::object & objStr );
|
||||
// Object conversions
|
||||
|
||||
// - C++ -> Py
|
||||
static boost::python::object Convert( const wxString & wxStr );
|
||||
// - Py -> C++
|
||||
static wxString MakeStr( const boost::python::object& objStr );
|
||||
|
||||
// - C++ -> Py
|
||||
static boost::python::object Convert( const wxString& wxStr );
|
||||
};
|
||||
|
||||
|
||||
#define KICAD_PY_BIND_MODULE( mod ) PyHandler::GetInstance()->AddModule( init#mod )
|
||||
|
||||
#endif //PYHANDLER_H
|
||||
#define KICAD_PY_BIND_MODULE( mod ) PyHandler::GetInstance()->AddModule( init # mod )
|
||||
|
||||
#endif //PYHANDLER_H
|
||||
|
|
Loading…
Reference in New Issue