[wpdev-commits] wolfpack pythonscript.cpp,1.12,1.13 pythonscript.h,1.11,1.12
Brought to you by:
rip,
thiagocorrea
|
From: <thi...@us...> - 2004-01-22 01:09:37
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv3659
Modified Files:
pythonscript.cpp pythonscript.h
Log Message:
Should automatically unload if deleted
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** pythonscript.cpp 23 Sep 2003 12:40:18 -0000 1.12
--- pythonscript.cpp 22 Jan 2004 01:09:27 -0000 1.13
***************
*** 29,40 ****
//==================================================================================
- #include <qglobal.h>
-
- #if defined (Q_OS_UNIX)
- #include <limits.h> //compatability issue. GCC 2.96 doesn't have limits include
- #else
- #include <limits> // Python tries to redefine some of this stuff, so include first
- #endif
-
#include "pythonscript.h"
#include "globals.h"
--- 29,32 ----
***************
*** 45,48 ****
--- 37,41 ----
// Library Includes
#include <qfile.h>
+ #include <qglobal.h>
// Extension includes
***************
*** 50,54 ****
#include "python/target.h"
! cPythonScript::cPythonScript()
{
codeModule = 0;
--- 43,47 ----
#include "python/target.h"
! cPythonScript::cPythonScript() : loaded(false)
{
codeModule = 0;
***************
*** 59,66 ****
--- 52,62 ----
cPythonScript::~cPythonScript()
{
+ if ( loaded )
+ unload();
}
void cPythonScript::unload( void )
{
+ loaded = false;
// Free Cached Events
for( unsigned int i = 0; i < EVENT_COUNT; ++i )
***************
*** 127,135 ****
}
}
!
return true;
}
! PyObject *cPythonScript::callEvent( ePythonEvent event, PyObject *args, bool ignoreErrors )
{
PyObject *result = 0;
--- 123,136 ----
}
}
! loaded = true;
return true;
}
! bool cPythonScript::isLoaded() const
! {
! return loaded;
! }
!
! PyObject* cPythonScript::callEvent( ePythonEvent event, PyObject *args, bool ignoreErrors )
{
PyObject *result = 0;
***************
*** 146,150 ****
}
! PyObject *cPythonScript::callEvent( const QString &name, PyObject *args, bool ignoreErrors )
{
PyObject *result = 0;
--- 147,151 ----
}
! PyObject* cPythonScript::callEvent( const QString &name, PyObject *args, bool ignoreErrors )
{
PyObject *result = 0;
***************
*** 180,186 ****
}
! bool cPythonScript::callEventHandler( const QString &name, PyObject *args, bool ignoreErrors )
{
! PyObject *result = callEvent( name, args, ignoreErrors );
bool handled = false;
--- 181,187 ----
}
! bool cPythonScript::callEventHandler( const QString &name, PyObject* args, bool ignoreErrors )
{
! PyObject* result = callEvent( name, args, ignoreErrors );
bool handled = false;
***************
*** 196,200 ****
// Standard Handler for Python ScriptChains assigned to objects
! bool cPythonScript::callChainedEventHandler( ePythonEvent event, cPythonScript **chain, PyObject *args )
{
bool handled = false;
--- 197,201 ----
// Standard Handler for Python ScriptChains assigned to objects
! bool cPythonScript::callChainedEventHandler( ePythonEvent event, cPythonScript** chain, PyObject* args )
{
bool handled = false;
***************
*** 276,280 ****
}
}
-
return result;
}
--- 277,280 ----
Index: pythonscript.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pythonscript.h 24 Nov 2003 20:27:27 -0000 1.11
--- pythonscript.h 22 Jan 2004 01:09:27 -0000 1.12
***************
*** 137,140 ****
--- 137,141 ----
protected:
QString name_; // Important!
+ bool loaded;
PyObject *codeModule; // This object stores the compiled Python Module
PyObject *events[EVENT_COUNT];
***************
*** 150,153 ****
--- 151,155 ----
bool load( const cElement *element );
void unload( void );
+ bool isLoaded() const;
static bool canChainHandleEvent( ePythonEvent event, cPythonScript **chain );
|