summaryrefslogtreecommitdiffstats
path: root/languages/python
diff options
context:
space:
mode:
Diffstat (limited to 'languages/python')
-rw-r--r--languages/python/app_templates/pyqt/app.py4
-rw-r--r--languages/python/app_templates/pyqt/pyqt-am-preproc.py6
-rw-r--r--languages/python/app_templates/pyqt/templates-ui-dialog2
-rw-r--r--languages/python/app_templates/pyqt/templates-ui-mainwin21
-rw-r--r--languages/python/app_templates/pythonhello/app.py2
-rw-r--r--languages/python/app_templates/pytk/app.py2
-rwxr-xr-xlanguages/python/kde_pydoc.py28
-rw-r--r--languages/python/pydoc.cpp14
-rw-r--r--languages/python/pythonconfigwidget.h2
-rw-r--r--languages/python/pythonimplementationwidget.h2
-rw-r--r--languages/python/pythonsupportpart.cpp48
-rw-r--r--languages/python/pythonsupportpart.h2
-rw-r--r--languages/python/tqtdesignerpythonintegration.h2
13 files changed, 62 insertions, 73 deletions
diff --git a/languages/python/app_templates/pyqt/app.py b/languages/python/app_templates/pyqt/app.py
index ede8dc54..960dcf40 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:
@@ -262,7 +262,7 @@ def main(args):
app=QApplication(args)
mainWindow = %{APPNAME}()
mainWindow.show()
- app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+ app.connect(app, TQ_SIGNAL("lastWindowClosed()"), app, TQ_SLOT("quit()"))
app.exec_loop()
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/pyqt/templates-ui-dialog b/languages/python/app_templates/pyqt/templates-ui-dialog
index 92e9bfff..16eb3a67 100644
--- a/languages/python/app_templates/pyqt/templates-ui-dialog
+++ b/languages/python/app_templates/pyqt/templates-ui-dialog
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>Form1</class>
-<widget class=TQDIALOG_OBJECT_NAME_STRING>
+<widget class="TQDialog">
<property name="name">
<cstring>Form1</cstring>
</property>
diff --git a/languages/python/app_templates/pyqt/templates-ui-mainwin b/languages/python/app_templates/pyqt/templates-ui-mainwin
index fd24b2f5..62d6d51a 100644
--- a/languages/python/app_templates/pyqt/templates-ui-mainwin
+++ b/languages/python/app_templates/pyqt/templates-ui-mainwin
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>Form1</class>
-<widget class=TQMAINWINDOW_OBJECT_NAME_STRING>
+<widget class="TQMainWindow">
<property name="name">
<cstring>Form1</cstring>
</property>
@@ -111,9 +111,6 @@
<property name="menuText">
<string>Save &amp;As...</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</action>
<action>
<property name="name">
@@ -142,9 +139,6 @@
<property name="menuText">
<string>E&amp;xit</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</action>
<action>
<property name="name">
@@ -258,9 +252,6 @@
<property name="menuText">
<string>&amp;Contents...</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</action>
<action>
<property name="name">
@@ -272,9 +263,6 @@
<property name="menuText">
<string>&amp;Index...</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</action>
<action>
<property name="name">
@@ -286,9 +274,6 @@
<property name="menuText">
<string>&amp;About</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</action>
</actions>
<images>
@@ -415,7 +400,7 @@
<slot>helpAbout()</slot>
</connection>
</connections>
-<Q_SLOTS>
+<slots>
<slot>fileNew()</slot>
<slot>fileOpen()</slot>
<slot>fileSave()</slot>
@@ -431,6 +416,6 @@
<slot>helpIndex()</slot>
<slot>helpContents()</slot>
<slot>helpAbout()</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
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..489cdb35 100644
--- a/languages/python/pydoc.cpp
+++ b/languages/python/pydoc.cpp
@@ -6,9 +6,9 @@
#include <unistd.h>
#include <tqtextstream.h>
-#include <kstandarddirs.h>
-#include <kinstance.h>
-#include <kprocess.h>
+#include <tdestandarddirs.h>
+#include <tdeinstance.h>
+#include <tdeprocess.h>
#include <tdeversion.h>
#include <tdeglobal.h>
#include <tdelocale.h>
@@ -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");
}
diff --git a/languages/python/pythonconfigwidget.h b/languages/python/pythonconfigwidget.h
index ceb395d9..d2d2fcd6 100644
--- a/languages/python/pythonconfigwidget.h
+++ b/languages/python/pythonconfigwidget.h
@@ -18,7 +18,7 @@
class PythonConfigWidget : public PythonConfigWidgetBase
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/languages/python/pythonimplementationwidget.h b/languages/python/pythonimplementationwidget.h
index c8e1cbde..52a806f0 100644
--- a/languages/python/pythonimplementationwidget.h
+++ b/languages/python/pythonimplementationwidget.h
@@ -24,7 +24,7 @@
class PythonImplementationWidget : public ImplementationWidget
{
-Q_OBJECT
+TQ_OBJECT
public:
PythonImplementationWidget(KDevLanguageSupport* part, TQWidget* parent = 0, const char* name = 0, bool modal = true);
diff --git a/languages/python/pythonsupportpart.cpp b/languages/python/pythonsupportpart.cpp
index e7529c2f..333d5c82 100644
--- a/languages/python/pythonsupportpart.cpp
+++ b/languages/python/pythonsupportpart.cpp
@@ -39,47 +39,47 @@
#include "pythonimplementationwidget.h"
typedef KDevGenericFactory<PythonSupportPart> PythonSupportFactory;
-static const KDevPluginInfo data("kdevpythonsupport");
-K_EXPORT_COMPONENT_FACTORY( libkdevpythonsupport, PythonSupportFactory( data ) )
+static const KDevPluginInfo pluginData("kdevpythonsupport");
+K_EXPORT_COMPONENT_FACTORY( libkdevpythonsupport, PythonSupportFactory( pluginData ) )
PythonSupportPart::PythonSupportPart(TQObject *parent, const char *name, const TQStringList &)
- : KDevLanguageSupport(&data, parent, name ? name : "PythonSupportPart")
+ : KDevLanguageSupport(&pluginData, parent, name ? name : "PythonSupportPart")
{
setInstance(PythonSupportFactory::instance());
setXMLFile("kdevpythonsupport.rc");
- connect( core(), TQT_SIGNAL(projectOpened()), this, TQT_SLOT(projectOpened()) );
- connect( core(), TQT_SIGNAL(projectClosed()), this, TQT_SLOT(projectClosed()) );
- connect( partController(), TQT_SIGNAL(savedFile(const KURL&)),
- this, TQT_SLOT(savedFile(const KURL&)) );
- connect( core(), TQT_SIGNAL(projectConfigWidget(KDialogBase*)),
- this, TQT_SLOT(projectConfigWidget(KDialogBase*)) );
- connect( core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)),
- this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *)) );
+ connect( core(), TQ_SIGNAL(projectOpened()), this, TQ_SLOT(projectOpened()) );
+ connect( core(), TQ_SIGNAL(projectClosed()), this, TQ_SLOT(projectClosed()) );
+ connect( partController(), TQ_SIGNAL(savedFile(const KURL&)),
+ this, TQ_SLOT(savedFile(const KURL&)) );
+ connect( core(), TQ_SIGNAL(projectConfigWidget(KDialogBase*)),
+ this, TQ_SLOT(projectConfigWidget(KDialogBase*)) );
+ connect( core(), TQ_SIGNAL(contextMenu(TQPopupMenu *, const Context *)),
+ this, TQ_SLOT(contextMenu(TQPopupMenu *, const Context *)) );
TDEAction *action;
action = new TDEAction( i18n("Execute Program"), "application-x-executable", 0,
- this, TQT_SLOT(slotExecute()),
+ this, TQ_SLOT(slotExecute()),
actionCollection(), "build_exec" );
action->setToolTip( i18n("Execute program") );
action->setWhatsThis(i18n("<b>Execute program</b><p>Runs the Python program."));
action = new TDEAction( i18n("Execute String..."), "application-x-executable", 0,
- this, TQT_SLOT(slotExecuteString()),
+ this, TQ_SLOT(slotExecuteString()),
actionCollection(), "build_execstring" );
action->setToolTip( i18n("Execute string") );
action->setWhatsThis(i18n("<b>Execute String</b><p>Executes a string as Python code."));
action = new TDEAction( i18n("Start Python Interpreter"), "application-x-executable", 0,
- this, TQT_SLOT(slotStartInterpreter()),
+ this, TQ_SLOT(slotStartInterpreter()),
actionCollection(), "build_runinterpreter" );
action->setToolTip( i18n("Start Python interpreter") );
action->setWhatsThis(i18n("<b>Start python interpreter</b><p>Starts the Python interpreter without a program"));
action = new TDEAction( i18n("Python Documentation..."), 0,
- this, TQT_SLOT(slotPydoc()),
+ this, TQ_SLOT(slotPydoc()),
actionCollection(), "help_pydoc" );
action->setToolTip( i18n("Python documentation") );
action->setWhatsThis(i18n("<b>Python documentation</b><p>Shows a Python documentation page."));
@@ -99,7 +99,7 @@ void PythonSupportPart::contextMenu(TQPopupMenu *popup, const Context *context)
if (url.fileName().endsWith(".ui"))
{
m_contextFileName = url.fileName();
- int id = popup->insertItem(i18n("Create or Select Implementation..."), this, TQT_SLOT(slotCreateSubclass()));
+ int id = popup->insertItem(i18n("Create or Select Implementation..."), this, TQ_SLOT(slotCreateSubclass()));
popup->setWhatsThis(id, i18n("<b>Create or select implementation</b><p>Creates or selects a subclass of selected form for use with integrated KDevDesigner."));
}
}
@@ -110,7 +110,7 @@ void PythonSupportPart::projectConfigWidget(KDialogBase *dlg)
{
TQVBox *vbox = dlg->addVBoxPage(i18n("Python"));
PythonConfigWidget *w = new PythonConfigWidget(*projectDom(), vbox, "python config widget");
- connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept()) );
+ connect( dlg, TQ_SIGNAL(okClicked()), w, TQ_SLOT(accept()) );
}
@@ -118,14 +118,14 @@ void PythonSupportPart::projectOpened()
{
kdDebug(9014) << "projectOpened()" << endl;
- connect( project(), TQT_SIGNAL(addedFilesToProject(const TQStringList &)),
- this, TQT_SLOT(addedFilesToProject(const TQStringList &)) );
- connect( project(), TQT_SIGNAL(removedFilesFromProject(const TQStringList &)),
- this, TQT_SLOT(removedFilesFromProject(const TQStringList &)) );
+ connect( project(), TQ_SIGNAL(addedFilesToProject(const TQStringList &)),
+ this, TQ_SLOT(addedFilesToProject(const TQStringList &)) );
+ connect( project(), TQ_SIGNAL(removedFilesFromProject(const TQStringList &)),
+ this, TQ_SLOT(removedFilesFromProject(const TQStringList &)) );
// We want to parse only after all components have been
// properly initialized
- TQTimer::singleShot(0, this, TQT_SLOT(initialParse()));
+ TQTimer::singleShot(0, this, TQ_SLOT(initialParse()));
}
@@ -154,7 +154,7 @@ void PythonSupportPart::initialParse()
kdDebug(9014) << "initialParse()" << endl;
if (project()) {
- kapp->setOverrideCursor(waitCursor);
+ tdeApp->setOverrideCursor(waitCursor);
TQStringList files = project()->allFiles();
for (TQStringList::Iterator it = files.begin(); it != files.end() ;++it) {
kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl;
@@ -162,7 +162,7 @@ void PythonSupportPart::initialParse()
}
emit updatedSourceInfo();
- kapp->restoreOverrideCursor();
+ tdeApp->restoreOverrideCursor();
} else {
kdDebug(9014) << "No project" << endl;
}
diff --git a/languages/python/pythonsupportpart.h b/languages/python/pythonsupportpart.h
index c60a2eb3..fcac6e6c 100644
--- a/languages/python/pythonsupportpart.h
+++ b/languages/python/pythonsupportpart.h
@@ -22,7 +22,7 @@ class Context;
class PythonSupportPart : public KDevLanguageSupport
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/languages/python/tqtdesignerpythonintegration.h b/languages/python/tqtdesignerpythonintegration.h
index 9878acad..8d276817 100644
--- a/languages/python/tqtdesignerpythonintegration.h
+++ b/languages/python/tqtdesignerpythonintegration.h
@@ -24,7 +24,7 @@
class QtDesignerPythonIntegration : public QtDesignerIntegration
{
-Q_OBJECT
+TQ_OBJECT
public:
QtDesignerPythonIntegration(KDevLanguageSupport* part, ImplementationWidget* impl);