From 12236609d02d708a0076a78145d527e023f47bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 17 Jan 2023 02:24:54 +0100 Subject: Convert tdepyuic to support Python 3. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- contrib/tdepyuic | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/tdepyuic b/contrib/tdepyuic index 147711b..48444a8 100755 --- a/contrib/tdepyuic +++ b/contrib/tdepyuic @@ -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 ---------- -- cgit v1.2.1