20#include "pythonmodule.h"
21#include "pythoninterpreter.h"
30 class PythonModulePrivate
38 PythonInterpreter* m_interpreter;
44 TQMap<TQString, PythonExtension*> m_modules;
52 , d(new PythonModulePrivate())
54#ifdef KROSS_PYTHON_MODULE_DEBUG
55 krossdebug( TQString( "Kross::Python::PythonModule::Constructor") );
58 d->m_interpreter = interpreter;
60 add_varargs_method( "_import", &PythonModule::import, "FIXME: Documentation");
62 initialize( "The PythonModule is the __main__ python environment used as global object namespace.");
67#ifdef KROSS_PYTHON_MODULE_DEBUG
68 krossdebug( TQString( "Kross::Python::PythonModule::Destructor name='%1'").arg(name().c_str()) );
76 return moduleDictionary();
79Py::Object PythonModule::import( const Py::Tuple& args)
82 TQString modname = args[0].as_string().c_str();
83 if(modname.startsWith( "kross")) {
84#ifdef KROSS_PYTHON_MODULE_DEBUG
85 krossdebug( TQString( "Kross::Python::PythonModule::import() module=%1").arg(modname) );
87 if( modname.find( TQRegExp( "[^a-zA-Z0-9\\_\\-]") ) >= 0 ) {
88 krosswarning( TQString( "Denied import of Kross module '%1' cause of untrusted chars.").arg(modname) );
94 krosswarning( TQString( "Loading of Kross module '%1' failed.").arg(modname) );
Module::Ptr loadModule(const TQString &modulename) Load an external module and return it.
static Manager * scriptManager() Return the Manager instance.
TDESharedPtr< Module > Ptr Shared pointer to implement reference-counting.
TDESharedPtr< Object > Ptr Shared pointer to implement reference-counting.
Python interpreter bridge.
PythonModule(PythonInterpreter *interpreter) Constructor.
virtual ~PythonModule() Destructor.
The Python plugin for the Kross scripting framework.
The Kross scripting bridge to embed scripting functionality into an application.
KOFFICE_EXPORT void krossdebug(const TQString &s) Debugging function.
KOFFICE_EXPORT void krosswarning(const TQString &s) Warning function.
|