From 3dec37ecf0484f58246046efb26ba0fbbdf3dcd7 Mon Sep 17 00:00:00 2001 From: ormorph Date: Sun, 21 Apr 2024 23:19:03 +0300 Subject: [PATCH] Changing string types to bytes for pytquic For python3 you need to explicitly specify the bytes type, it is different from strings Signed-off-by: ormorph (cherry picked from commit ba0616ea87225f3edcc45dc863d0d03419a53450) --- pytquic3/form.cpp | 6 +++--- pytquic3/uic.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pytquic3/form.cpp b/pytquic3/form.cpp index b0de614..323161e 100644 --- a/pytquic3/form.cpp +++ b/pytquic3/form.cpp @@ -340,12 +340,12 @@ void Uic::createFormImpl( const TQDomElement &e ) images += img; out << indent << img << "_data = \\" << endl; ++indent; - out << indent << "\""; + out << indent << "b\""; int a ; for ( a = 0; a < (int) (data.length()/2)-1; a++ ) { out << "\\x" << TQString(data[2*a]) << TQString(data[2*a+1]); if ( a % 12 == 11 ) - out << "\" \\" << endl << indent << "\""; + out << "\" \\" << endl << indent << "b\""; } out << "\\x" << TQString(data[2*a]) << TQString(data[2*a+1]) << "\"" << endl; --indent; @@ -391,7 +391,7 @@ void Uic::createFormImpl( const TQDomElement &e ) TQStringList::Iterator it; for ( it = images.begin(); it != images.end(); ++it ) { out << indent << "self." << (*it) << " = TQPixmap()" << endl; - out << indent << "self." << (*it) << ".loadFromData(" << (*it) << "_data,\"PNG\")" << endl; + out << indent << "self." << (*it) << ".loadFromData(" << (*it) << "_data,b\"PNG\")" << endl; } } // create pixmaps for all images diff --git a/pytquic3/uic.cpp b/pytquic3/uic.cpp index d5d89dc..e4a5ad0 100644 --- a/pytquic3/uic.cpp +++ b/pytquic3/uic.cpp @@ -387,9 +387,9 @@ void Uic::createActionImpl( const TQDomElement &n, const TQString &parent ) for ( TQDomElement ae = n; !ae.isNull(); ae = ae.nextSibling().toElement() ) { TQString objName = registerObject( getObjectName( ae ) ); if ( ae.tagName() == "action" ) - out << indent << "self." << objName << " = TQAction(" << parent << ",\"" << objName << "\")" << endl; + out << indent << "self." << objName << " = TQAction(" << parent << ",b\"" << objName << "\")" << endl; else if ( ae.tagName() == "actiongroup" ) - out << indent << "self." << objName << " = TQActionGroup(" << parent << ",\"" << objName << "\")" << endl; + out << indent << "self." << objName << " = TQActionGroup(" << parent << ",b\"" << objName << "\")" << endl; else continue; bool subActionsDone = FALSE;