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