diff options
Diffstat (limited to 'languages/python')
-rw-r--r-- | languages/python/app_templates/pyqt/app.py | 2 | ||||
-rw-r--r-- | languages/python/app_templates/pyqt/pyqt-am-preproc.py | 6 | ||||
-rw-r--r-- | languages/python/app_templates/pythonhello/app.py | 2 | ||||
-rw-r--r-- | languages/python/app_templates/pytk/app.py | 2 | ||||
-rwxr-xr-x | languages/python/kde_pydoc.py | 28 | ||||
-rw-r--r-- | languages/python/pydoc.cpp | 8 |
6 files changed, 26 insertions, 22 deletions
diff --git a/languages/python/app_templates/pyqt/app.py b/languages/python/app_templates/pyqt/app.py index ede8dc54..d2207de3 100644 --- a/languages/python/app_templates/pyqt/app.py +++ b/languages/python/app_templates/pyqt/app.py @@ -133,7 +133,7 @@ class %{APPNAME}(QMainWindow): def slotOpenFile(self): fileName = str(QFileDialog.getOpenFileName("", "", self)) - print fileName + print(fileName) if not fileName=="": self.load(fileName) else: diff --git a/languages/python/app_templates/pyqt/pyqt-am-preproc.py b/languages/python/app_templates/pyqt/pyqt-am-preproc.py index ff7b5a16..b58f3328 100644 --- a/languages/python/app_templates/pyqt/pyqt-am-preproc.py +++ b/languages/python/app_templates/pyqt/pyqt-am-preproc.py @@ -7,7 +7,7 @@ # Test real_lines properly # Process Makefile.am's in sub-directories -from __future__ import generators + import sys import re @@ -49,13 +49,13 @@ for l in real_lines(mf): variables[lhs]=rhs # look for app sources -for (var,data) in variables.items(): +for (var,data) in list(variables.items()): spl = var.split("_",1) spl.append("") (prefix,primary) = (spl[0], spl[1]) if primary=="PROGRAMS": target=data - if variables.has_key(target + "_SOURCES"): + if target + "_SOURCES" in variables: sources = variables[target+"_SOURCES"].split() # change .ui into .py diff --git a/languages/python/app_templates/pythonhello/app.py b/languages/python/app_templates/pythonhello/app.py index 3257ce62..33b8be2c 100644 --- a/languages/python/app_templates/pythonhello/app.py +++ b/languages/python/app_templates/pythonhello/app.py @@ -1,7 +1,7 @@ #!/usr/bin/env python def main(): - print 'Hello world!' + print('Hello world!') main() diff --git a/languages/python/app_templates/pytk/app.py b/languages/python/app_templates/pytk/app.py index 39f4aa84..d86508cf 100644 --- a/languages/python/app_templates/pytk/app.py +++ b/languages/python/app_templates/pytk/app.py @@ -1,4 +1,4 @@ -from Tkinter import * +from tkinter import * widget = Label(None, text='Hello world!') widget.pack() widget.mainloop() diff --git a/languages/python/kde_pydoc.py b/languages/python/kde_pydoc.py index 0516f172..c7c246bc 100755 --- a/languages/python/kde_pydoc.py +++ b/languages/python/kde_pydoc.py @@ -6,7 +6,7 @@ __author__ = "David Nolden<david.kde@art-master.de>, Ka-Ping Yee <ping@lfw.org> __version__ = "6 April 2006" import sys, imp, os, stat, re, types, cgi -from repr import Repr +from reprlib import Repr from string import expandtabs, find, join, lower, split, strip, rstrip import pydoc @@ -67,9 +67,9 @@ def writedocs(path, pkgpath='', depth=0, notprocessed=[]): if(depth == 1): if(len(notprocessed) != 0): - print "<br> the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":<br>" + print("<br> the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":<br>") for x in notprocessed: - print cgi.escape(x) + " <br>" + print(cgi.escape(x) + " <br>") def writedoc(key,top=False): """Write HTML documentation to a file in the current directory.""" @@ -86,19 +86,19 @@ def writedoc(key,top=False): seen = {} for dir in pydoc.pathdirs(): indices.append(pydoc.html.index(dir, seen)) - print cleanlinks(heading + join(indices)) + print(cleanlinks(heading + join(indices))) return if(type(key) != types.ModuleType): object = pydoc.locate(key) if(object == None and top): - print "could not locate module/object for key " + \ - cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>"; + print("could not locate module/object for key " + \ + cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>"); else: object = key if object: - print cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object))) + print(cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object)))) @@ -109,9 +109,9 @@ if __name__ == '__main__': try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') - print "<html>" - print "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" - print "</head><body>" + print("<html>") + print("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">") + print("</head><body>") if args: for arg in args: @@ -121,11 +121,11 @@ if __name__ == '__main__': if os.path.isfile(arg): arg = pydoc.importfile(arg) writedoc(arg, True) - except pydoc.ErrorDuringImport, value: - print 'problem in %s - %s' % ( - cgi.escape(value.filename), cgi.escape(value.exc)) + except pydoc.ErrorDuringImport as value: + print('problem in %s - %s' % ( + cgi.escape(value.filename), cgi.escape(value.exc))) else: raise BadUsage except (getopt.error, BadUsage): - print "need parameters\n" + print("need parameters\n") diff --git a/languages/python/pydoc.cpp b/languages/python/pydoc.cpp index bcb38b1e..86027d3a 100644 --- a/languages/python/pydoc.cpp +++ b/languages/python/pydoc.cpp @@ -19,8 +19,12 @@ using namespace TDEIO; PydocProtocol::PydocProtocol(const TQCString &pool, const TQCString &app) : SlaveBase("pydoc", pool, app), key() { - python = TDEGlobal::dirs()->findExe("python"); - script = locate("data", "tdeio_pydoc/kde_pydoc.py"); + python = TDEGlobal::dirs()->findExe("python3"); + if(python.isEmpty()) + { + python = TDEGlobal::dirs()->findExe("python"); + } + script = locate("data", "tdeio_pydoc/kde_pydoc.py"); } |