Fixing tdedesigner and tqtuicompiler modules not working

Python3 compatibility fix

Signed-off-by: ormorph <roma251078@mail.ru>
(cherry picked from commit 69bf5c34cb)
r14.1.x r14.1.2
ormorph 7 months ago committed by Michele Calgaro
parent b1511452b9
commit 511bdc21c8
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -15,11 +15,11 @@
# #
###########################################################################
import __builtin__
import builtins as __builtin__
import tqtuicompiler
python_import = __builtin__.__import__
def load(*args):
tqtuicompiler.DynamicImport(args,True)
return apply(python_import,args)
def load(name, glob = None, loc = None, fromlist = tuple(), level = 0):
tqtuicompiler.DynamicImport((name,),True)
return python_import(name, glob, loc, fromlist, level)
__builtin__.__import__ = load

@ -15,12 +15,12 @@
# #
###########################################################################
import __builtin__
import builtins as __builtin__
import tqtuicompiler
python_import = __builtin__.__import__
def load(*args):
tqtuicompiler.DynamicImport(args,False)
return apply(python_import,args)
def load(name, glob = None, loc = None, fromlist = tuple(), level = 0):
tqtuicompiler.DynamicImport((name,),False)
return python_import(name, glob, loc, fromlist, level)
__builtin__.__import__ = load

@ -59,11 +59,11 @@ def CompileUI(ui_file_name, py_file_name=None, kde=False):
input = open(tmp_file_name, 'r')
output = open(py_file_name, 'w')
for line in input.readlines():
if kde and string.strip(line) == 'from PyTQt.tqt import *':
if kde and str.strip(line) == 'from PyTQt.tqt import *':
output.write(line)
output.write('from tdecore import *\nfrom tdeui import *\n\n')
elif kde and string.find(line, " = KDatePicker(") != -1:
o = string.find(line, ",")
elif kde and str.find(line, " = KDatePicker(") != -1:
o = str.find(line, ",")
output.write(line[:o] + ",TQDate.currentDate()" + line[o:])
else:
output.write (line)

Loading…
Cancel
Save