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