20#include "pythonobject.h"
21#include "pythonextension.h"
29 krossdebug( TQString( "PythonObject::PythonObject() constructor") );
31 Py::List x( object.dir() );
32 for(Py::Sequence::iterator i= x.begin(); i != x.end(); ++i) {
33 std::string s = (*i).str();
38 Py::Object o = m_pyobject.getAttr(s);
41 if(o.isCallable()) t += "isCallable ";
42 if(o.isDict()) t += "isDict ";
43 if(o.isList()) t += "isList ";
44 if(o.isMapping()) t += "isMapping ";
45 if(o.isNumeric()) t += "isNumeric ";
46 if(o.isSequence()) t += "isSequence ";
47 if(o.isTrue()) t += "isTrue ";
48 if(o.isInstance()) t += "isInstance ";
49 krossdebug( TQString( "PythonObject::PythonObject() method '%1' (%2)").arg( (*i).str().as_string().c_str() ).arg(t) );
52 m_calls.append( (*i).str().as_string().c_str() );
62 return "Kross::Python::PythonObject";
67 krossdebug( TQString( "PythonObject::call(%1)").arg(name) );
69 if(m_pyobject.isInstance()) {
72 PyObject* r = PyObject_CallMethod(m_pyobject.ptr(), ( char*) name.latin1(), 0);
74 Py::Object errobj = Py::value(Py::Exception());
77 Py::Object result(r, true);
80 return PythonExtension::toObject(result);
Common exception class used for representing exceptions in Kross.
TDESharedPtr< Exception > Ptr Shared pointer to implement reference-counting.
TDESharedPtr< List > Ptr Shared pointer to implement reference-counting.
virtual Object::Ptr call(const TQString &name, TDESharedPtr< List > arguments) Pass a call to the object and evaluated it recursive down the object-hierachy.
TDESharedPtr< Object > Ptr Shared pointer to implement reference-counting.
virtual const TQString getClassName() const Return the class name.
virtual TQStringList getCalls() Return a list of supported callable objects.
virtual ~PythonObject() Destructor.
virtual Kross::Api::Object::Ptr call(const TQString &name, Kross::Api::List::Ptr arguments) Pass a call to the object.
PythonObject(const Py::Object &object) Constructor.
The common Kross API used as common codebase.
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.
|