Convert tdepyuic to support Python 3.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/8/head
Slávek Banko 2 years ago
parent 62f0c8899c
commit 12236609d0
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -57,7 +57,7 @@ def getOptions ():
args = []
if opterr or (len (args) != 1):
print """\nUsage:
print("""\nUsage:
tdepyuic [options] filename.ui
@ -66,7 +66,7 @@ def getOptions ():
-i, --noimport Don't add tdecore, tdeui import statements
-p, --pyuic Path to pyuic program
--usetdei18n Adds TDEs default i18n functions to your Python TDE ui file
"""
""")
return FALSE
filename = args[0]
@ -124,7 +124,7 @@ def doPyuic ():
if os.system (pyuicPath + opts + fn + ' ' + filename) != 0:
print pyuicPath + opts + fn + ' ' + filename + " failed"
print(pyuicPath + opts + fn + ' ' + filename + " failed")
sys.exit (-1)
if addApp or addImport:
@ -134,16 +134,16 @@ def doPyuic ():
buff = m.readlines ()
for line in buff:
if addImport and (string.strip (line) == 'from PyTQt.qt import *'):
if addImport and (line.strip() == 'from PyTQt.qt import *'):
n.write (line)
addimport (n)
elif addApp and (string.strip (line) == 'a = TQApplication(sys.argv)'):
elif addApp and (line.strip() == 'a = TQApplication(sys.argv)'):
indent = 0
while line [indent] in string.whitespace:
indent = indent + 1
addapp (line[:indent], n)
elif string.find(line, " = KDatePicker(") != -1:
o = string.find(line, ",")
elif line.find(" = KDatePicker(") != -1:
o = line.find(",")
n.write (line[:o] + ",TQDate.currentDate()" + line[o:])
else:
n.write (line)
@ -154,7 +154,7 @@ def doPyuic ():
os.unlink (fn)
os.rename (fn + '.tmp', fn)
print fn + ' written'
print(fn + ' written')
# --------- main ----------

Loading…
Cancel
Save