|
|
|
@ -35,7 +35,7 @@ FALSE = 0
|
|
|
|
|
TRUE = not FALSE
|
|
|
|
|
addApp = TRUE
|
|
|
|
|
addImport = TRUE
|
|
|
|
|
pyuicPath = "pyuic"
|
|
|
|
|
pytquicPath = "pytquic"
|
|
|
|
|
filename = ""
|
|
|
|
|
i18nFunc = FALSE
|
|
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ def getOptions ():
|
|
|
|
|
|
|
|
|
|
opterr = 0
|
|
|
|
|
shortOptions = 'aip:'
|
|
|
|
|
longOptions = ['noapp', 'noimport', 'pyuic=', 'usetdei18n']
|
|
|
|
|
longOptions = ['noapp', 'noimport', 'pytquic=', 'usetdei18n']
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
optlist, args = getopt.getopt (sys.argv [1:], shortOptions, longOptions)
|
|
|
|
@ -64,7 +64,7 @@ def getOptions ():
|
|
|
|
|
Options:
|
|
|
|
|
-a, --noapp Don't add TDEApplication code
|
|
|
|
|
-i, --noimport Don't add tdecore, tdeui import statements
|
|
|
|
|
-p, --pyuic Path to pyuic program
|
|
|
|
|
-p, --pytquic Path to pytquic program
|
|
|
|
|
--usetdei18n Adds TDEs default i18n functions to your Python TDE ui file
|
|
|
|
|
""")
|
|
|
|
|
return FALSE
|
|
|
|
@ -73,7 +73,7 @@ def getOptions ():
|
|
|
|
|
return checkOptions (optlist)
|
|
|
|
|
|
|
|
|
|
def checkOptions (optlist):
|
|
|
|
|
global addApp, addImport, pyuicPath, i18nFunc
|
|
|
|
|
global addApp, addImport, pytquicPath, i18nFunc
|
|
|
|
|
|
|
|
|
|
for pair in optlist:
|
|
|
|
|
if (pair [0] == '--noapp') or (pair [0] == '-a'):
|
|
|
|
@ -82,8 +82,8 @@ def checkOptions (optlist):
|
|
|
|
|
elif (pair [0] == '--noimport') or (pair [0] == '-i'):
|
|
|
|
|
addImport = FALSE
|
|
|
|
|
|
|
|
|
|
elif (pair [0] == '--pyuic') or (pair [0] == '-p'):
|
|
|
|
|
pyuicPath = pair [1]
|
|
|
|
|
elif (pair [0] == '--pytquic') or (pair [0] == '-p'):
|
|
|
|
|
pytquicPath = pair [1]
|
|
|
|
|
|
|
|
|
|
if (pair [0] == '--usetdei18n'):
|
|
|
|
|
i18nFunc=TRUE
|
|
|
|
@ -109,7 +109,7 @@ def addapp (indent, n):
|
|
|
|
|
n.write (indent + 'TDECmdLineArgs.init (sys.argv, appname, description, version)\n')
|
|
|
|
|
n.write (indent + 'a = TDEApplication ()\n\n')
|
|
|
|
|
|
|
|
|
|
def doPyuic ():
|
|
|
|
|
def doPytquic ():
|
|
|
|
|
|
|
|
|
|
fn = os.path.splitext (os.path.basename(filename)) [0] + '.py'
|
|
|
|
|
opts = ""
|
|
|
|
@ -123,8 +123,8 @@ def doPyuic ():
|
|
|
|
|
opts = opts + ' -o '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if os.system (pyuicPath + opts + fn + ' ' + filename) != 0:
|
|
|
|
|
print(pyuicPath + opts + fn + ' ' + filename + " failed")
|
|
|
|
|
if os.system (pytquicPath + opts + fn + ' ' + filename) != 0:
|
|
|
|
|
print(pytquicPath + opts + fn + ' ' + filename + " failed")
|
|
|
|
|
sys.exit (-1)
|
|
|
|
|
|
|
|
|
|
if addApp or addImport:
|
|
|
|
@ -160,4 +160,4 @@ def doPyuic ():
|
|
|
|
|
# --------- main ----------
|
|
|
|
|
|
|
|
|
|
getOptions ()
|
|
|
|
|
doPyuic ()
|
|
|
|
|
doPytquic ()
|
|
|
|
|