summaryrefslogtreecommitdiffstats
path: root/lib/kross/python
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kross/python
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kross/python')
-rw-r--r--lib/kross/python/cxx/Objects.hxx16
-rw-r--r--lib/kross/python/cxx/PyCXX.html14
-rw-r--r--lib/kross/python/cxx/cxxsupport.cxx2
-rw-r--r--lib/kross/python/pythonextension.cpp154
-rw-r--r--lib/kross/python/pythonextension.h54
-rw-r--r--lib/kross/python/pythoninterpreter.cpp36
-rw-r--r--lib/kross/python/pythoninterpreter.h2
-rw-r--r--lib/kross/python/pythonmodule.cpp18
-rw-r--r--lib/kross/python/pythonmodule.h2
-rw-r--r--lib/kross/python/pythonobject.cpp20
-rw-r--r--lib/kross/python/pythonobject.h12
-rw-r--r--lib/kross/python/pythonscript.cpp94
-rw-r--r--lib/kross/python/pythonscript.h10
-rw-r--r--lib/kross/python/pythonsecurity.cpp30
-rw-r--r--lib/kross/python/pythonsecurity.h10
-rw-r--r--lib/kross/python/scripts/RestrictedPython/Guards.py2
-rwxr-xr-xlib/kross/python/scripts/gui.py134
17 files changed, 305 insertions, 305 deletions
diff --git a/lib/kross/python/cxx/Objects.hxx b/lib/kross/python/cxx/Objects.hxx
index 41648320..900a347b 100644
--- a/lib/kross/python/cxx/Objects.hxx
+++ b/lib/kross/python/cxx/Objects.hxx
@@ -54,7 +54,7 @@ namespace Py
// The purpose of this class is to serve as the most general kind of
// Python object, for the purpose of writing C++ extensions in Python
// Objects hold a PyObject* which they own. This pointer is always a
- // valid pointer to a Python object. In children we must maintain this behavior.
+ // valid pointer to a Python object. In tqchildren we must maintain this behavior.
//
// Instructions on how to make your own class MyType descended from Object:
// (0) Pick a base class, either Object or perhaps SeqBase<T> or MapBase<T>.
@@ -1470,8 +1470,8 @@ namespace Py
// Python strings return strings as individual elements.
// I'll try having a class Char which is a String of length 1
//
- typedef std::basic_string<Py_UNICODE> unicodestring;
- extern Py_UNICODE unicode_null_string[1];
+ typedef std::basic_string<Py_UNICODE> tqunicodestring;
+ extern Py_UNICODE tqunicode_null_string[1];
class Char: public Object
{
@@ -1535,7 +1535,7 @@ namespace Py
return *this;
}
- Char& operator= (const unicodestring& v)
+ Char& operator= (const tqunicodestring& v)
{
set(PyUnicode_FromUnicode (const_cast<Py_UNICODE*>(v.data()),1), true);
return *this;
@@ -1650,7 +1650,7 @@ namespace Py
static_cast<int>( v.length() ) ), true );
return *this;
}
- String& operator= (const unicodestring& v)
+ String& operator= (const tqunicodestring& v)
{
set( PyUnicode_FromUnicode( const_cast<Py_UNICODE*>( v.data() ),
static_cast<int>( v.length() ) ), true );
@@ -1706,16 +1706,16 @@ namespace Py
}
}
- unicodestring as_unicodestring() const
+ tqunicodestring as_tqunicodestring() const
{
if( isUnicode() )
{
- return unicodestring( PyUnicode_AS_UNICODE( ptr() ),
+ return tqunicodestring( PyUnicode_AS_UNICODE( ptr() ),
static_cast<size_type>( PyUnicode_GET_SIZE( ptr() ) ) );
}
else
{
- throw TypeError("can only return unicodestring from Unicode object");
+ throw TypeError("can only return tqunicodestring from Unicode object");
}
}
};
diff --git a/lib/kross/python/cxx/PyCXX.html b/lib/kross/python/cxx/PyCXX.html
index 566974c1..7213ad70 100644
--- a/lib/kross/python/cxx/PyCXX.html
+++ b/lib/kross/python/cxx/PyCXX.html
@@ -1,7 +1,7 @@
<html>
<head>
-<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
+<meta HTTP-ETQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<title>Writing Python Extensions in C++</title>
<style>
H1, H2, H3, H4 {color: #000099;
@@ -62,7 +62,7 @@ integrates Python with C++ in these ways: </p>
<p>Download PyCXX from <a href="http://sourceforge.net/projects/cxx/">http://sourceforge.net/projects/cxx/</a>.</p>
-<p>The distribution layout is:</p>
+<p>The distribution tqlayout is:</p>
<table>
<tr><th>Directory</th><th>Description</th></tr>
<tr><td class=code>.</td><td>Makefile for Unix and Windows, Release documentation</td>
@@ -303,7 +303,7 @@ returned by such a function, you need to know if the function returns you an <i>
or <i>unowned</i> reference. Unowned references are unusual but there are some cases where
unowned references are returned.</p>
-<p>Usually, <cite>Object</cite> and its children acquire a new reference when constructed from a
+<p>Usually, <cite>Object</cite> and its tqchildren acquire a new reference when constructed from a
<cite>PyObject *</cite>. This is usually not the right behavior if the reference comes from one
of the Python C API calls.</p>
@@ -1188,8 +1188,8 @@ sequence.</p>
<td class=code>as_std_string() const</td>
</tr>
<tr>
- <td class=code>unicodestring</td>
- <td class=code>as_unicodestring() const</td>
+ <td class=code>tqunicodestring</td>
+ <td class=code>as_tqunicodestring() const</td>
</tr>
</table>
@@ -1571,7 +1571,7 @@ converted to a standard string which is passed to std::ostream&amp; operator&lt;
<p>The Python exception facility and the C++ exception facility can be merged via the use
of try/catch blocks in the bodies of extension objects and module functions.</p>
-<h3>Class Exception and its children</h3>
+<h3>Class Exception and its tqchildren</h3>
<p>A set of classes is provided. Each is derived from class Exception, and represents a
particular sort of Python exception, such as IndexError, RuntimeError, ValueError. Each of
@@ -1612,7 +1612,7 @@ classes are shown here.</p>
</tr>
<tr>
<td class=code></td>
- <td>Constructors for other children of class Exception</td>
+ <td>Constructors for other tqchildren of class Exception</td>
</tr>
<tr>
<td class=code> </td>
diff --git a/lib/kross/python/cxx/cxxsupport.cxx b/lib/kross/python/cxx/cxxsupport.cxx
index 61329b60..b7bcaa0a 100644
--- a/lib/kross/python/cxx/cxxsupport.cxx
+++ b/lib/kross/python/cxx/cxxsupport.cxx
@@ -6,7 +6,7 @@
#include "Objects.hxx"
namespace Py {
-Py_UNICODE unicode_null_string[1] = { 0 };
+Py_UNICODE tqunicode_null_string[1] = { 0 };
Type Object::type () const
{
diff --git a/lib/kross/python/pythonextension.cpp b/lib/kross/python/pythonextension.cpp
index 59d9aaed..aab781ab 100644
--- a/lib/kross/python/pythonextension.cpp
+++ b/lib/kross/python/pythonextension.cpp
@@ -31,7 +31,7 @@ PythonExtension::PythonExtension(Kross::Api::Object::Ptr object)
, m_object(object)
{
#ifdef KROSS_PYTHON_EXTENSION_CTOR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::Constructor objectname='%1' objectclass='%2'").arg(m_object->getName()).arg(m_object->getClassName()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::Constructor objectname='%1' objectclass='%2'").tqarg(m_object->getName()).tqarg(m_object->getClassName()) );
#endif
behaviors().name("KrossPythonExtension");
@@ -55,7 +55,7 @@ PythonExtension::PythonExtension(Kross::Api::Object::Ptr object)
PythonExtension::~PythonExtension()
{
#ifdef KROSS_PYTHON_EXTENSION_DTOR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::Destructor objectname='%1' objectclass='%2'").arg(m_object->getName()).arg(m_object->getClassName()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::Destructor objectname='%1' objectclass='%2'").tqarg(m_object->getName()).tqarg(m_object->getClassName()) );
#endif
delete m_proxymethod;
}
@@ -64,7 +64,7 @@ PythonExtension::~PythonExtension()
Py::Object PythonExtension::str()
{
Kross::Api::Callable* callable = dynamic_cast< Kross::Api::Callable* >(m_object);
- QString s = callable ? callable->getName() : m_object->getClassName();
+ TQString s = callable ? callable->getName() : m_object->getClassName();
return toPyObject(s.isEmpty() ? : s);
}
@@ -77,16 +77,16 @@ Py::Object PythonExtension::repr()
Py::Object PythonExtension::getattr(const char* n)
{
#ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::getattr name='%1'").arg(n) );
+ krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1'").tqarg(n) );
#endif
if(n[0] == '_') {
if(!strcmp(n, "__methods__")) {
Py::List methods;
- QStringList calls = m_object->getCalls();
- for(QStringList::Iterator it = calls.begin(); it != calls.end(); ++it) {
+ TQStringList calls = m_object->getCalls();
+ for(TQStringList::Iterator it = calls.begin(); it != calls.end(); ++it) {
#ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::getattr name='%1' callable='%2'").arg(n).arg(*it) );
+ krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' callable='%2'").tqarg(n).tqarg(*it) );
#endif
methods.append(Py::String( (*it).latin1() ));
}
@@ -97,11 +97,11 @@ Py::Object PythonExtension::getattr(const char* n)
Py::List members;
Kross::Api::Callable* callable = dynamic_cast<Kross::Api::Callable*>(m_object.data());
if(callable) {
- QMap<QString, Kross::Api::Object::Ptr> children = callable->getChildren();
- QMap<QString, Kross::Api::Object::Ptr>::Iterator it( children.begin() );
- for(; it != children.end(); ++it) {
+ TQMap<TQString, Kross::Api::Object::Ptr> tqchildren = callable->getChildren();
+ TQMap<TQString, Kross::Api::Object::Ptr>::Iterator it( tqchildren.begin() );
+ for(; it != tqchildren.end(); ++it) {
#ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::getattr n='%1' child='%2'").arg(n).arg(it.key()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::getattr n='%1' child='%2'").tqarg(n).tqarg(it.key()) );
#endif
members.append(Py::String( it.key().latin1() ));
}
@@ -109,11 +109,11 @@ Py::Object PythonExtension::getattr(const char* n)
return members;
}
- //if(n == "__dict__") { krosswarning( QString("PythonExtension::getattr(%1) __dict__").arg(n) ); return Py::None(); }
- //if(n == "__class__") { krosswarning( QString("PythonExtension::getattr(%1) __class__").arg(n) ); return Py::None(); }
+ //if(n == "__dict__") { krosswarning( TQString("PythonExtension::getattr(%1) __dict__").tqarg(n) ); return Py::None(); }
+ //if(n == "__class__") { krosswarning( TQString("PythonExtension::getattr(%1) __class__").tqarg(n) ); return Py::None(); }
#ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::getattr name='%1' is a internal name.").arg(n) );
+ krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' is a internal name.").tqarg(n) );
#endif
return Py::PythonExtension<PythonExtension>::getattr_methods(n);
}
@@ -130,7 +130,7 @@ Py::Object PythonExtension::getattr(const char* n)
Py::Object PythonExtension::getattr_methods(const char* n)
{
#ifdef KROSS_PYTHON_EXTENSION_GETATTRMETHOD_DEBUG
- krossdebug( QString("PythonExtension::getattr_methods name=%1").arg(n) );
+ krossdebug( TQString("PythonExtension::getattr_methods name=%1").tqarg(n) );
#endif
return Py::PythonExtension<PythonExtension>::getattr_methods(n);
}
@@ -138,7 +138,7 @@ Py::Object PythonExtension::getattr_methods(const char* n)
int PythonExtension::setattr(const char* name, const Py::Object& value)
{
#ifdef KROSS_PYTHON_EXTENSION_SETATTR_DEBUG
- krossdebug( QString("PythonExtension::setattr name=%1 value=%2").arg(name).arg(value.as_string().c_str()) );
+ krossdebug( TQString("PythonExtension::setattr name=%1 value=%2").tqarg(name).tqarg(value.as_string().c_str()) );
#endif
return Py::PythonExtension<PythonExtension>::setattr(name, value);
}
@@ -147,10 +147,10 @@ int PythonExtension::setattr(const char* name, const Py::Object& value)
Kross::Api::List::Ptr PythonExtension::toObject(const Py::Tuple& tuple)
{
#ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toObject(Py::Tuple)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Tuple)") );
#endif
- QValueList<Kross::Api::Object::Ptr> l;
+ TQValueList<Kross::Api::Object::Ptr> l;
uint size = tuple.size();
for(uint i = 0; i < size; i++)
l.append( toObject( tuple[i] ) );
@@ -160,10 +160,10 @@ Kross::Api::List::Ptr PythonExtension::toObject(const Py::Tuple& tuple)
Kross::Api::List::Ptr PythonExtension::toObject(const Py::List& list)
{
#ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toObject(Py::List)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::List)") );
#endif
- QValueList<Kross::Api::Object::Ptr> l;
+ TQValueList<Kross::Api::Object::Ptr> l;
uint length = list.length();
for(uint i = 0; i < length; i++)
l.append( toObject( list[i] ) );
@@ -172,12 +172,12 @@ Kross::Api::List::Ptr PythonExtension::toObject(const Py::List& list)
Kross::Api::Dict::Ptr PythonExtension::toObject(const Py::Dict& dict)
{
- QMap<QString, Kross::Api::Object::Ptr> map;
+ TQMap<TQString, Kross::Api::Object::Ptr> map;
Py::List l = dict.keys();
uint length = l.length();
for(Py::List::size_type i = 0; i < length; ++i) {
const char* n = l[i].str().as_string().c_str();
- map.replace(n, toObject( dict[n] ));
+ map.tqreplace(n, toObject( dict[n] ));
}
return new Kross::Api::Dict(map);
}
@@ -185,20 +185,20 @@ Kross::Api::Dict::Ptr PythonExtension::toObject(const Py::Dict& dict)
Kross::Api::Object::Ptr PythonExtension::toObject(const Py::Object& object)
{
#ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toObject(Py::Object) object='%1'").arg(object.as_string().c_str()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) object='%1'").tqarg(object.as_string().c_str()) );
#endif
if(object == Py::None())
return 0;
PyTypeObject *type = (PyTypeObject*) object.type().ptr();
#ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toObject(Py::Object) type='%1'").arg(type->tp_name) );
+ krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) type='%1'").tqarg(type->tp_name) );
#endif
if(type == &PyInt_Type)
return new Kross::Api::Variant(int(Py::Int(object)));
if(type == &PyBool_Type)
- return new Kross::Api::Variant(QVariant(object.isTrue(),0));
+ return new Kross::Api::Variant(TQVariant(object.isTrue(),0));
if(type == &PyLong_Type)
- return new Kross::Api::Variant(Q_LLONG(long(Py::Long(object))));
+ return new Kross::Api::Variant(TQ_LLONG(long(Py::Long(object))));
if(type == &PyFloat_Type)
return new Kross::Api::Variant(double(Py::Float(object)));
@@ -206,7 +206,7 @@ Kross::Api::Object::Ptr PythonExtension::toObject(const Py::Object& object)
#ifdef Py_USING_UNICODE
/* TODO
if(type == &PyUnicode_Type) {
- Py::unicodestring u = Py::String(object).as_unicodestring();
+ Py::tqunicodestring u = Py::String(object).as_tqunicodestring();
std::string s;
std::copy(u.begin(), u.end(), std::back_inserter(s));
return new Kross::Api::Variant(s.c_str());
@@ -243,95 +243,95 @@ Kross::Api::Object::Ptr PythonExtension::toObject(const Py::Object& object)
return extension->m_object;
}
-const Py::Object PythonExtension::toPyObject(const QString& s)
+const Py::Object PythonExtension::toPyObject(const TQString& s)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(QString)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQString)") );
#endif
return s.isNull() ? Py::String() : Py::String(s.latin1());
}
-const Py::List PythonExtension::toPyObject(const QStringList& list)
+const Py::List PythonExtension::toPyObject(const TQStringList& list)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(QStringList)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQStringList)") );
#endif
Py::List l;
- for(QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
+ for(TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
l.append(toPyObject(*it));
return l;
}
-const Py::Dict PythonExtension::toPyObject(const QMap<QString, QVariant>& map)
+const Py::Dict PythonExtension::toPyObject(const TQMap<TQString, TQVariant>& map)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(QMap<QString,QVariant>)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQMap<TQString,TQVariant>)") );
#endif
Py::Dict d;
- for(QMap<QString, QVariant>::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
+ for(TQMap<TQString, TQVariant>::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
d.setItem(it.key().latin1(), toPyObject(it.data()));
return d;
}
-const Py::List PythonExtension::toPyObject(const QValueList<QVariant>& list)
+const Py::List PythonExtension::toPyObject(const TQValueList<TQVariant>& list)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(QValueList<QVariant>)") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQValueList<TQVariant>)") );
#endif
Py::List l;
- for(QValueList<QVariant>::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
+ for(TQValueList<TQVariant>::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
l.append(toPyObject(*it));
return l;
}
-const Py::Object PythonExtension::toPyObject(const QVariant& variant)
+const Py::Object PythonExtension::toPyObject(const TQVariant& variant)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(QVariant) typename='%1'").arg(variant.typeName()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) typename='%1'").tqarg(variant.typeName()) );
#endif
switch(variant.type()) {
- case QVariant::Invalid:
+ case TQVariant::Invalid:
return Py::None();
- case QVariant::Bool:
+ case TQVariant::Bool:
return Py::Int(variant.toBool());
- case QVariant::Int:
+ case TQVariant::Int:
return Py::Int(variant.toInt());
- case QVariant::UInt:
+ case TQVariant::UInt:
return Py::Long((unsigned long)variant.toUInt());
- case QVariant::Double:
+ case TQVariant::Double:
return Py::Float(variant.toDouble());
- case QVariant::Date:
- case QVariant::Time:
- case QVariant::DateTime:
- case QVariant::ByteArray:
- case QVariant::BitArray:
- case QVariant::CString:
- case QVariant::String:
+ case TQVariant::Date:
+ case TQVariant::Time:
+ case TQVariant::DateTime:
+ case TQVariant::ByteArray:
+ case TQVariant::BitArray:
+ case TQVariant::CString:
+ case TQVariant::String:
return toPyObject(variant.toString());
- case QVariant::StringList:
+ case TQVariant::StringList:
return toPyObject(variant.toStringList());
- case QVariant::Map:
+ case TQVariant::Map:
return toPyObject(variant.toMap());
- case QVariant::List:
+ case TQVariant::List:
return toPyObject(variant.toList());
// To handle following both cases is a bit difficult
// cause Python doesn't spend an easy possibility
// for such large numbers (TODO maybe BigInt?). So,
// we risk overflows here, but well...
- case QVariant::LongLong: {
- Q_LLONG l = variant.toLongLong();
+ case TQVariant::LongLong: {
+ TQ_LLONG l = variant.toLongLong();
//return (l < 0) ? Py::Long((long)l) : Py::Long((unsigned long)l);
return Py::Long((long)l);
//return Py::Long(PyLong_FromLong( (long)l ), true);
} break;
- case QVariant::ULongLong: {
+ case TQVariant::ULongLong: {
return Py::Long((unsigned long)variant.toULongLong());
} break;
default: {
- krosswarning( QString("Kross::Python::PythonExtension::toPyObject(QVariant) Not possible to convert the QVariant type '%1' to a Py::Object.").arg(variant.typeName()) );
+ krosswarning( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) Not possible to convert the TQVariant type '%1' to a Py::Object.").tqarg(variant.typeName()) );
return Py::None();
}
}
@@ -346,11 +346,11 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object)
return Py::None();
}
- const QString classname = object->getClassName();
+ const TQString classname = object->getClassName();
if(classname == "Kross::Api::Variant") {
- QVariant v = static_cast<Kross::Api::Variant*>( object.data() )->getValue();
+ TQVariant v = static_cast<Kross::Api::Variant*>( object.data() )->getValue();
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyObject(Kross::Api::Object) is Kross::Api::Variant %1").arg(v.toString()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(Kross::Api::Object) is Kross::Api::Variant %1").tqarg(v.toString()) );
#endif
return toPyObject(v);
}
@@ -361,8 +361,8 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object)
#endif
Py::List pylist;
Kross::Api::List* list = static_cast<Kross::Api::List*>( object.data() );
- QValueList<Kross::Api::Object::Ptr> valuelist = list->getValue();
- for(QValueList<Kross::Api::Object::Ptr>::Iterator it = valuelist.begin(); it != valuelist.end(); ++it)
+ TQValueList<Kross::Api::Object::Ptr> valuelist = list->getValue();
+ for(TQValueList<Kross::Api::Object::Ptr>::Iterator it = valuelist.begin(); it != valuelist.end(); ++it)
pylist.append( toPyObject(*it) ); // recursive
return pylist;
}
@@ -373,8 +373,8 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object)
#endif
Py::Dict pydict;
Kross::Api::Dict* dict = static_cast<Kross::Api::Dict*>( object.data() );
- QMap<QString, Kross::Api::Object::Ptr> valuedict = dict->getValue();
- for(QMap<QString, Kross::Api::Object::Ptr>::Iterator it = valuedict.begin(); it != valuedict.end(); ++it) {
+ TQMap<TQString, Kross::Api::Object::Ptr> valuedict = dict->getValue();
+ for(TQMap<TQString, Kross::Api::Object::Ptr>::Iterator it = valuedict.begin(); it != valuedict.end(); ++it) {
const char* n = it.key().latin1();
pydict[ n ] = toPyObject( it.data() ); // recursive
}
@@ -382,7 +382,7 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object)
}
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Trying to handle PythonExtension::toPyObject(%1) as PythonExtension").arg(object->getClassName()) );
+ krossdebug( TQString("Trying to handle PythonExtension::toPyObject(%1) as PythonExtension").tqarg(object->getClassName()) );
#endif
return Py::asObject( new PythonExtension(object) );
}
@@ -390,7 +390,7 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object)
const Py::Tuple PythonExtension::toPyTuple(Kross::Api::List::Ptr list)
{
#ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::toPyTuple(Kross::Api::List) name='%1'").arg(list ? list->getName() : "NULL") );
+ krossdebug( TQString("Kross::Python::PythonExtension::toPyTuple(Kross::Api::List) name='%1'").tqarg(list ? list->getName() : "NULL") );
#endif
uint count = list ? list->count() : 0;
Py::Tuple tuple(count);
@@ -403,39 +403,39 @@ PyObject* PythonExtension::proxyhandler(PyObject *_self_and_name_tuple, PyObject
{
Py::Tuple tuple(_self_and_name_tuple);
PythonExtension *self = static_cast<PythonExtension*>( tuple[0].ptr() );
- QString methodname = Py::String(tuple[1]).as_string().c_str();
+ TQString methodname = Py::String(tuple[1]).as_string().c_str();
try {
Kross::Api::List::Ptr arguments = toObject( Py::Tuple(args) );
#ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::proxyhandler methodname='%1' arguments='%2'").arg(methodname).arg(arguments->toString()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' arguments='%2'").tqarg(methodname).tqarg(arguments->toString()) );
#endif
Kross::Api::Callable* callable = dynamic_cast<Kross::Api::Callable*>(self->m_object.data());
if(callable && callable->hasChild(methodname)) {
#ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::proxyhandler methodname='%1' is a child object of '%2'.").arg(methodname).arg(self->m_object->getName()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' is a child object of '%2'.").tqarg(methodname).tqarg(self->m_object->getName()) );
#endif
- Py::Object result = toPyObject( callable->getChild(methodname)->call(QString::null, arguments) );
+ Py::Object result = toPyObject( callable->getChild(methodname)->call(TQString(), arguments) );
result.increment_reference_count();
return result.ptr();
}
#ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG
- krossdebug( QString("Kross::Python::PythonExtension::proxyhandler try to call function with methodname '%1' in object '%2'.").arg(methodname).arg(self->m_object->getName()) );
+ krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler try to call function with methodname '%1' in object '%2'.").tqarg(methodname).tqarg(self->m_object->getName()) );
#endif
Py::Object result = toPyObject( self->m_object->call(methodname, arguments) );
result.increment_reference_count();
return result.ptr();
}
catch(Py::Exception& e) {
- const QString err = Py::value(e).as_string().c_str();
- krosswarning( QString("Py::Exception in Kross::Python::PythonExtension::proxyhandler %1").arg(err) );
+ const TQString err = Py::value(e).as_string().c_str();
+ krosswarning( TQString("Py::Exception in Kross::Python::PythonExtension::proxyhandler %1").tqarg(err) );
//throw e;
}
catch(Kross::Api::Exception::Ptr e) {
- const QString err = e->toString();
- krosswarning( QString("Kross::Api::Exception in Kross::Python::PythonExtension::proxyhandler %1").arg(err) );
+ const TQString err = e->toString();
+ krosswarning( TQString("Kross::Api::Exception in Kross::Python::PythonExtension::proxyhandler %1").tqarg(err) );
// Don't throw here cause it will end in a crash deep in python. The
// error is already handled anyway.
//throw Py::Exception( (char*) e->toString().latin1() );
diff --git a/lib/kross/python/pythonextension.h b/lib/kross/python/pythonextension.h
index 02e42587..b19a11a1 100644
--- a/lib/kross/python/pythonextension.h
+++ b/lib/kross/python/pythonextension.h
@@ -27,12 +27,12 @@
#include "../api/dict.h"
#include "../api/class.h"
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qvaluevector.h>
-#include <qmap.h>
-#include <qvariant.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqvaluelist.h>
+#include <tqvaluevector.h>
+#include <tqmap.h>
+#include <tqvariant.h>
namespace Kross { namespace Python {
@@ -135,46 +135,46 @@ namespace Kross { namespace Python {
static Kross::Api::Object::Ptr toObject(const Py::Object& object);
/**
- * Converts a QString to a Py::Object. If
- * the QString isNull() then Py::None() will
+ * Converts a TQString to a Py::Object. If
+ * the TQString isNull() then Py::None() will
* be returned.
*
- * \param s The QString to convert.
- * \return The to a Py::String converted QString.
+ * \param s The TQString to convert.
+ * \return The to a Py::String converted TQString.
*/
- static const Py::Object toPyObject(const QString& s);
+ static const Py::Object toPyObject(const TQString& s);
/**
- * Converts a QStringList to a Py::List.
+ * Converts a TQStringList to a Py::List.
*
- * \param list The QStringList to convert.
- * \return The to a Py::List converted QStringList.
+ * \param list The TQStringList to convert.
+ * \return The to a Py::List converted TQStringList.
*/
- static const Py::List toPyObject(const QStringList& list);
+ static const Py::List toPyObject(const TQStringList& list);
/**
- * Converts a QMap to a Py::Dict.
+ * Converts a TQMap to a Py::Dict.
*
- * \param map The QMap to convert.
- * \return The to a Py::Dict converted QMap.
+ * \param map The TQMap to convert.
+ * \return The to a Py::Dict converted TQMap.
*/
- static const Py::Dict toPyObject(const QMap<QString, QVariant>& map);
+ static const Py::Dict toPyObject(const TQMap<TQString, TQVariant>& map);
/**
- * Converts a QValueList to a Py::List.
+ * Converts a TQValueList to a Py::List.
*
- * \param list The QValueList to convert.
- * \return The to a Py::List converted QValueList.
+ * \param list The TQValueList to convert.
+ * \return The to a Py::List converted TQValueList.
*/
- static const Py::List toPyObject(const QValueList<QVariant>& list);
+ static const Py::List toPyObject(const TQValueList<TQVariant>& list);
/**
- * Converts a QVariant to a Py::Object.
+ * Converts a TQVariant to a Py::Object.
*
- * \param variant The QVariant to convert.
- * \return The to a Py::Object converted QVariant.
+ * \param variant The TQVariant to convert.
+ * \return The to a Py::Object converted TQVariant.
*/
- static const Py::Object toPyObject(const QVariant& variant);
+ static const Py::Object toPyObject(const TQVariant& variant);
/**
* Converts a \a Kross::Api::Object to a Py::Object.
diff --git a/lib/kross/python/pythoninterpreter.cpp b/lib/kross/python/pythoninterpreter.cpp
index 92f627dd..23f4b8fb 100644
--- a/lib/kross/python/pythoninterpreter.cpp
+++ b/lib/kross/python/pythoninterpreter.cpp
@@ -27,7 +27,7 @@
#include <kglobal.h>
#include <kstandarddirs.h>
-#if defined(Q_WS_WIN)
+#if defined(TQ_WS_WIN)
#define PYPATHDELIMITER ";"
#else
#define PYPATHDELIMITER ":"
@@ -93,10 +93,10 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info)
// In the python sys.path are all module-directories are
// listed in.
- QString path;
+ TQString path;
// First import the sys-module to remember it's sys.path
- // list in our path QString.
+ // list in our path TQString.
Py::Module sysmod( PyImport_ImportModule("sys"), true );
Py::Dict sysmoddict = sysmod.getDict();
Py::Object syspath = sysmoddict.getItem("path");
@@ -104,32 +104,32 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info)
Py::List syspathlist = syspath;
for(Py::List::iterator it = syspathlist.begin(); it != syspathlist.end(); ++it)
if( (*it).isString() )
- path.append( QString(Py::String(*it).as_string().c_str()) + PYPATHDELIMITER );
+ path.append( TQString(Py::String(*it).as_string().c_str()) + PYPATHDELIMITER );
}
else
path = Py_GetPath();
// Determinate additional module-paths we like to add.
// First add the global Kross modules-path.
- QStringList krossdirs = KGlobal::dirs()->findDirs("data", "kross/python");
- for(QStringList::Iterator krossit = krossdirs.begin(); krossit != krossdirs.end(); ++krossit)
+ TQStringList krossdirs = KGlobal::dirs()->findDirs("data", "kross/python");
+ for(TQStringList::Iterator krossit = krossdirs.begin(); krossit != krossdirs.end(); ++krossit)
path.append(*krossit + PYPATHDELIMITER);
// Then add the application modules-path.
- QStringList appdirs = KGlobal::dirs()->findDirs("appdata", "kross/python");
- for(QStringList::Iterator appit = appdirs.begin(); appit != appdirs.end(); ++appit)
+ TQStringList appdirs = KGlobal::dirs()->findDirs("appdata", "kross/python");
+ for(TQStringList::Iterator appit = appdirs.begin(); appit != appdirs.end(); ++appit)
path.append(*appit + PYPATHDELIMITER);
// Set the extended sys.path.
PySys_SetPath( (char*) path.latin1() );
- krossdebug(QString("Python ProgramName: %1").arg(Py_GetProgramName()));
- krossdebug(QString("Python ProgramFullPath: %1").arg(Py_GetProgramFullPath()));
- krossdebug(QString("Python Version: %1").arg(Py_GetVersion()));
- krossdebug(QString("Python Platform: %1").arg(Py_GetPlatform()));
- krossdebug(QString("Python Prefix: %1").arg(Py_GetPrefix()));
- krossdebug(QString("Python ExecPrefix: %1").arg(Py_GetExecPrefix()));
- krossdebug(QString("Python Path: %1").arg(Py_GetPath()));
- krossdebug(QString("Python System Path: %1").arg(path));
+ krossdebug(TQString("Python ProgramName: %1").tqarg(Py_GetProgramName()));
+ krossdebug(TQString("Python ProgramFullPath: %1").tqarg(Py_GetProgramFullPath()));
+ krossdebug(TQString("Python Version: %1").tqarg(Py_GetVersion()));
+ krossdebug(TQString("Python Platform: %1").tqarg(Py_GetPlatform()));
+ krossdebug(TQString("Python Prefix: %1").tqarg(Py_GetPrefix()));
+ krossdebug(TQString("Python ExecPrefix: %1").tqarg(Py_GetExecPrefix()));
+ krossdebug(TQString("Python Path: %1").tqarg(Py_GetPath()));
+ krossdebug(TQString("Python System Path: %1").tqarg(path));
// Initialize the main module.
d->mainmodule = new PythonModule(this);
@@ -139,7 +139,7 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info)
//TODO moduledict["KrossPythonVersion"] = Py::Int(KROSS_PYTHON_VERSION);
// Prepare the interpreter.
- QString s =
+ TQString s =
"import sys\n"
//"sys.setdefaultencoding('latin-1')\n"
@@ -179,7 +179,7 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info)
PyObject* pyrun = PyRun_String(s.latin1(), Py_file_input, moduledict.ptr(), moduledict.ptr());
if(! pyrun) {
Py::Object errobj = Py::value(Py::Exception()); // get last error
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Failed to prepare the __main__ module: %1").arg(errobj.as_string().c_str())) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to prepare the __main__ module: %1").tqarg(errobj.as_string().c_str())) );
}
Py_XDECREF(pyrun); // free the reference.
diff --git a/lib/kross/python/pythoninterpreter.h b/lib/kross/python/pythoninterpreter.h
index 7c4088fa..df0dcad2 100644
--- a/lib/kross/python/pythoninterpreter.h
+++ b/lib/kross/python/pythoninterpreter.h
@@ -27,7 +27,7 @@
//#include "../api/script.h"
#include "../main/scriptcontainer.h"
-#include <qstring.h>
+#include <tqstring.h>
namespace Kross { namespace Python {
diff --git a/lib/kross/python/pythonmodule.cpp b/lib/kross/python/pythonmodule.cpp
index b54eb73f..9c3353ea 100644
--- a/lib/kross/python/pythonmodule.cpp
+++ b/lib/kross/python/pythonmodule.cpp
@@ -20,7 +20,7 @@
#include "pythonmodule.h"
#include "pythoninterpreter.h"
-#include <qregexp.h>
+#include <tqregexp.h>
using namespace Kross::Python;
@@ -41,7 +41,7 @@ namespace Kross { namespace Python {
* List of \a PythonExtension instances accessible
* via this \a PythonModule instance.
*/
- QMap<QString, PythonExtension*> m_modules;
+ TQMap<TQString, PythonExtension*> m_modules;
};
@@ -52,7 +52,7 @@ PythonModule::PythonModule(PythonInterpreter* interpreter)
, d(new PythonModulePrivate())
{
#ifdef KROSS_PYTHON_MODULE_DEBUG
- krossdebug( QString("Kross::Python::PythonModule::Constructor") );
+ krossdebug( TQString("Kross::Python::PythonModule::Constructor") );
#endif
d->m_interpreter = interpreter;
@@ -65,7 +65,7 @@ PythonModule::PythonModule(PythonInterpreter* interpreter)
PythonModule::~PythonModule()
{
#ifdef KROSS_PYTHON_MODULE_DEBUG
- krossdebug( QString("Kross::Python::PythonModule::Destructor name='%1'").arg(name().c_str()) );
+ krossdebug( TQString("Kross::Python::PythonModule::Destructor name='%1'").tqarg(name().c_str()) );
#endif
delete d;
@@ -79,19 +79,19 @@ Py::Dict PythonModule::getDict()
Py::Object PythonModule::import(const Py::Tuple& args)
{
if(args.size() > 0) {
- QString modname = args[0].as_string().c_str();
+ TQString modname = args[0].as_string().c_str();
if(modname.startsWith("kross")) {
#ifdef KROSS_PYTHON_MODULE_DEBUG
- krossdebug( QString("Kross::Python::PythonModule::import() module=%1").arg(modname) );
+ krossdebug( TQString("Kross::Python::PythonModule::import() module=%1").tqarg(modname) );
#endif
- if( modname.find( QRegExp("[^a-zA-Z0-9\\_\\-]") ) >= 0 ) {
- krosswarning( QString("Denied import of Kross module '%1' cause of untrusted chars.").arg(modname) );
+ if( modname.tqfind( TQRegExp("[^a-zA-Z0-9\\_\\-]") ) >= 0 ) {
+ krosswarning( TQString("Denied import of Kross module '%1' cause of untrusted chars.").tqarg(modname) );
}
else {
Kross::Api::Module::Ptr module = Kross::Api::Manager::scriptManager()->loadModule(modname);
if(module)
return PythonExtension::toPyObject( Kross::Api::Object::Ptr(module) );
- krosswarning( QString("Loading of Kross module '%1' failed.").arg(modname) );
+ krosswarning( TQString("Loading of Kross module '%1' failed.").tqarg(modname) );
}
}
diff --git a/lib/kross/python/pythonmodule.h b/lib/kross/python/pythonmodule.h
index 1775ae68..c071fe81 100644
--- a/lib/kross/python/pythonmodule.h
+++ b/lib/kross/python/pythonmodule.h
@@ -25,7 +25,7 @@
#include "../api/script.h"
#include "pythonextension.h"
-#include <qstring.h>
+#include <tqstring.h>
namespace Kross { namespace Python {
diff --git a/lib/kross/python/pythonobject.cpp b/lib/kross/python/pythonobject.cpp
index d59087b3..f765cbbd 100644
--- a/lib/kross/python/pythonobject.cpp
+++ b/lib/kross/python/pythonobject.cpp
@@ -26,7 +26,7 @@ PythonObject::PythonObject(const Py::Object& object)
: Kross::Api::Object()
, m_pyobject(object)
{
- krossdebug( QString("PythonObject::PythonObject() constructor") );
+ krossdebug( TQString("PythonObject::PythonObject() constructor") );
Py::List x( object.dir() );
for(Py::Sequence::iterator i= x.begin(); i != x.end(); ++i) {
@@ -37,7 +37,7 @@ PythonObject::PythonObject(const Py::Object& object)
//if(! m_pyobject.hasAttr( (*i).str() )) continue;
Py::Object o = m_pyobject.getAttr(s);
- QString t;
+ TQString t;
if(o.isCallable()) t += "isCallable ";
if(o.isDict()) t += "isDict ";
if(o.isList()) t += "isList ";
@@ -46,7 +46,7 @@ PythonObject::PythonObject(const Py::Object& object)
if(o.isSequence()) t += "isSequence ";
if(o.isTrue()) t += "isTrue ";
if(o.isInstance()) t += "isInstance ";
- krossdebug( QString("PythonObject::PythonObject() method '%1' (%2)").arg( (*i).str().as_string().c_str() ).arg(t) );
+ krossdebug( TQString("PythonObject::PythonObject() method '%1' (%2)").tqarg( (*i).str().as_string().c_str() ).tqarg(t) );
if(o.isCallable())
m_calls.append( (*i).str().as_string().c_str() );
@@ -57,26 +57,26 @@ PythonObject::~PythonObject()
{
}
-const QString PythonObject::getClassName() const
+const TQString PythonObject::getClassName() const
{
return "Kross::Python::PythonObject";
}
-Kross::Api::Object::Ptr PythonObject::call(const QString& name, Kross::Api::List::Ptr arguments)
+Kross::Api::Object::Ptr PythonObject::call(const TQString& name, Kross::Api::List::Ptr arguments)
{
- krossdebug( QString("PythonObject::call(%1)").arg(name) );
+ krossdebug( TQString("PythonObject::call(%1)").tqarg(name) );
if(m_pyobject.isInstance()) {
- //if(! m_calls.contains(n)) throw ...
+ //if(! m_calls.tqcontains(n)) throw ...
PyObject* r = PyObject_CallMethod(m_pyobject.ptr(), (char*) name.latin1(), 0);
if(! r) { //FIXME happens too if e.g. number of arguments doesn't match !!!
Py::Object errobj = Py::value(Py::Exception()); // get last error
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Failed to call method '%1': %2").arg(name).arg(errobj.as_string().c_str())) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to call method '%1': %2").tqarg(name).tqarg(errobj.as_string().c_str())) );
}
Py::Object result(r, true);
- //krossdebug( QString("PythonObject::call(%1) call return value = '%2'").arg(name).arg(result.as_string().c_str()) );
+ //krossdebug( TQString("PythonObject::call(%1) call return value = '%2'").tqarg(name).tqarg(result.as_string().c_str()) );
return PythonExtension::toObject(result);
}
/*TODO??? ELSE create class instance for class-definitions???
@@ -87,7 +87,7 @@ Kross::Api::Object::Ptr PythonObject::call(const QString& name, Kross::Api::List
return Kross::Api::Object::call(name, arguments);
}
-QStringList PythonObject::getCalls()
+TQStringList PythonObject::getCalls()
{
return m_calls;
}
diff --git a/lib/kross/python/pythonobject.h b/lib/kross/python/pythonobject.h
index 6d33da26..a524efe0 100644
--- a/lib/kross/python/pythonobject.h
+++ b/lib/kross/python/pythonobject.h
@@ -25,8 +25,8 @@
#include "../api/list.h"
#include "pythonextension.h"
-#include <qstring.h>
-#include <qstringlist.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
namespace Kross { namespace Python {
@@ -59,7 +59,7 @@ namespace Kross { namespace Python {
*
* \return The name of this class.
*/
- virtual const QString getClassName() const;
+ virtual const TQString getClassName() const;
/**
* Pass a call to the object. Objects like \a Class
@@ -76,18 +76,18 @@ namespace Kross { namespace Python {
* \return The call-result as Object* instance or
* NULL if the call has no result.
*/
- virtual Kross::Api::Object::Ptr call(const QString& name, Kross::Api::List::Ptr arguments);
+ virtual Kross::Api::Object::Ptr call(const TQString& name, Kross::Api::List::Ptr arguments);
/**
* Return a list of supported callable objects.
*
* \return List of supported calls.
*/
- virtual QStringList getCalls();
+ virtual TQStringList getCalls();
private:
const Py::Object m_pyobject;
- QStringList m_calls;
+ TQStringList m_calls;
};
}}
diff --git a/lib/kross/python/pythonscript.cpp b/lib/kross/python/pythonscript.cpp
index 082b5440..4bf37c74 100644
--- a/lib/kross/python/pythonscript.cpp
+++ b/lib/kross/python/pythonscript.cpp
@@ -51,12 +51,12 @@ namespace Kross { namespace Python {
/**
* A list of functionnames.
*/
- QStringList m_functions;
+ TQStringList m_functions;
/**
* A list of classnames.
*/
- QStringList m_classes;
+ TQStringList m_classes;
};
}}
@@ -88,18 +88,18 @@ void PythonScript::initialize()
try {
if(m_scriptcontainer->getCode().isNull())
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Invalid scripting code for script '%1'").arg( m_scriptcontainer->getName() )) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Invalid scripting code for script '%1'").tqarg( m_scriptcontainer->getName() )) );
if(m_scriptcontainer->getName().isNull())
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Name for the script is invalid!")) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Name for the script is invalid!")) );
PyObject* pymod = PyModule_New( (char*) m_scriptcontainer->getName().latin1() );
d->m_module = new Py::Module(pymod, true);
if(! d->m_module)
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Failed to initialize local module context for script '%1'").arg( m_scriptcontainer->getName() )) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize local module context for script '%1'").tqarg( m_scriptcontainer->getName() )) );
#ifdef KROSS_PYTHON_SCRIPT_INIT_DEBUG
- krossdebug( QString("PythonScript::initialize() module='%1' refcount='%2'").arg(d->m_module->as_string().c_str()).arg(d->m_module->reference_count()) );
+ krossdebug( TQString("PythonScript::initialize() module='%1' refcount='%2'").tqarg(d->m_module->as_string().c_str()).tqarg(d->m_module->reference_count()) );
#endif
// Set the "self" variable to point to the ScriptContainer
@@ -108,11 +108,11 @@ void PythonScript::initialize()
// python scripting code.
Py::Dict moduledict = d->m_module->getDict();
moduledict["self"] = PythonExtension::toPyObject( m_scriptcontainer );
- //moduledict["parent"] = PythonExtension::toPyObject( m_manager );
+ //moduledict["tqparent"] = PythonExtension::toPyObject( m_manager );
/*
// Prepare the local context.
- QString s =
+ TQString s =
//"import sys\n"
"if self.has(\"stdout\"):\n"
" self.stdout = Redirect( self.get(\"stdout\") )\n"
@@ -129,9 +129,9 @@ void PythonScript::initialize()
// Compile the python script code. It will be later on request
// executed. That way we cache the compiled code.
PyObject* code = 0;
- bool restricted = m_scriptcontainer->getOption("restricted", QVariant(false,0), true).toBool();
+ bool restricted = m_scriptcontainer->getOption("restricted", TQVariant(false,0), true).toBool();
- krossdebug( QString("PythonScript::initialize() name=%1 restricted=%2").arg(m_scriptcontainer->getName()).arg(restricted) );
+ krossdebug( TQString("PythonScript::initialize() name=%1 restricted=%2").tqarg(m_scriptcontainer->getName()).tqarg(restricted) );
if(restricted) {
// Use the RestrictedPython module wrapped by the PythonSecurity class.
@@ -159,8 +159,8 @@ void PythonScript::initialize()
d->m_code = new Py::Object(code, true);
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
- Kross::Api::Exception::Ptr exception = toException( QString("Failed to compile python code: %1").arg(err) );
+ TQString err = Py::value(e).as_string().c_str();
+ Kross::Api::Exception::Ptr exception = toException( TQString("Failed to compile python code: %1").tqarg(err) );
e.clear(); // exception is handled. clear it now.
throw exception;
}
@@ -170,7 +170,7 @@ void PythonScript::finalize()
{
#ifdef KROSS_PYTHON_SCRIPT_FINALIZE_DEBUG
if(d->m_module)
- krossdebug( QString("PythonScript::finalize() module='%1' refcount='%2'").arg(d->m_module->as_string().c_str()).arg(d->m_module->reference_count()) );
+ krossdebug( TQString("PythonScript::finalize() module='%1' refcount='%2'").tqarg(d->m_module->as_string().c_str()).tqarg(d->m_module->reference_count()) );
#endif
delete d->m_module; d->m_module = 0;
@@ -179,10 +179,10 @@ void PythonScript::finalize()
d->m_classes.clear();
}
-Kross::Api::Exception::Ptr PythonScript::toException(const QString& error)
+Kross::Api::Exception::Ptr PythonScript::toException(const TQString& error)
{
long lineno = -1;
- QStringList errorlist;
+ TQStringList errorlist;
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
@@ -203,9 +203,9 @@ Kross::Api::Exception::Ptr PythonScript::toException(const QString& error)
errorlist.append( Py::Object(tblist[i]).as_string().c_str() );
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
+ TQString err = Py::value(e).as_string().c_str();
e.clear(); // exception is handled. clear it now.
- krosswarning( QString("Kross::Python::PythonScript::toException() Failed to fetch a traceback: %1").arg(err) );
+ krosswarning( TQString("Kross::Python::PythonScript::toException() Failed to fetch a traceback: %1").tqarg(err) );
}
PyObject *next;
@@ -226,7 +226,7 @@ Kross::Api::Exception::Ptr PythonScript::toException(const QString& error)
//const char* filename = PyString_AsString(frame->f_code->co_filename);
//const char* name = PyString_AsString(frame->f_code->co_name);
- //errorlist.append( QString("%1#%2: \"%3\"").arg(filename).arg(lineno).arg(name) );
+ //errorlist.append( TQString("%1#%2: \"%3\"").tqarg(filename).tqarg(lineno).tqarg(name) );
next = PyObject_GetAttrString(traceback, "tb_next");
Py_DECREF(traceback);
@@ -254,13 +254,13 @@ Kross::Api::Exception::Ptr PythonScript::toException(const QString& error)
return exception;
}
-const QStringList& PythonScript::getFunctionNames()
+const TQStringList& PythonScript::getFunctionNames()
{
if(! d->m_module)
initialize(); //TODO catch exception
return d->m_functions;
/*
- QStringList list;
+ TQStringList list;
Py::List l = d->m_module->getDict().keys();
int length = l.length();
for(Py::List::size_type i = 0; i < length; ++i)
@@ -272,7 +272,7 @@ const QStringList& PythonScript::getFunctionNames()
Kross::Api::Object::Ptr PythonScript::execute()
{
#ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG
- krossdebug( QString("PythonScript::execute()") );
+ krossdebug( TQString("PythonScript::execute()") );
#endif
try {
@@ -285,7 +285,7 @@ Kross::Api::Object::Ptr PythonScript::execute()
Py::Dict moduledict( d->m_module->getDict().ptr() );
// Initialize context before execution.
- QString s =
+ TQString s =
"import sys\n"
//"if self.has(\"stdout\"):\n"
//" sys.stdout = Redirect( self.get(\"stdout\") )\n"
@@ -318,20 +318,20 @@ Kross::Api::Object::Ptr PythonScript::execute()
Py::Object result(pyresult, true);
#ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG
- krossdebug( QString("PythonScript::execute() result=%1").arg(result.as_string().c_str()) );
+ krossdebug( TQString("PythonScript::execute() result=%1").tqarg(result.as_string().c_str()) );
#endif
for(Py::Dict::iterator it = moduledict.begin(); it != moduledict.end(); ++it) {
Py::Dict::value_type vt(*it);
if(PyClass_Check( vt.second.ptr() )) {
#ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG
- krossdebug( QString("PythonScript::execute() class '%1' added.").arg(vt.first.as_string().c_str()) );
+ krossdebug( TQString("PythonScript::execute() class '%1' added.").tqarg(vt.first.as_string().c_str()) );
#endif
d->m_classes.append( vt.first.as_string().c_str() );
}
else if(vt.second.isCallable()) {
#ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG
- krossdebug( QString("PythonScript::execute() function '%1' added.").arg(vt.first.as_string().c_str()) );
+ krossdebug( TQString("PythonScript::execute() function '%1' added.").tqarg(vt.first.as_string().c_str()) );
#endif
d->m_functions.append( vt.first.as_string().c_str() );
}
@@ -345,15 +345,15 @@ Kross::Api::Object::Ptr PythonScript::execute()
Py::Object errobj = Py::value(e);
if(errobj.ptr() == Py_None) // at least string-exceptions have there errormessage in the type-object
errobj = Py::type(e);
- QString err = errobj.as_string().c_str();
+ TQString err = errobj.as_string().c_str();
- Kross::Api::Exception::Ptr exception = toException( QString("Failed to execute python code: %1").arg(err) );
+ Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").tqarg(err) );
e.clear(); // exception is handled. clear it now.
setException( exception );
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
- Kross::Api::Exception::Ptr exception = toException( QString("Failed to execute python code: %1").arg(err) );
+ TQString err = Py::value(e).as_string().c_str();
+ Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").tqarg(err) );
e.clear(); // exception is handled. clear it now.
setException( exception );
}
@@ -365,18 +365,18 @@ Kross::Api::Object::Ptr PythonScript::execute()
return 0; // return nothing if exception got thrown.
}
-Kross::Api::Object::Ptr PythonScript::callFunction(const QString& name, Kross::Api::List::Ptr args)
+Kross::Api::Object::Ptr PythonScript::callFunction(const TQString& name, Kross::Api::List::Ptr args)
{
#ifdef KROSS_PYTHON_SCRIPT_CALLFUNC_DEBUG
- krossdebug( QString("PythonScript::callFunction(%1, %2)")
- .arg(name)
- .arg(args ? QString::number(args->count()) : QString("NULL")) );
+ krossdebug( TQString("PythonScript::callFunction(%1, %2)")
+ .tqarg(name)
+ .tqarg(args ? TQString::number(args->count()) : TQString("NULL")) );
#endif
if(hadException()) return 0; // abort if we had an unresolved exception.
if(! d->m_module) {
- setException( new Kross::Api::Exception(QString("Script not initialized.")) );
+ setException( new Kross::Api::Exception(TQString("Script not initialized.")) );
return 0;
}
@@ -386,23 +386,23 @@ Kross::Api::Object::Ptr PythonScript::callFunction(const QString& name, Kross::A
// Try to determinate the function we like to execute.
PyObject* func = PyDict_GetItemString(moduledict.ptr(), name.latin1());
- if( (! d->m_functions.contains(name)) || (! func) )
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("No such function '%1'.").arg(name)) );
+ if( (! d->m_functions.tqcontains(name)) || (! func) )
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").tqarg(name)) );
Py::Callable funcobject(func, true); // the funcobject takes care of freeing our func pyobject.
// Check if the object is really a function and therefore callable.
if(! funcobject.isCallable())
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Function is not callable.")) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function is not callable.")) );
// Call the function.
Py::Object result = funcobject.apply(PythonExtension::toPyTuple(args));
return PythonExtension::toObject(result);
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
+ TQString err = Py::value(e).as_string().c_str();
e.clear(); // exception is handled. clear it now.
- setException( new Kross::Api::Exception(QString("Python Exception: %1").arg(err)) );
+ setException( new Kross::Api::Exception(TQString("Python Exception: %1").tqarg(err)) );
}
catch(Kross::Api::Exception::Ptr e) {
setException(e);
@@ -411,19 +411,19 @@ Kross::Api::Object::Ptr PythonScript::callFunction(const QString& name, Kross::A
return 0; // return nothing if exception got thrown.
}
-const QStringList& PythonScript::getClassNames()
+const TQStringList& PythonScript::getClassNames()
{
if(! d->m_module)
initialize(); //TODO catch exception
return d->m_classes;
}
-Kross::Api::Object::Ptr PythonScript::classInstance(const QString& name)
+Kross::Api::Object::Ptr PythonScript::classInstance(const TQString& name)
{
if(hadException()) return 0; // abort if we had an unresolved exception.
if(! d->m_module) {
- setException( new Kross::Api::Exception(QString("Script not initialized.")) );
+ setException( new Kross::Api::Exception(TQString("Script not initialized.")) );
return 0;
}
@@ -432,22 +432,22 @@ Kross::Api::Object::Ptr PythonScript::classInstance(const QString& name)
// Try to determinate the class.
PyObject* pyclass = PyDict_GetItemString(moduledict.ptr(), name.latin1());
- if( (! d->m_classes.contains(name)) || (! pyclass) )
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("No such class '%1'.").arg(name)) );
+ if( (! d->m_classes.tqcontains(name)) || (! pyclass) )
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such class '%1'.").tqarg(name)) );
PyObject *pyobj = PyInstance_New(pyclass, 0, 0);//aclarg, 0);
if(! pyobj)
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Failed to create instance of class '%1'.").arg(name)) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to create instance of class '%1'.").tqarg(name)) );
Py::Object classobject(pyobj, true);
#ifdef KROSS_PYTHON_SCRIPT_CLASSINSTANCE_DEBUG
- krossdebug( QString("PythonScript::classInstance() inst='%1'").arg(classobject.as_string().c_str()) );
+ krossdebug( TQString("PythonScript::classInstance() inst='%1'").tqarg(classobject.as_string().c_str()) );
#endif
return PythonExtension::toObject(classobject);
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
+ TQString err = Py::value(e).as_string().c_str();
e.clear(); // exception is handled. clear it now.
setException( Kross::Api::Exception::Ptr( new Kross::Api::Exception(err) ) );
}
diff --git a/lib/kross/python/pythonscript.h b/lib/kross/python/pythonscript.h
index 6cbef625..b68b9705 100644
--- a/lib/kross/python/pythonscript.h
+++ b/lib/kross/python/pythonscript.h
@@ -57,7 +57,7 @@ namespace Kross { namespace Python {
* Return a list of callable functionnames this
* script spends.
*/
- virtual const QStringList& getFunctionNames();
+ virtual const TQStringList& getFunctionNames();
/**
* Execute the script.
@@ -67,17 +67,17 @@ namespace Kross { namespace Python {
/**
* Call a function.
*/
- virtual Kross::Api::Object::Ptr callFunction(const QString& name, Kross::Api::List::Ptr args);
+ virtual Kross::Api::Object::Ptr callFunction(const TQString& name, Kross::Api::List::Ptr args);
/**
* Return a list of class types this script supports.
*/
- virtual const QStringList& getClassNames();
+ virtual const TQStringList& getClassNames();
/**
* Create and return a new class instance.
*/
- virtual Kross::Api::Object::Ptr classInstance(const QString& name);
+ virtual Kross::Api::Object::Ptr classInstance(const TQString& name);
private:
/// Private d-pointer class.
@@ -89,7 +89,7 @@ namespace Kross { namespace Python {
void finalize();
/// \return a \a Kross::Api::Exception instance.
- Kross::Api::Exception::Ptr toException(const QString& error);
+ Kross::Api::Exception::Ptr toException(const TQString& error);
};
}}
diff --git a/lib/kross/python/pythonsecurity.cpp b/lib/kross/python/pythonsecurity.cpp
index 86be0092..941ed0c6 100644
--- a/lib/kross/python/pythonsecurity.cpp
+++ b/lib/kross/python/pythonsecurity.cpp
@@ -88,9 +88,9 @@ void PythonSecurity::initRestrictedPython()
krossdebug("PythonSecurity::PythonSecurity SUCCESSFULLY LOADED");
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
+ TQString err = Py::value(e).as_string().c_str();
e.clear();
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Failed to initialize PythonSecurity module: %1").arg(err) ) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize PythonSecurity module: %1").tqarg(err) ) );
}
}
@@ -104,7 +104,7 @@ Py::Object PythonSecurity::_getattr_(const Py::Tuple& args)
return Py::None();
}
-PyObject* PythonSecurity::compile_restricted(const QString& source, const QString& filename, const QString& mode)
+PyObject* PythonSecurity::compile_restricted(const TQString& source, const TQString& filename, const TQString& mode)
{
krossdebug("PythonSecurity::compile_restricted");
if(! m_pymodule)
@@ -115,12 +115,12 @@ PyObject* PythonSecurity::compile_restricted(const QString& source, const QStrin
PyObject* func = PyDict_GetItemString(m_pymodule->getDict().ptr(), "compile_restricted");
if(! func)
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("No such function '%1'.").arg("compile_restricted")) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").tqarg("compile_restricted")) );
Py::Callable funcobject(func, true); // the funcobject takes care of freeing our func pyobject.
if(! funcobject.isCallable())
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Function '%1' is not callable.").arg("compile_restricted")) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' is not callable.").tqarg("compile_restricted")) );
Py::Tuple args(3);
args[0] = Py::String(source.utf8());
@@ -140,40 +140,40 @@ PyObject* PythonSecurity::compile_restricted(const QString& source, const QStrin
/*
Py::List ml = mainmoduledict;
for(Py::List::size_type mi = 0; mi < ml.length(); ++mi) {
- krossdebug( QString("dir() = %1").arg( ml[mi].str().as_string().c_str() ) );
- //krossdebug( QString("dir().dir() = %1").arg( Py::Object(ml[mi]).dir().as_string().c_str() ) );
+ krossdebug( TQString("dir() = %1").tqarg( ml[mi].str().as_string().c_str() ) );
+ //krossdebug( TQString("dir().dir() = %1").tqarg( Py::Object(ml[mi]).dir().as_string().c_str() ) );
}
*/
Py::Object code(pycode);
- krossdebug( QString("%1 callable=%2").arg(code.as_string().c_str()).arg(PyCallable_Check(code.ptr())) );
+ krossdebug( TQString("%1 callable=%2").tqarg(code.as_string().c_str()).tqarg(PyCallable_Check(code.ptr())) );
Py::List l = code.dir();
for(Py::List::size_type i = 0; i < l.length(); ++i) {
- krossdebug( QString("dir() = %1").arg( l[i].str().as_string().c_str() ) );
- //krossdebug( QString("dir().dir() = %1").arg( Py::Object(l[i]).dir().as_string().c_str() ) );
+ krossdebug( TQString("dir() = %1").tqarg( l[i].str().as_string().c_str() ) );
+ //krossdebug( TQString("dir().dir() = %1").tqarg( Py::Object(l[i]).dir().as_string().c_str() ) );
}
return pycode;
}
catch(Py::Exception& e) {
- QString err = Py::value(e).as_string().c_str();
+ TQString err = Py::value(e).as_string().c_str();
e.clear();
- throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(QString("Function '%1' failed with python exception: %2").arg("compile_restricted").arg(err) ) );
+ throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' failed with python exception: %2").tqarg("compile_restricted").tqarg(err) ) );
}
}
#if 0
-void PythonSecurity::compile_restricted_function(const Py::Tuple& /*args*/, const QString& /*body*/, const QString& /*name*/, const QString& /*filename*/, const Py::Object& /*globalize*/)
+void PythonSecurity::compile_restricted_function(const Py::Tuple& /*args*/, const TQString& /*body*/, const TQString& /*name*/, const TQString& /*filename*/, const Py::Object& /*globalize*/)
{
//TODO
}
-void PythonSecurity::compile_restricted_exec(const QString& /*source*/, const QString& /*filename*/)
+void PythonSecurity::compile_restricted_exec(const TQString& /*source*/, const TQString& /*filename*/)
{
//TODO
}
-void PythonSecurity::compile_restricted_eval(const QString& /*source*/, const QString& /*filename*/)
+void PythonSecurity::compile_restricted_eval(const TQString& /*source*/, const TQString& /*filename*/)
{
//TODO
}
diff --git a/lib/kross/python/pythonsecurity.h b/lib/kross/python/pythonsecurity.h
index 7ffbcfff..c36e7481 100644
--- a/lib/kross/python/pythonsecurity.h
+++ b/lib/kross/python/pythonsecurity.h
@@ -22,7 +22,7 @@
#include "pythonconfig.h"
-#include <qstring.h>
+#include <tqstring.h>
namespace Kross { namespace Python {
@@ -82,13 +82,13 @@ namespace Kross { namespace Python {
* to take care to decrease the ref-counter it not needed
* any longer.
*/
- PyObject* compile_restricted(const QString& source, const QString& filename, const QString& mode);
+ PyObject* compile_restricted(const TQString& source, const TQString& filename, const TQString& mode);
#if 0
//TODO
- void compile_restricted_function(const Py::Tuple& args, const QString& body, const QString& name, const QString& filename, const Py::Object& globalize = Py::None());
- void compile_restricted_exec(const QString& source, const QString& filename = "<string>");
- void compile_restricted_eval(const QString& source, const QString& filename = "<string>");
+ void compile_restricted_function(const Py::Tuple& args, const TQString& body, const TQString& name, const TQString& filename, const Py::Object& globalize = Py::None());
+ void compile_restricted_exec(const TQString& source, const TQString& filename = "<string>");
+ void compile_restricted_eval(const TQString& source, const TQString& filename = "<string>");
#endif
private:
diff --git a/lib/kross/python/scripts/RestrictedPython/Guards.py b/lib/kross/python/scripts/RestrictedPython/Guards.py
index 4fbdcad1..295ba791 100644
--- a/lib/kross/python/scripts/RestrictedPython/Guards.py
+++ b/lib/kross/python/scripts/RestrictedPython/Guards.py
@@ -24,7 +24,7 @@ for name in ['False', 'None', 'True', 'abs', 'basestring', 'bool', 'callable',
'chr', 'cmp', 'complex', 'divmod', 'float', 'hash',
'hex', 'id', 'int', 'isinstance', 'issubclass', 'len',
'long', 'oct', 'ord', 'pow', 'range', 'repr', 'round',
- 'str', 'tuple', 'unichr', 'unicode', 'xrange', 'zip']:
+ 'str', 'tuple', 'unichr', 'tqunicode', 'xrange', 'zip']:
safe_builtins[name] = __builtins__[name]
diff --git a/lib/kross/python/scripts/gui.py b/lib/kross/python/scripts/gui.py
index 8891714a..b8edbe9c 100755
--- a/lib/kross/python/scripts/gui.py
+++ b/lib/kross/python/scripts/gui.py
@@ -43,43 +43,43 @@ class TkDialog:
self.widget = mainframe.widget
class Widget:
- def __init__(self, dialog, parent):
+ def __init__(self, dialog, tqparent):
self.dialog = dialog
- self.parent = parent
+ self.tqparent = tqparent
#def setVisible(self, visibled): pass
#def setEnabled(self, enabled): pass
class Frame(Widget):
- def __init__(self, dialog, parent):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
- self.widget = Tkinter.Frame(parent)
+ self.widget = Tkinter.Frame(tqparent)
self.widget.pack()
class Label(Widget):
- def __init__(self, dialog, parent, caption):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent, caption):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
- self.widget = Tkinter.Label(parent, text=caption)
+ self.widget = Tkinter.Label(tqparent, text=caption)
self.widget.pack(side=Tkinter.TOP)
class CheckBox(Widget):
- def __init__(self, dialog, parent, caption, checked = True):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent, caption, checked = True):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
self.checkstate = Tkinter.IntVar()
self.checkstate.set(checked)
- self.widget = Tkinter.Checkbutton(parent, text=caption, variable=self.checkstate)
+ self.widget = Tkinter.Checkbutton(tqparent, text=caption, variable=self.checkstate)
self.widget.pack(side=Tkinter.TOP)
def isChecked(self):
return self.checkstate.get()
class List(Widget):
- def __init__(self, dialog, parent, caption, items):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent, caption, items):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
- listframe = Tkinter.Frame(parent)
+ listframe = Tkinter.Frame(tqparent)
listframe.pack()
Tkinter.Label(listframe, text=caption).pack(side=Tkinter.LEFT)
@@ -94,10 +94,10 @@ class TkDialog:
self.variable.set( self.items[index] )
class Button(Widget):
- def __init__(self, dialog, parent, caption, commandmethod):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent, caption, commandmethod):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
- self.widget = Tkinter.Button(parent, text=caption, command=self.doCommand)
+ self.widget = Tkinter.Button(tqparent, text=caption, command=self.doCommand)
self.commandmethod = commandmethod
self.widget.pack(side=Tkinter.LEFT)
def doCommand(self):
@@ -114,10 +114,10 @@ class TkDialog:
#self.dialog.root.destroy()
class Edit(Widget):
- def __init__(self, dialog, parent, caption, text):
- #TkDialog.Widget.__init__(self, dialog, parent)
+ def __init__(self, dialog, tqparent, caption, text):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
import Tkinter
- self.widget = Tkinter.Frame(parent)
+ self.widget = Tkinter.Frame(tqparent)
self.widget.pack()
label = Tkinter.Label(self.widget, text=caption)
label.pack(side=Tkinter.LEFT)
@@ -129,8 +129,8 @@ class TkDialog:
return self.entrytext.get()
class FileChooser(Edit):
- def __init__(self, dialog, parent, caption, initialfile = None, filetypes = None):
- TkDialog.Edit.__init__(self, dialog, parent, caption, initialfile)
+ def __init__(self, dialog, tqparent, caption, initialfile = None, filetypes = None):
+ TkDialog.Edit.__init__(self, dialog, tqparent, caption, initialfile)
import Tkinter
self.initialfile = initialfile
@@ -187,27 +187,27 @@ class QtDialog:
import qt
class Dialog(qt.QDialog):
- def __init__(self, parent = None, name = None, modal = 0, fl = 0):
- qt.QDialog.__init__(self, parent, name, modal, fl)
+ def __init__(self, tqparent = None, name = None, modal = 0, fl = 0):
+ qt.QDialog.__init__(self, tqparent, name, modal, fl)
qt.QDialog.accept = self.accept
- self.layout = qt.QVBoxLayout(self)
- self.layout.setSpacing(6)
- self.layout.setMargin(11)
+ self.tqlayout = qt.QVBoxLayout(self)
+ self.tqlayout.setSpacing(6)
+ self.tqlayout.setMargin(11)
class Label(qt.QLabel):
- def __init__(self, dialog, parent, caption):
- qt.QLabel.__init__(self, parent)
- self.setText("<qt>%s</qt>" % caption.replace("\n","<br>"))
+ def __init__(self, dialog, tqparent, caption):
+ qt.QLabel.__init__(self, tqparent)
+ self.setText("<qt>%s</qt>" % caption.tqreplace("\n","<br>"))
class Frame(qt.QHBox):
- def __init__(self, dialog, parent):
- qt.QHBox.__init__(self, parent)
+ def __init__(self, dialog, tqparent):
+ qt.QHBox.__init__(self, tqparent)
self.widget = self
self.setSpacing(6)
class Edit(qt.QHBox):
- def __init__(self, dialog, parent, caption, text):
- qt.QHBox.__init__(self, parent)
+ def __init__(self, dialog, tqparent, caption, text):
+ qt.QHBox.__init__(self, tqparent)
self.setSpacing(6)
label = qt.QLabel(caption, self)
self.edit = qt.QLineEdit(self)
@@ -219,26 +219,26 @@ class QtDialog:
class Button(qt.QPushButton):
#def __init__(self, *args):
- def __init__(self, dialog, parent, caption, commandmethod):
+ def __init__(self, dialog, tqparent, caption, commandmethod):
#apply(qt.QPushButton.__init__, (self,) + args)
- qt.QPushButton.__init__(self, parent)
+ qt.QPushButton.__init__(self, tqparent)
self.commandmethod = commandmethod
self.setText(caption)
qt.QObject.connect(self, qt.SIGNAL("clicked()"), self.commandmethod)
class CheckBox(qt.QCheckBox):
- def __init__(self, dialog, parent, caption, checked = True):
- #TkDialog.Widget.__init__(self, dialog, parent)
- qt.QCheckBox.__init__(self, parent)
+ def __init__(self, dialog, tqparent, caption, checked = True):
+ #TkDialog.Widget.__init__(self, dialog, tqparent)
+ qt.QCheckBox.__init__(self, tqparent)
self.setText(caption)
self.setChecked(checked)
#def isChecked(self):
# return self.isChecked()
class List(qt.QHBox):
- def __init__(self, dialog, parent, caption, items):
- qt.QHBox.__init__(self, parent)
+ def __init__(self, dialog, tqparent, caption, items):
+ qt.QHBox.__init__(self, tqparent)
self.setSpacing(6)
label = qt.QLabel(caption, self)
self.combo = qt.QComboBox(self)
@@ -252,9 +252,9 @@ class QtDialog:
self.combo.setCurrentItem(index)
class FileChooser(qt.QHBox):
- def __init__(self, dialog, parent, caption, initialfile = None, filetypes = None):
+ def __init__(self, dialog, tqparent, caption, initialfile = None, filetypes = None):
#apply(qt.QHBox.__init__, (self,) + args)
- qt.QHBox.__init__(self, parent)
+ qt.QHBox.__init__(self, tqparent)
self.setMinimumWidth(400)
self.initialfile = initialfile
@@ -274,29 +274,29 @@ class QtDialog:
return self.edit.text()
def browseButtonClicked(self):
- filtermask = ""
+ filtertqmask = ""
import types
if isinstance(self.filetypes, types.TupleType):
for ft in self.filetypes:
if len(ft) == 1:
- filtermask += "%s\n" % (ft[0])
+ filtertqmask += "%s\n" % (ft[0])
if len(ft) == 2:
- filtermask += "%s|%s (%s)\n" % (ft[1],ft[0],ft[1])
- if filtermask == "":
- filtermask = "All files (*.*)"
+ filtertqmask += "%s|%s (%s)\n" % (ft[1],ft[0],ft[1])
+ if filtertqmask == "":
+ filtertqmask = "All files (*.*)"
else:
- filtermask = filtermask[:-1]
+ filtertqmask = filtertqmask[:-1]
filename = None
try:
print "QtDialog.FileChooser.browseButtonClicked() kfile.KFileDialog"
# try to use the kfile module included in pykde
import kfile
- filename = kfile.KFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file")
+ filename = kfile.KFileDialog.getOpenFileName(self.initialfile, filtertqmask, self, "Save to file")
except:
print "QtDialog.FileChooser.browseButtonClicked() qt.QFileDialog"
# fallback to Qt filedialog
- filename = qt.QFileDialog.getOpenFileName(self.initialfile, filtermask, self, "Save to file")
+ filename = qt.QFileDialog.getOpenFileName(self.initialfile, filtertqmask, self, "Save to file")
if filename != None and filename != "":
self.edit.setText(filename)
@@ -317,13 +317,13 @@ class QtDialog:
return True
return False
- self.app = qt.qApp
+ self.app = qt.tqApp
self.dialog = Dialog(self.app.mainWidget(), "Dialog", 1, qt.Qt.WDestructiveClose)
self.dialog.setCaption(title)
self.widget = qt.QVBox(self.dialog)
self.widget.setSpacing(6)
- self.dialog.layout.addWidget(self.widget)
+ self.dialog.tqlayout.addWidget(self.widget)
self.Frame = Frame
self.Label = Label
@@ -371,26 +371,26 @@ class Dialog:
def close(self):
self.dialog.close()
- def addFrame(self, parentwidget):
- return self.dialog.Frame(self.dialog, parentwidget.widget)
+ def addFrame(self, tqparentwidget):
+ return self.dialog.Frame(self.dialog, tqparentwidget.widget)
- def addLabel(self, parentwidget, caption):
- return self.dialog.Label(self.dialog, parentwidget.widget, caption)
+ def addLabel(self, tqparentwidget, caption):
+ return self.dialog.Label(self.dialog, tqparentwidget.widget, caption)
- def addCheckBox(self, parentwidget, caption, checked = True):
- return self.dialog.CheckBox(self.dialog, parentwidget.widget, caption, checked)
+ def addCheckBox(self, tqparentwidget, caption, checked = True):
+ return self.dialog.CheckBox(self.dialog, tqparentwidget.widget, caption, checked)
- def addButton(self, parentwidget, caption, commandmethod):
- return self.dialog.Button(self.dialog, parentwidget.widget, caption, commandmethod)
+ def addButton(self, tqparentwidget, caption, commandmethod):
+ return self.dialog.Button(self.dialog, tqparentwidget.widget, caption, commandmethod)
- def addEdit(self, parentwidget, caption, text):
- return self.dialog.Edit(self.dialog, parentwidget.widget, caption, text)
+ def addEdit(self, tqparentwidget, caption, text):
+ return self.dialog.Edit(self.dialog, tqparentwidget.widget, caption, text)
- def addFileChooser(self, parentwidget, caption, initialfile = None, filetypes = None):
- return self.dialog.FileChooser(self.dialog, parentwidget.widget, caption, initialfile, filetypes)
+ def addFileChooser(self, tqparentwidget, caption, initialfile = None, filetypes = None):
+ return self.dialog.FileChooser(self.dialog, tqparentwidget.widget, caption, initialfile, filetypes)
- def addList(self, parentwidget, caption, items):
- return self.dialog.List(self.dialog, parentwidget.widget, caption, items)
+ def addList(self, tqparentwidget, caption, items):
+ return self.dialog.List(self.dialog, tqparentwidget.widget, caption, items)
def showMessageBox(self, typename, caption, message):
return self.dialog.MessageBox(self.dialog, typename, caption, message)