From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- languages/python/Makefile.am | 31 + languages/python/README.dox | 48 + languages/python/app_templates/Makefile.am | 3 + languages/python/app_templates/pyqt/.kdev_ignore | 0 languages/python/app_templates/pyqt/Makefile.am | 20 + .../python/app_templates/pyqt/app-Makefile.am | 14 + languages/python/app_templates/pyqt/app-autogen.sh | 10 + .../python/app_templates/pyqt/app-configure.ac | 32 + languages/python/app_templates/pyqt/app.kdevelop | 81 + languages/python/app_templates/pyqt/app.py | 271 ++++ .../python/app_templates/pyqt/documentdetails.ui | 80 + languages/python/app_templates/pyqt/fileopen.pyxpm | 19 + .../python/app_templates/pyqt/fileprint.pyxpm | 21 + languages/python/app_templates/pyqt/filesave.pyxpm | 19 + languages/python/app_templates/pyqt/install-sh | 0 languages/python/app_templates/pyqt/missing | 0 languages/python/app_templates/pyqt/mkinstalldirs | 0 languages/python/app_templates/pyqt/pyqt | 10 + .../python/app_templates/pyqt/pyqt-am-preproc.py | 85 ++ .../python/app_templates/pyqt/pyqt.kdevtemplate | 168 +++ languages/python/app_templates/pyqt/pyqt.png | Bin 0 -> 8800 bytes .../python/app_templates/pyqt/templates-ui-dialog | 20 + .../python/app_templates/pyqt/templates-ui-mainwin | 436 ++++++ languages/python/app_templates/python.appwizard | 2 + .../python/app_templates/pythonhello/.kdev_ignore | 0 .../python/app_templates/pythonhello/Makefile.am | 15 + .../python/app_templates/pythonhello/app.kdevelop | 84 ++ languages/python/app_templates/pythonhello/app.py | 7 + .../python/app_templates/pythonhello/pythonhello | 12 + .../pythonhello/pythonhello.kdevtemplate | 107 ++ .../app_templates/pythonhello/pythonhello.png | Bin 0 -> 12443 bytes languages/python/app_templates/pytk/.kdev_ignore | 0 languages/python/app_templates/pytk/Makefile.am | 15 + languages/python/app_templates/pytk/app.kdevelop | 82 + languages/python/app_templates/pytk/app.py | 4 + languages/python/app_templates/pytk/pytk | 12 + .../python/app_templates/pytk/pytk.kdevtemplate | 107 ++ languages/python/app_templates/pytk/pytk.png | Bin 0 -> 2420 bytes languages/python/doc/Makefile.am | 6 + languages/python/doc/python.toc | 1571 ++++++++++++++++++++ languages/python/doc/python_bugs.toc | 7 + languages/python/file_templates/Makefile.am | 4 + languages/python/file_templates/py | 7 + languages/python/kde_pydoc.py | 131 ++ languages/python/kdevpythonsupport.desktop | 85 ++ languages/python/kdevpythonsupport.rc | 16 + languages/python/pydoc.cpp | 113 ++ languages/python/pydoc.h | 30 + languages/python/pydoc.protocol | 9 + languages/python/pythonconfigwidget.cpp | 38 + languages/python/pythonconfigwidget.h | 34 + languages/python/pythonconfigwidgetbase.ui | 121 ++ languages/python/pythonimplementationwidget.cpp | 77 + languages/python/pythonimplementationwidget.h | 37 + languages/python/pythonsupportpart.cpp | 410 +++++ languages/python/pythonsupportpart.h | 66 + languages/python/qtdesignerpythonintegration.cpp | 97 ++ languages/python/qtdesignerpythonintegration.h | 37 + 58 files changed, 4711 insertions(+) create mode 100644 languages/python/Makefile.am create mode 100644 languages/python/README.dox create mode 100644 languages/python/app_templates/Makefile.am create mode 100644 languages/python/app_templates/pyqt/.kdev_ignore create mode 100644 languages/python/app_templates/pyqt/Makefile.am create mode 100644 languages/python/app_templates/pyqt/app-Makefile.am create mode 100644 languages/python/app_templates/pyqt/app-autogen.sh create mode 100644 languages/python/app_templates/pyqt/app-configure.ac create mode 100644 languages/python/app_templates/pyqt/app.kdevelop create mode 100644 languages/python/app_templates/pyqt/app.py create mode 100644 languages/python/app_templates/pyqt/documentdetails.ui create mode 100644 languages/python/app_templates/pyqt/fileopen.pyxpm create mode 100644 languages/python/app_templates/pyqt/fileprint.pyxpm create mode 100644 languages/python/app_templates/pyqt/filesave.pyxpm create mode 100644 languages/python/app_templates/pyqt/install-sh create mode 100644 languages/python/app_templates/pyqt/missing create mode 100644 languages/python/app_templates/pyqt/mkinstalldirs create mode 100644 languages/python/app_templates/pyqt/pyqt create mode 100644 languages/python/app_templates/pyqt/pyqt-am-preproc.py create mode 100644 languages/python/app_templates/pyqt/pyqt.kdevtemplate create mode 100644 languages/python/app_templates/pyqt/pyqt.png create mode 100644 languages/python/app_templates/pyqt/templates-ui-dialog create mode 100644 languages/python/app_templates/pyqt/templates-ui-mainwin create mode 100644 languages/python/app_templates/python.appwizard create mode 100644 languages/python/app_templates/pythonhello/.kdev_ignore create mode 100644 languages/python/app_templates/pythonhello/Makefile.am create mode 100644 languages/python/app_templates/pythonhello/app.kdevelop create mode 100644 languages/python/app_templates/pythonhello/app.py create mode 100644 languages/python/app_templates/pythonhello/pythonhello create mode 100644 languages/python/app_templates/pythonhello/pythonhello.kdevtemplate create mode 100644 languages/python/app_templates/pythonhello/pythonhello.png create mode 100644 languages/python/app_templates/pytk/.kdev_ignore create mode 100644 languages/python/app_templates/pytk/Makefile.am create mode 100644 languages/python/app_templates/pytk/app.kdevelop create mode 100644 languages/python/app_templates/pytk/app.py create mode 100644 languages/python/app_templates/pytk/pytk create mode 100644 languages/python/app_templates/pytk/pytk.kdevtemplate create mode 100644 languages/python/app_templates/pytk/pytk.png create mode 100644 languages/python/doc/Makefile.am create mode 100644 languages/python/doc/python.toc create mode 100644 languages/python/doc/python_bugs.toc create mode 100644 languages/python/file_templates/Makefile.am create mode 100644 languages/python/file_templates/py create mode 100755 languages/python/kde_pydoc.py create mode 100644 languages/python/kdevpythonsupport.desktop create mode 100644 languages/python/kdevpythonsupport.rc create mode 100644 languages/python/pydoc.cpp create mode 100644 languages/python/pydoc.h create mode 100644 languages/python/pydoc.protocol create mode 100644 languages/python/pythonconfigwidget.cpp create mode 100644 languages/python/pythonconfigwidget.h create mode 100644 languages/python/pythonconfigwidgetbase.ui create mode 100644 languages/python/pythonimplementationwidget.cpp create mode 100644 languages/python/pythonimplementationwidget.h create mode 100644 languages/python/pythonsupportpart.cpp create mode 100644 languages/python/pythonsupportpart.h create mode 100644 languages/python/qtdesignerpythonintegration.cpp create mode 100644 languages/python/qtdesignerpythonintegration.h (limited to 'languages/python') diff --git a/languages/python/Makefile.am b/languages/python/Makefile.am new file mode 100644 index 00000000..ddebc35d --- /dev/null +++ b/languages/python/Makefile.am @@ -0,0 +1,31 @@ +# Here resides the Python support part. +# Do not confuse this with the python part responsible for KDevelop scripting + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/languages/lib/designer_integration \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util -I$(top_builddir)/languages/lib/designer_integration \ + $(all_includes) +SUBDIRS = app_templates file_templates doc + + +kde_module_LTLIBRARIES = libkdevpythonsupport.la kio_pydoc.la + +libkdevpythonsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevpythonsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/languages/lib/designer_integration/libdesignerintegration.la +libkdevpythonsupport_la_SOURCES = pythonsupportpart.cpp pythonconfigwidget.cpp pythonconfigwidgetbase.ui \ + pythonimplementationwidget.cpp qtdesignerpythonintegration.cpp + +kio_pydoc_la_SOURCES = pydoc.cpp +kio_pydoc_la_LIBADD = $(LIB_KIO) +kio_pydoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +METASOURCES = AUTO + +slavedir = $(kde_datadir)/kio_pydoc +slave_DATA = kde_pydoc.py + +servicedir = $(kde_servicesdir) +service_DATA = kdevpythonsupport.desktop pydoc.protocol + +rcdir = $(kde_datadir)/kdevpythonsupport +rc_DATA = kdevpythonsupport.rc diff --git a/languages/python/README.dox b/languages/python/README.dox new file mode 100644 index 00000000..77d0f44c --- /dev/null +++ b/languages/python/README.dox @@ -0,0 +1,48 @@ +/** \class PythonSupportPart +This is a Python support plugin. + +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +This is code, html links link text, +and images. + +\authors Bernd Gehrmann + +\maintainer $AUTHOR$ +\maintainer 2nd maintainer full name +... +\maintainer nth maintainer full name + +\feature Python support +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/python/app_templates/Makefile.am b/languages/python/app_templates/Makefile.am new file mode 100644 index 00000000..1ca030e1 --- /dev/null +++ b/languages/python/app_templates/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = pythonhello pytk pyqt +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/ScriptingLanguageIDE/PythonIDE +profiles_DATA = python.appwizard diff --git a/languages/python/app_templates/pyqt/.kdev_ignore b/languages/python/app_templates/pyqt/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pyqt/Makefile.am b/languages/python/app_templates/pyqt/Makefile.am new file mode 100644 index 00000000..ea9502cc --- /dev/null +++ b/languages/python/app_templates/pyqt/Makefile.am @@ -0,0 +1,20 @@ +dataFiles = app.py app.kdevelop fileopen.pyxpm fileprint.pyxpm \ + filesave.pyxpm app-Makefile.am app-autogen.sh app-configure.ac \ + documentdetails.ui missing install-sh mkinstalldirs \ + pyqt-am-preproc.py templates-ui-dialog templates-ui-mainwin \ + pyqt.png +templateName = pyqt + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/python/app_templates/pyqt/app-Makefile.am b/languages/python/app_templates/pyqt/app-Makefile.am new file mode 100644 index 00000000..78df3505 --- /dev/null +++ b/languages/python/app_templates/pyqt/app-Makefile.am @@ -0,0 +1,14 @@ + +EXEEXT= + +pyui_files= documentdetails.py + +%.py : %.ui + pyuic $< >$@ + + +bin_PROGRAMS = %{APPNAMELC} +%{APPNAMELC}_SOURCES = %{APPNAMELC}.py documentdetails.ui + +%{APPNAMELC}$(EXEEXT): $(pyui_files) + echo "Done" diff --git a/languages/python/app_templates/pyqt/app-autogen.sh b/languages/python/app_templates/pyqt/app-autogen.sh new file mode 100644 index 00000000..b380ddfd --- /dev/null +++ b/languages/python/app_templates/pyqt/app-autogen.sh @@ -0,0 +1,10 @@ +#!/bin/sh +echo "Running aclocal" +aclocal +echo "Running autoconf" +autoconf +echo "Processing Makefile.am" +python pyqt-am-preproc.py +echo "Running automake" +automake +echo "Done." diff --git a/languages/python/app_templates/pyqt/app-configure.ac b/languages/python/app_templates/pyqt/app-configure.ac new file mode 100644 index 00000000..62903c0f --- /dev/null +++ b/languages/python/app_templates/pyqt/app-configure.ac @@ -0,0 +1,32 @@ + +AC_INIT +AM_INIT_AUTOMAKE(testprog,[0.1]) + +AC_PROG_MAKE_SET + +# python interpreter check +AC_PATH_PROG([PYTHON],[python]) +if test -z "${PYTHON}" ; then + AC_MSG_ERROR([you need Python to use this program]) +fi + +# PyQT check +AC_MSG_CHECKING([whether PyQT can be used by Python]) +pyqt_present=no +cat >pyqttest.py </dev/null 2>&1 && pyqt_present=yes +AC_MSG_RESULT([$pyqt_present]) + +# pyuic check +AC_PATH_PROG([PYUIC],[pyuic]) +if test -z "${PYUIC}" ; then + AC_MSG_ERROR([cannot find pyuic (part of the PyQT package)]) +fi +AC_SUBST([PYUIC]) +AC_SUBST([PYTHON]) + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT diff --git a/languages/python/app_templates/pyqt/app.kdevelop b/languages/python/app_templates/pyqt/app.kdevelop new file mode 100644 index 00000000..a8fb1726 --- /dev/null +++ b/languages/python/app_templates/pyqt/app.kdevelop @@ -0,0 +1,81 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevAutoProject + Python + + Python + qt + + + + + + + + + ./%{APPNAMELC}.py + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + libc + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + false + *.o,*.lo,CVS + + + + + + + + + + + + + diff --git a/languages/python/app_templates/pyqt/app.py b/languages/python/app_templates/pyqt/app.py new file mode 100644 index 00000000..ede8dc54 --- /dev/null +++ b/languages/python/app_templates/pyqt/app.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python + +############################################################################# +# %{APPNAME} - PyQT application template for KDevelop +# +# Translated from C++ qmakeapp.cpp +# (qmakeapp.cpp - Copyright (C) 1992-2002 Trolltech AS. All rights reserved.) +# +# This file is part of an example program for Qt. This example +# program may be used, distributed and modified without limitation. +# +############################################################################# + +import sys +import os.path +from qt import * + +import documentdetails + +false = 0 +true = 1 + +def load_QPixMap(fileName): + f = open(os.path.join(sys.path[0],fileName),"r") + result = QPixmap(f.readlines()) + f.close() + return result + +class %{APPNAME}(QMainWindow): + """An application called %{APPNAME}.""" + + def __init__(self): + QMainWindow.__init__(self, None, "%{APPNAME}") + self.initIcons() + self.setup() + self.initPrinter() + self.initToolBar() + self.initMenu() + self.initMainWidget() + self.setCaption(self.appTitle) + + def setup(self): + + self.appTitle = "%{APPNAME} - PyQT Application Example" + + self.menu = [ + ('&File', + [('&New', self.slotNewFile), + ('&Open...', self.slotOpenFile, self.openIcon), + ('&Save', self.slotSaveFile, self.saveIcon), + ('Save &as...', self.slotSaveAs), + ('&Print...', self.slotPrint, self.printIcon), + ('&Edit details...', self.slotEditDetails), + (None,)]), + ('&Help', + [('&About', self.slotAbout), + ('About &QT', self.slotAboutQT), + (None, ), + ('What\'s this', self.slotWhatsThis)]) + ] + + self.toolbar = [ + ("filetools", "file operations", "File Operations", + [("fileopen", + (self.openIcon, "open file", "Open File", self.slotOpenFile), + "

Click this button to open a new file.
" + \ + "You can also select the Open command " + \ + "from the File menu.

"), + ("filesave", + (self.saveIcon, "save file", "Save File", self.slotSaveFile), + "

Click this button to save the file you " + \ + "are editing. You will be prompted for a file name.\n" + \ + "You can also select the Save command " + \ + "from the File menu.

"), + ("fileprint", + (self.printIcon, "print file", "Print File", self.slotPrint), + "Click this button to print the file you " + \ + "are editing.\n You can also select the Print " + \ + "command from the File menu." + )])] + + self.fileName = "" + + + def initMainWidget(self): + self.editor = QTextEdit(self, "editor") + self.editor.setFocus() + self.setCentralWidget(self.editor) + self.statusBar().message("Ready", 2000) + self.resize(450,600) + + def initPrinter(self): + self.printer = QPrinter() + + def initIcons(self): + self.openIcon = QIconSet( load_QPixMap("fileopen.pyxpm")) + self.saveIcon = QIconSet( load_QPixMap("filesave.pyxpm")) + self.printIcon = QIconSet( load_QPixMap("fileprint.pyxpm")) + + def initToolBar(self): + + self.toolbars = {} + for (toolBarID, toolBarName, toolBarDescr, toolBarButtons) in self.toolbar: + self.toolbars[toolBarID] = QToolBar(self, toolBarName) + self.toolbars[toolBarID].setLabel(toolBarDescr) + for (buttonID, (buttonIcon, buttonName, buttonText, buttonSlot), whatsThisText) in toolBarButtons: + toolButton = QToolButton(buttonIcon, buttonText, "", buttonSlot, self.toolbars[toolBarID], buttonName) + QWhatsThis.add( toolButton, whatsThisText ) + self.whatsThisButton = QWhatsThis.whatsThisButton(self.toolbars[toolBarID]) + + + def initMenu(self): + + for (menuName, subMenu) in self.menu: + menu = QPopupMenu(self) + self.menuBar().insertItem( menuName, menu ) + for menuOption in subMenu: + if len(menuOption)==1: + menu.insertSeparator() + elif len(menuOption)==2: + menu.insertItem( menuOption[0], menuOption[1] ) + elif len(menuOption)==3: + menu.insertItem( menuOption[2], \ + menuOption[0], \ + menuOption[1] ) + + + + def slotNewFile(self): + ed = %{APPNAME}() + ed.setCaption(self.appTitle) + ed.show() + + def slotOpenFile(self): + fileName = str(QFileDialog.getOpenFileName("", "", self)) + print fileName + if not fileName=="": + self.load(fileName) + else: + self.statusBar().message("Loading aborted", 2000) + + def slotSaveFile(self): + if self.fileName=="": + self.saveAs() + return + self.save() + + + def slotSaveAs(self): + pass + + def slotPrint(self): + margin = 10 + pageno = 1 + if self.printer.setup(self): + self.statusBar().message("Printing..."); + p = QPainter() + if not p.begin(self.printer): return + + p.setFont( self.editor.font() ) + yPos = 0 + fontMetrics = p.fontMetrics() + metrics = QPaintDeviceMetrics(self.printer) + for i in range(self.editor.lines()): + if margin + yPos > metrics.height() - margin: + pageNo += 1 + self.statusBar().message("Printing (page " + pageNo + ")...") + self.printer.newPage() + yPos = 0 + p.drawText( margin, margin+yPos, \ + metrics.width(), \ + fontMetrics.lineSpacing(), \ + QPainter.ExpandTabs | QPainter.DontClip, \ + self.editor.text(i) ) + yPos += fontMetrics.lineSpacing() + p.end() + self.statusBar().message("Printing completed", 2000) + else: + self.statusBar().message("Printing aborted", 2000) + + def slotClose(self): + pass + + def slotQuit(self): + pass + + def slotEditDetails(self): + docDet = documentdetails.documentDetails(self) + docDet.show() + + def slotWhatsThis(self): + self.whatsThis() + + def slotAbout(self): + QMessageBox.about(self, self.appTitle, \ + "This example demonstrates the simple use of\n" + \ + "QMainWindow, QMenuBar and QToolBar using QT\n" + \ + "and Python.") + + def slotAboutQT(self): + QMessageBox.aboutQt(self, self.appTitle) + + def load(self,fileName): + f = open(fileName,"r") + if f: + self.editor.setText( f.read() ) + self.editor.setModified(false) + self.setCaption(fileName) + self.statusBar().message("Loaded document " + fileName, 2000) + self.fileName = fileName + else: + self.statusBar().message("Could not load " + fileName, 5000) + return + + def saveAs(self): + fileName = str(QFileDialog.getSaveFileName(None, None, self)) + if fileName!="": + self.fileName = fileName + self.save() + else: + self.statusBar().message("Saving aborted", 2000) + + def save(self): + if self.fileName=="": + self.saveAs() + return + text = str(self.editor.text()) + try: + f = open(self.fileName, "w") + f.write(text) + except: + self.statusBar().message("Could not write to " + self.fileName) + f.close() + return + f.close() + self.editor.setModified(false) + self.setCaption(self.fileName) + self.statusBar().message( "File " + self.fileName + " saved", 2000) + + def closeEvent(self, closeEvent): + if not self.editor.isModified(): + closeEvent.accept() + return + + yesNoCancel = QMessageBox.information(self, self.appTitle, + "Do you want to save the changes\n" + \ + "to the document?", \ + "Yes", "No", "Cancel", + 0, 1) + if yesNoCancel == 0: + self.save() + closeEvent.accept() + elif yesNoCancel == 1: + closeEvent.accept() + else: + closeEvent.ignore() + + + + +def main(args): + app=QApplication(args) + mainWindow = %{APPNAME}() + mainWindow.show() + app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) + app.exec_loop() + + + +if __name__ == "__main__": + main(sys.argv) diff --git a/languages/python/app_templates/pyqt/documentdetails.ui b/languages/python/app_templates/pyqt/documentdetails.ui new file mode 100644 index 00000000..130d30ef --- /dev/null +++ b/languages/python/app_templates/pyqt/documentdetails.ui @@ -0,0 +1,80 @@ + +documentDetails + + + documentDetails + + + + 0 + 0 + 561 + 555 + + + + Document Details + + + + unnamed + + + + textLabel1 + + + + 5 + 1 + 0 + 0 + + + + Enter details about this document below. + + + PlainText + + + + + groupBox1 + + + Author + + + + unnamed + + + + textLabel2 + + + Name: + + + + + lineEdit1 + + + + + + + groupBox2 + + + Company + + + + + + + + diff --git a/languages/python/app_templates/pyqt/fileopen.pyxpm b/languages/python/app_templates/pyqt/fileopen.pyxpm new file mode 100644 index 00000000..e90fcfee --- /dev/null +++ b/languages/python/app_templates/pyqt/fileopen.pyxpm @@ -0,0 +1,19 @@ + 16 13 5 1 +. c #040404 +# c #808304 +a c None +b c #f3f704 +c c #f3f7f3 +aaaaaaaaa...aaaa +aaaaaaaa.aaa.a.a +aaaaaaaaaaaaa..a +a...aaaaaaaa...a +.bcb.......aaaaa +.cbcbcbcbc.aaaaa +.bcbcbcbcb.aaaaa +.cbcb........... +.bcb.#########.a +.cb.#########.aa +.b.#########.aaa +..#########.aaaa +...........aaaaa diff --git a/languages/python/app_templates/pyqt/fileprint.pyxpm b/languages/python/app_templates/pyqt/fileprint.pyxpm new file mode 100644 index 00000000..26f3ca9d --- /dev/null +++ b/languages/python/app_templates/pyqt/fileprint.pyxpm @@ -0,0 +1,21 @@ + 16 14 6 1 +. c #000000 +# c #848284 +a c #c6c3c6 +b c #ffff00 +c c #ffffff +d c None +ddddd.........dd +dddd.cccccccc.dd +dddd.c.....c.ddd +ddd.cccccccc.ddd +ddd.c.....c....d +dd.cccccccc.a.a. +d..........a.a.. +.aaaaaaaaaa.a.a. +.............aa. +.aaaaaa###aa.a.d +.aaaaaabbbaa...d +.............a.d +d.aaaaaaaaa.a.dd +dd...........ddd diff --git a/languages/python/app_templates/pyqt/filesave.pyxpm b/languages/python/app_templates/pyqt/filesave.pyxpm new file mode 100644 index 00000000..3f28c25d --- /dev/null +++ b/languages/python/app_templates/pyqt/filesave.pyxpm @@ -0,0 +1,19 @@ + 14 14 4 1 +. c #040404 +# c #808304 +a c #bfc2bf +b c None +.............. +.#.aaaaaaaa.a. +.#.aaaaaaaa... +.#.aaaaaaaa.#. +.#.aaaaaaaa.#. +.#.aaaaaaaa.#. +.#.aaaaaaaa.#. +.##........##. +.############. +.##.........#. +.##......aa.#. +.##......aa.#. +.##......aa.#. +b............. diff --git a/languages/python/app_templates/pyqt/install-sh b/languages/python/app_templates/pyqt/install-sh new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pyqt/missing b/languages/python/app_templates/pyqt/missing new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pyqt/mkinstalldirs b/languages/python/app_templates/pyqt/mkinstalldirs new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pyqt/pyqt b/languages/python/app_templates/pyqt/pyqt new file mode 100644 index 00000000..24b1b72f --- /dev/null +++ b/languages/python/app_templates/pyqt/pyqt @@ -0,0 +1,10 @@ +# KDE Config file +[General] +Name=Python Qt application +Name[fr]=Une application Qt avec PYTHON +Icon=pyqt.png +Category=Python +Comment=This generates an application framework using Python and Qt +Comment[fr]=Gnre un squelette d'application Qt dans le language PYTHON. +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=APPNAMELC.py diff --git a/languages/python/app_templates/pyqt/pyqt-am-preproc.py b/languages/python/app_templates/pyqt/pyqt-am-preproc.py new file mode 100644 index 00000000..dda5e2c3 --- /dev/null +++ b/languages/python/app_templates/pyqt/pyqt-am-preproc.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +# Preprocess Makefile.am for PyQT project +# Julian Rockey 2002 + +# TODO: +# Test real_lines properly +# Process Makefile.am's in sub-directories + +from __future__ import generators +import sys +import re + +# function to convert list of lists with continuation chars +# (bashslashes) to list of actual lines +def real_lines(m): + while len(m)>0: + result = "" + if m[0][-1]=='\\': + while (len(m)>0 and m[0][-1]=='\\'): + result += m[0][:-1] + m=m[1:] + if len(m)>0: + result += m[0] + m=m[1:] + yield result + +# check for arguments +if len(sys.argv)<2: + makefile_am = "Makefile.am" +else: + makefile_am = sys.argv[1] + + +# read in Makefile.am +f = open(makefile_am,"r") +mf = f.readlines() +f.close() + +# parse for variables +re_variable = re.compile("^(#kdevelop:[ \t]*)?([A-Za-z][A-Za-z0-9_]*)[ \t]*:?=[ \t]*(.*)$") +variables = {} + + +for l in real_lines(mf): + m = re_variable.match(l) + if m!=None: + (nowt, lhs, rhs) = m.groups() + variables[lhs]=rhs + +# look for app sources +for (var,data) in 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"): + sources = variables[target+"_SOURCES"].split() + +# change .ui into .py +py_sources = [] +for s in sources: + py_sources.append(re.sub("\.ui$",".py",s)) + +# replace dependencies of main target with list of .py sources +# FIXME escape target +re_maintarget = re.compile("(" + target + ".*?:).*") +out = [] +for l in mf: + m = re_maintarget.match(l) + if m!=None: + (tar,)=m.groups() + l=tar + " " + " ".join(py_sources) + "\n" + out.append(l) + +# backup existing Makefile.am +f = open(makefile_am + "~", "w") +f.writelines(mf) +f.close() + +# write file +f = open(makefile_am, "w") +f.writelines(out) +f.close() diff --git a/languages/python/app_templates/pyqt/pyqt.kdevtemplate b/languages/python/app_templates/pyqt/pyqt.kdevtemplate new file mode 100644 index 00000000..bffbcd8c --- /dev/null +++ b/languages/python/app_templates/pyqt/pyqt.kdevtemplate @@ -0,0 +1,168 @@ +# KDE Config File +[General] +Name=Python Qt application +Name[ca]=Aplicació per a Qt en Python +Name[da]=Python Qt program +Name[de]=Python/Qt-Anwendung +Name[el]=Εφαρμογή Python Qt +Name[es]=Aplicación Qt en Python +Name[et]=Pythoni Qt rakendus +Name[eu]=Python Qt aplikazioa +Name[fa]=کاربرد پیتون Qt +Name[fr]=Application Qt Python +Name[ga]=Feidhmchlár Qt Python +Name[gl]=Aplicación Qt en Python +Name[hu]=Python/Qt-alapú alkalmazás +Name[it]=Applicazione Qt Python +Name[ja]=Python Qt アプリケーション +Name[nds]=Python Qt-Programm +Name[ne]=पाइथोन क्यू टी अनुप्रयोग +Name[nl]=Python Qt-toepassing +Name[pl]=Program Qt w Pythonie +Name[pt]=Aplicação Qt em Python +Name[pt_BR]=Aplicação Qt em Python +Name[ru]=Приложение Qt на Python +Name[sk]=Python Qt aplikácia +Name[sr]=Python-Qt програм +Name[sr@Latn]=Python-Qt program +Name[sv]=Python Qt-program +Name[tr]=Python Qt Uygulaması +Name[zh_CN]=Python Qt 应用程序 +Name[zh_TW]=Python Qt 應用程式 +Icon=pyqt.png +Category=Python +Comment=This generates an application framework using Python and Qt +Comment[ca]=Genera una infraestructura d'aplicació usant Python i Qt +Comment[da]=Dette genererer et programskelet ved brug af Python og Qt +Comment[de]=Hiermit wird ein Anwendungsgerüst unter Verwendung von Python und Qt erstellt +Comment[el]=Αυτό δημιουργεί ένα πλαίσιο εφαρμογής χρησιμοποιώντας τις Python και Qt +Comment[es]=Genera una infraestructura de aplicación que usa Python y Qt +Comment[et]=Rakenduse raamistiku loomine Pythoni ja Qt abil +Comment[eu]=Honek Python eta Qt darabiltzan aplikazioen lan-marko bat sortzen du +Comment[fa]=یک چارچوب کاربرد با استفاده از پیتون و Qt تولید می‌کند +Comment[fr]=Génère une infrastructure d'application utilisant Python et Qt +Comment[ga]=Cruthaíonn sé seo creatlach feidhmchláir le Python agus Qt +Comment[gl]=Isto xera un contorno de traballo para unha aplicación usando Python e Qt +Comment[hu]=Létrehoz egy alkalmazás-keretrendszert Python nyelven, a Qt felhasználásával +Comment[it]=Genera l'infrastruttura applicativa usando Python e Qt +Comment[ja]=Python と Qt を使ってアプリケーションフレームワークを作成します +Comment[nds]=Dit stellt mit Python un Qt en Programmrahmenwark op. +Comment[ne]=यसले पाइथोन र क्यू टी प्रयोग गरेर अनुप्रयोग फ्रेमवर्क उत्पन्न गर्दछ +Comment[nl]=Dit genereert een toepassingsframework met behulp van Python en Qt +Comment[pl]=Generuje szablon programu używającego Pythona i Qt +Comment[pt]=Isto cria a plataforma de uma aplicação que usa o Python e o Qt +Comment[pt_BR]=Isto cria a plataforma de uma aplicação que usa o Python e o Qt +Comment[ru]=Создание приложения Qt на Python +Comment[sk]=Vygeneruje aplikačný framework používajúci Python a Qt +Comment[sr]=Прави радни оквир програма користећи Python и Qt +Comment[sr@Latn]=Pravi radni okvir programa koristeći Python i Qt +Comment[sv]=Detta skapar ett programramverk med användning av Python och Qt +Comment[tr]=Bu Python ve Qt kullanan bir uygulama çatısı yaratır. +Comment[zh_CN]=这将生成一个使用 Python 和 Qt 的应用程序框架 +Comment[zh_TW]=產生一個使用 Python 與 Qt 的應用程式框架 +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.py +Archive=pyqt.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.py +Dest=%{dest}/%{APPNAMELC}.py + +[FILE3] +Type=install +EscapeXML=true +Source=%{src}/documentdetails.ui +Dest=%{dest}/documentdetails.ui + +[FILE4] +Type=install +Source=%{src}/app-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE5] +Type=install +Source=%{src}/app-configure.ac +Dest=%{dest}/configure.ac + +[FILE6] +Type=install +Source=%{src}/app-autogen.sh +Dest=%{dest}/autogen.sh + +[FILE7] +Type=install +Source=%{src}/mkinstalldirs +Dest=%{dest}/mkinstalldirs + +[FILE8] +Type=install +Source=%{src}/missing +Dest=%{dest}/missing + +[FILE9] +Type=install +Source=%{src}/install-sh +Dest=%{dest}/install-sh + +[FILE10] +Type=install +Source=%{src}/pyqt-am-preproc.py +Dest=%{dest}/pyqt-am-preproc.py + +[FILE11] +Type=install +Source=%{src}/fileopen.pyxpm +Dest=%{dest}/fileopen.pyxpm + +[FILE12] +Type=install +Source=%{src}/fileprint.pyxpm +Dest=%{dest}/fileprint.pyxpm + +[FILE13] +Type=install +Source=%{src}/filesave.pyxpm +Dest=%{dest}/filesave.pyxpm + +[MSG] +Type=message +Comment=A Python Qt application was created in %{dest} +Comment[ca]=Una aplicació per a Qt en Python ha estat creada en %{dest} +Comment[da]=Et Python Qt program blev oprettet i %{dest} +Comment[de]=Eine Python/Qt-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή Python Qt δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación Qt en Python ha sido creada en %{dest} +Comment[et]=Pythoni Qt rakendus loodi asukohta %{dest} +Comment[eu]=Python eta Qt darabiltzan aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد پیتون Qt در %{dest} ایجاد شد +Comment[fr]=Une application Qt Python a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár Python Qt i %{dest} +Comment[gl]=Creouse unha aplicación Qt en Python en %{dest} +Comment[hu]=Létrejött egy Python/Qt-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Qt Python in %{dest} +Comment[ja]=Python Qt アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Python-Qt-Programm opstellt. +Comment[ne]=पाइथोन क्यू टी अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Python Qt-toepassing is aangemaakt in %{dest} +Comment[pl]=Program używający Pythona i Qt został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação Qt em Python em %{dest} +Comment[pt_BR]=Foi criada uma aplicação Qt em Python em %{dest} +Comment[ru]=Приложение Qt на Python создано в %{dest} +Comment[sk]=Python Qt aplikácia bola vytvorená v %{dest} +Comment[sr]= Python-Qt програм је направљен у %{dest} +Comment[sr@Latn]= Python-Qt program je napravljen u %{dest} +Comment[sv]=Ett Python Qt-program skapades i %{dest} +Comment[tr]=Bir Python Qt uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个 Python Qt 应用程序 +Comment[zh_TW]=一個 Python Qt 應用程式已建立於 %{dest} diff --git a/languages/python/app_templates/pyqt/pyqt.png b/languages/python/app_templates/pyqt/pyqt.png new file mode 100644 index 00000000..207b942f Binary files /dev/null and b/languages/python/app_templates/pyqt/pyqt.png differ diff --git a/languages/python/app_templates/pyqt/templates-ui-dialog b/languages/python/app_templates/pyqt/templates-ui-dialog new file mode 100644 index 00000000..fc2aefce --- /dev/null +++ b/languages/python/app_templates/pyqt/templates-ui-dialog @@ -0,0 +1,20 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + Form1 + + + + diff --git a/languages/python/app_templates/pyqt/templates-ui-mainwin b/languages/python/app_templates/pyqt/templates-ui-mainwin new file mode 100644 index 00000000..854da009 --- /dev/null +++ b/languages/python/app_templates/pyqt/templates-ui-mainwin @@ -0,0 +1,436 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + Form1 + + + + + menubar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileNewAction + + + image0 + + + New + + + &New + + + Ctrl+N + + + + + fileOpenAction + + + image1 + + + Open + + + &Open... + + + Ctrl+O + + + + + fileSaveAction + + + image2 + + + Save + + + &Save + + + Ctrl+S + + + + + fileSaveAsAction + + + Save As + + + Save &As... + + + + + + + + filePrintAction + + + image3 + + + Print + + + &Print... + + + Ctrl+P + + + + + fileExitAction + + + Exit + + + E&xit + + + + + + + + editUndoAction + + + image4 + + + Undo + + + &Undo + + + Ctrl+Z + + + + + editRedoAction + + + image5 + + + Redo + + + &Redo + + + Ctrl+Y + + + + + editCutAction + + + image6 + + + Cut + + + &Cut + + + Ctrl+X + + + + + editCopyAction + + + image7 + + + Copy + + + C&opy + + + Ctrl+C + + + + + editPasteAction + + + image8 + + + Paste + + + &Paste + + + Ctrl+V + + + + + editFindAction + + + image9 + + + Find + + + &Find... + + + Ctrl+F + + + + + helpContentsAction + + + Contents + + + &Contents... + + + + + + + + helpIndexAction + + + Index + + + &Index... + + + + + + + + helpAboutAction + + + About + + + &About + + + + + + + + + 789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0 + + + 789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436 + + + 789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb + + + 789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5 + + + 789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175 + + + 789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a + + + + + fileNewAction + activated() + Form1 + fileNew() + + + fileOpenAction + activated() + Form1 + fileOpen() + + + fileSaveAction + activated() + Form1 + fileSave() + + + fileSaveAsAction + activated() + Form1 + fileSaveAs() + + + filePrintAction + activated() + Form1 + filePrint() + + + fileExitAction + activated() + Form1 + fileExit() + + + editUndoAction + activated() + Form1 + editUndo() + + + editRedoAction + activated() + Form1 + editRedo() + + + editCutAction + activated() + Form1 + editCut() + + + editCopyAction + activated() + Form1 + editCopy() + + + editPasteAction + activated() + Form1 + editPaste() + + + editFindAction + activated() + Form1 + editFind() + + + helpIndexAction + activated() + Form1 + helpIndex() + + + helpContentsAction + activated() + Form1 + helpContents() + + + helpAboutAction + activated() + Form1 + helpAbout() + + + + fileNew() + fileOpen() + fileSave() + fileSaveAs() + filePrint() + fileExit() + editUndo() + editRedo() + editCut() + editCopy() + editPaste() + editFind() + helpIndex() + helpContents() + helpAbout() + + + diff --git a/languages/python/app_templates/python.appwizard b/languages/python/app_templates/python.appwizard new file mode 100644 index 00000000..82c13adf --- /dev/null +++ b/languages/python/app_templates/python.appwizard @@ -0,0 +1,2 @@ +[General] +List=pythonhello,pytk,pyqt diff --git a/languages/python/app_templates/pythonhello/.kdev_ignore b/languages/python/app_templates/pythonhello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pythonhello/Makefile.am b/languages/python/app_templates/pythonhello/Makefile.am new file mode 100644 index 00000000..3d66b1a7 --- /dev/null +++ b/languages/python/app_templates/pythonhello/Makefile.am @@ -0,0 +1,15 @@ +dataFiles = app.py app.kdevelop pythonhello.png +templateName = pythonhello +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/python/app_templates/pythonhello/app.kdevelop b/languages/python/app_templates/pythonhello/app.kdevelop new file mode 100644 index 00000000..2c494d6a --- /dev/null +++ b/languages/python/app_templates/pythonhello/app.kdevelop @@ -0,0 +1,84 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevScriptProject + Python + + Python + + + + + + + + + %{APPNAMELC}.py + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + false + *.o,*.lo,CVS + + + + + + + + + + + diff --git a/languages/python/app_templates/pythonhello/app.py b/languages/python/app_templates/pythonhello/app.py new file mode 100644 index 00000000..3257ce62 --- /dev/null +++ b/languages/python/app_templates/pythonhello/app.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +def main(): + print 'Hello world!' + +main() + diff --git a/languages/python/app_templates/pythonhello/pythonhello b/languages/python/app_templates/pythonhello/pythonhello new file mode 100644 index 00000000..f1a4f86b --- /dev/null +++ b/languages/python/app_templates/pythonhello/pythonhello @@ -0,0 +1,12 @@ +# KDE Config File +[General] +Name=Simple Python script +Name[fr]=Un simple script de test "Hello world" +Name[de]=Ein einfaches Python-Script "Hello world" +Icon=pythonhello.png +Category=Python +Comment=This generates a simplistic "Hello world" program in Python +Comment[fr]=Gnre un simple script de test du type "Hello world" dans le language PYTHON. +Comment[de]=Es wird ein einfaches "Hello world"-Programm in Python erzeugt. +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=APPNAMELC.py diff --git a/languages/python/app_templates/pythonhello/pythonhello.kdevtemplate b/languages/python/app_templates/pythonhello/pythonhello.kdevtemplate new file mode 100644 index 00000000..6d52cf8a --- /dev/null +++ b/languages/python/app_templates/pythonhello/pythonhello.kdevtemplate @@ -0,0 +1,107 @@ +# KDE Config File +[General] +Name=Simple Python script +Name[ca]=Simple script en Python +Name[da]=Simpelt Python script +Name[de]=Einfaches Python-Skript +Name[el]=Απλό σενάριο Python +Name[es]=Guión sencillo en Python +Name[et]=Lihtne Pythoni skript +Name[eu]=Python script sinplea +Name[fa]=دست‌نوشتۀ سادۀ پیتون +Name[fr]=Script Python simple +Name[ga]=Script shimplí Python +Name[gl]=Script sinxelo en Python +Name[hu]=Egyszerű Python-szkript +Name[it]=Semplice script Python +Name[ja]=簡単な Python スクリプト +Name[nds]=Eenfach Python-Skript +Name[ne]=साधारण पाइथोन स्क्रिप्ट +Name[nl]=Eenvoudig Python-script +Name[pl]=Prosty skrypt w Pythonie +Name[pt]=Programa simples em Python +Name[pt_BR]=Programa simples em Python +Name[ru]=Простой скрипт Python +Name[sk]=Jednoduchý Python skript +Name[sr]=Једноставна Python скрипта +Name[sr@Latn]=Jednostavna Python skripta +Name[sv]=Enkelt Python-skript +Name[tr]=Basit Python betiği +Name[zh_CN]=简单的 Python 脚本 +Name[zh_TW]=簡單的 Python 文稿 +Icon=pythonhello.png +Category=Python +Comment=This generates a simplistic "Hello world" program in Python +Comment[ca]=Genera un simple programa de "Hello world" en Python +Comment[da]=Dette genererer et simplistisk "Goddag verden" program i Python +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in Python +Comment[el]=Αυτό δημιουργεί ένα απλό πρόγραμμα "Γεια σου κόσμε" σε Python +Comment[es]=Genera un sencillo programa «Hola mundo» en Python +Comment[et]=Lihtsa "Tere, maailm" programmi loomine Pythonis +Comment[eu]=Honek "Kaixo mundua" programa sinple bat sortzen du Python lengoaian +Comment[fa]=یک برنامۀ سادۀ «Hello world» در پیتون تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en Python +Comment[gl]=Isto xera un programa sinxelo "Ola mundo" en Python +Comment[hu]=Létrehoz egy egyszerű Hello world programot Python nyelven +Comment[it]=Genera un semplice programma di "Hello world" in Python +Comment[ja]=簡単な Hello world プログラムを Python で作成します +Comment[nds]=Dit stellt en eenfach "Moin Welt"-Programm mit Python op. +Comment[ne]=यसले पाइथोनमा साधारण "हेल्लो वोल्ड" कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Dit genereert een eenvoudig "Hello World"-programma in Python +Comment[pl]=Generuje prosty program "Witaj świecie" w Pythonie +Comment[pt]=Isto gera um programa simples "Olá mundo" em Python +Comment[pt_BR]=Isto gera um programa simples "Olá mundo" em Python +Comment[ru]=Создание простой программы "Hello world" на Python +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v Python +Comment[sr]=Прави једноставан „Здраво свете“ програм у Python-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ program u Python-u +Comment[sv]=Detta skapar ett förenklat "Hello world"-program i Python +Comment[tr]=Bu, Python'da basit bir "Merhaba Dünya" programı yaratır. +Comment[zh_CN]=这将生成一个简单的 Python 语言“Hello world”程序 +Comment[zh_TW]=產生一個 Python 的簡單 Hello world 程式 +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.py +Archive=pythonhello.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.py +Dest=%{dest}/%{APPNAMELC}.py + +[MSG] +Type=message +Comment=A simple python script was created in %{dest} +Comment[ca]=Un simple script en Python ha estat creat en %{dest} +Comment[da]=Et simpelt python script blev oprettet i %{dest} +Comment[de]=Ein einfaches Python-Skript wurde in %{dest} erstellt. +Comment[el]=Ένα απλό σενάριο python δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo programa en Python ha sido creado en %{dest} +Comment[et]=Lihtne Pythoni skript loodi asukohta %{dest} +Comment[eu]=Python programa sinple bat sortu da hemen: %{dest} +Comment[fa]=یک دست‌نوشتۀ سادۀ پیتون در %{dest} ایجاد شد +Comment[fr]=Un script Python simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh script shimplí Python i %{dest} +Comment[gl]=Creouse un script sinxelo en python en %{dest} +Comment[hu]=Létrejött egy egyszerű Python-szkript itt: %{dest} +Comment[it]=È stato creato un semplice script python in %{dest} +Comment[ja]=簡単な python スクリプトを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach Python-Skript opstellt. +Comment[ne]=साधारण पाइथोन स्क्रिप्ट %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig Python-script is aangemaakt in %{dest} +Comment[pl]=Prosty skrypt w Pythonie został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples em Python em %{dest} +Comment[pt_BR]=Foi criado um programa simples em Python em %{dest} +Comment[ru]=Простой скрипт Python создан в %{dest} +Comment[sk]=Jednoduchý Python skript bol vytvorený v %{dest} +Comment[sr]=Једноставна python скрипта направљена је у %{dest} +Comment[sr@Latn]=Jednostavna python skripta napravljena je u %{dest} +Comment[sv]=Ett enkelt Python-skript skapades i %{dest} +Comment[tr]=Basit bir python betiği %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个简单的 Python 语言脚本 +Comment[zh_TW]=一個簡單的 python 文稿框架已建立於 %{dest} diff --git a/languages/python/app_templates/pythonhello/pythonhello.png b/languages/python/app_templates/pythonhello/pythonhello.png new file mode 100644 index 00000000..c27ab24d Binary files /dev/null and b/languages/python/app_templates/pythonhello/pythonhello.png differ diff --git a/languages/python/app_templates/pytk/.kdev_ignore b/languages/python/app_templates/pytk/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/python/app_templates/pytk/Makefile.am b/languages/python/app_templates/pytk/Makefile.am new file mode 100644 index 00000000..0639ee15 --- /dev/null +++ b/languages/python/app_templates/pytk/Makefile.am @@ -0,0 +1,15 @@ +dataFiles = app.py app.kdevelop pytk.png +templateName = pytk +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz \ No newline at end of file diff --git a/languages/python/app_templates/pytk/app.kdevelop b/languages/python/app_templates/pytk/app.kdevelop new file mode 100644 index 00000000..044ea0b7 --- /dev/null +++ b/languages/python/app_templates/pytk/app.kdevelop @@ -0,0 +1,82 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevScriptProject + Python + + Python + + + + + + + + + %{APPNAMELC}.py + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + false + *.o,*.lo,CVS + + + + + + + + + + + diff --git a/languages/python/app_templates/pytk/app.py b/languages/python/app_templates/pytk/app.py new file mode 100644 index 00000000..39f4aa84 --- /dev/null +++ b/languages/python/app_templates/pytk/app.py @@ -0,0 +1,4 @@ +from Tkinter import * +widget = Label(None, text='Hello world!') +widget.pack() +widget.mainloop() diff --git a/languages/python/app_templates/pytk/pytk b/languages/python/app_templates/pytk/pytk new file mode 100644 index 00000000..36a92c47 --- /dev/null +++ b/languages/python/app_templates/pytk/pytk @@ -0,0 +1,12 @@ +# KDE Config File +[General] +Name=Simple Python/Tkinter script +Name[fr]=Un simple Python/Tkinter script de test "Hello world" +Name[de]=Ein einfaches Python/Tkinter Script Hello world +Icon=pytk.png +Category=Python +Comment=This generates a simplistic "Hello world" program in Python/Tkinter +Comment[fr]=Gnre un simple script de test du type "Hello world" dans le language PYTHON/Tkinter. +Comment[de]=Es wird ein einfaches "Hello world"-Programm in Python/Tkinter erzeugt. +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=APPNAMELC.py diff --git a/languages/python/app_templates/pytk/pytk.kdevtemplate b/languages/python/app_templates/pytk/pytk.kdevtemplate new file mode 100644 index 00000000..3756df01 --- /dev/null +++ b/languages/python/app_templates/pytk/pytk.kdevtemplate @@ -0,0 +1,107 @@ +# KDE Config File +[General] +Name=Simple Python/Tkinter script +Name[ca]=Simple script en Python/Tkinter +Name[da]=Simpelt Python/Tkinter script +Name[de]=Einfaches Python/Tkinter-Skript +Name[el]=Απλό σενάριο Python/Tkinter +Name[es]=Guión sencillo en Python/Tkinter +Name[et]=Lihtne Pythoni/Tkinteri skript +Name[eu]=Python/Tkinter script sinplea +Name[fa]=دست‌نوشتۀ سادۀ پیتون/Tkinter +Name[fr]=Script Python / Tkinter simple +Name[ga]=Script shimplí Python/Tkinter +Name[gl]=Script sinxelo Python/Tkinter +Name[hu]=Egyszerű Python/Tkinter-szkript +Name[it]=Semplice script Python/Tkinter +Name[ja]=簡単な Python/Tkinter スクリプト +Name[nds]=Eenfach Python/Tkinter-Skript +Name[ne]=साधारण पाइथोन/Tkinter स्क्रिप्ट +Name[nl]=Eenvoudig Python/Tkinter-script +Name[pl]=Prosty skrypt Python/Tkinter +Name[pt]=Programa simples em Python/Tkinter +Name[pt_BR]=Programa simples em Python/Tkinter +Name[ru]=Простой скрипт Python/Tkinter +Name[sk]=Jednoduchý Python/Tkinter skript +Name[sr]=Једноставна Python/Tkinter скрипта +Name[sr@Latn]=Jednostavna Python/Tkinter skripta +Name[sv]=Enkelt Python/Tkinter-skript +Name[tr]=Basit Python/Tkinter betiği +Name[zh_CN]=简单的 Python/Tkinter 脚本 +Name[zh_TW]=簡單的 Python/Tkinter 文稿 +Icon=pytk.png +Category=Python +Comment=This generates a simplistic "Hello world" program in Python/Tkinter +Comment[ca]=Genera un simple programa de "Hello world" en Python/Tkinter +Comment[da]=Dette genererer et simplistisk "Goddag verden" program i Python/Tkinter +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in Python/Tkinter +Comment[el]=Αυτό δημιουργεί ένα απλό πρόγραμμα "Γεια σου κόσμε" σε Python/Tkinter +Comment[es]=Genera un sencillo programa «Hola mundo» en Python/Tkinter +Comment[et]=Lihtsa "Tere, maailm" programmi loomine Pythonis/Tkinteris +Comment[eu]="Kaixo mundua" programa sinple bat sortzen du Python/Tkinter-en +Comment[fa]=یک برنامۀ سادۀ «Hello world» در پیتون/Tkinter تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en Python / Tkinter +Comment[gl]=Isto xera un programa sinxelo "Ola mundo" en Python/Tkinter +Comment[hu]=Létrehoz egy egyszerű Hello world programot Python/Tkinter nyelven +Comment[it]=Genera un semplice programma di "Hello world" in Python/Tkinter +Comment[ja]=簡単な Hello world プログラムを Python/Tkinter で作成します +Comment[nds]=Dit stellt en eenfach "Moin Welt"-Programm in Python/Tkinter op. +Comment[ne]=यसले पाइथोन/Tkinter मा साधारण "हेल्लो वोल्ड" कार्यक्रम उत्पन्न गर्दछ +Comment[nl]=Dit genereert een eenvoudig "Hallo Wereld"-programma in Python/Tkinter +Comment[pl]=Generuje prosty skrypt "Witaj świecie" w Pythonie/Tkinterze +Comment[pt]=Isto gera um programa simples "Olá mundo" em Python/Tkinter +Comment[pt_BR]=Isto gera um programa simples "Olá mundo" em Python/Tkinter +Comment[ru]=Создание простой программы "Hello world" на Python и Tkinter +Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v Python/Tkinter +Comment[sr]=Прави једноставан „Здраво свете“ у Python/Tkinter-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ u Python/Tkinter-u +Comment[sv]=Detta skapar ett förenklat "Hello world"-program i Python/Tkinter +Comment[tr]=Bu Python/Tkinter'da basit bir "Merhaba Dünya" programı yaratır. +Comment[zh_CN]=这将生成一个简单的 Python/Tkinter 语言“Hello world”程序 +Comment[zh_TW]=產生一個簡單的 Python/Tkinter 的 Hello World 程式 +FileTemplates=py,ShellStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.py +Archive=pytk.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/app.py +Dest=%{dest}/%{APPNAMELC}.py + +[MSG] +Type=message +Comment=A simple Python/Tkinter script was created in %{dest} +Comment[ca]=Un simple script en Python/Tkinter ha estat creat en %{dest} +Comment[da]=Et simpelt Python/Tkinter script blev oprettet i %{dest} +Comment[de]=Ein einfaches Python/Tkinter-Skript wurde in %{dest} erstellt. +Comment[el]=Ένα απλό σενάριο Python/Tkinter δημιουργήθηκε στο %{dest} +Comment[es]=Un sencillo guión en Python/Tkinter ha sido creado en %{dest} +Comment[et]=Lihtne Pythoni/Tkinteri skript loodi asukohta %{dest} +Comment[eu]=Python/Tkinter script sinple bat sortu da hemen: %{dest} +Comment[fa]=یک دست‌نوشتۀ سادۀ پیتون/Tkinter در %{dest} ایجاد شد +Comment[fr]=Un script Python / Tkinter simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh script shimplí Python/Tkinter i %{dest} +Comment[gl]=Creouse un script sinxelo Python/Tkinter en %{dest} +Comment[hu]=Létrejött egy egyszerű Python/Tkinter-szkript itt: %{dest} +Comment[it]=È stato creato un semplice script Python/Tkinter in %{dest} +Comment[ja]=簡単な Python/Tkinter スクリプトを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en eenfach Python-/Tkinter-Skript opstellt. +Comment[ne]=साधारण पाइथोन/Tkinter स्क्रिप्ट %{dest} मा सिर्जना गरियो +Comment[nl]=Een eenvoudig Python/Tkinter-script is aangemaakt in %{dest} +Comment[pl]=Prosty skrypt Python/Tkinter został utworzony w %{dest} +Comment[pt]=Foi criado um programa simples em Python/Tkinter em %{dest} +Comment[pt_BR]=Foi criado um programa simples em Python/Tkinter em %{dest} +Comment[ru]=Простой скрипт Python/Tkinter создан в %{dest} +Comment[sk]=Jednoduchý Python/Tkinter skript bol vytvorený v %{dest} +Comment[sr]=Једноставна Python/Tkinter скрипта направљена је у %{dest} +Comment[sr@Latn]=Jednostavna Python/Tkinter skripta napravljena je u %{dest} +Comment[sv]=Ett enkelt Python/Tkinter-skript skapades i %{dest} +Comment[tr]=Basit Python/Tkinter betiği %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个简单的 Python/Tkinter 脚本 +Comment[zh_TW]=一個簡單的 Python/Tkinter 文稿已建立於 %{dest} diff --git a/languages/python/app_templates/pytk/pytk.png b/languages/python/app_templates/pytk/pytk.png new file mode 100644 index 00000000..c8c28f8d Binary files /dev/null and b/languages/python/app_templates/pytk/pytk.png differ diff --git a/languages/python/doc/Makefile.am b/languages/python/doc/Makefile.am new file mode 100644 index 00000000..5159f5f0 --- /dev/null +++ b/languages/python/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = python.toc python_bugs.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = python.index + diff --git a/languages/python/doc/python.toc b/languages/python/doc/python.toc new file mode 100644 index 00000000..e5c67dda --- /dev/null +++ b/languages/python/doc/python.toc @@ -0,0 +1,1571 @@ + + +Python + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/languages/python/doc/python_bugs.toc b/languages/python/doc/python_bugs.toc new file mode 100644 index 00000000..0b2a5196 --- /dev/null +++ b/languages/python/doc/python_bugs.toc @@ -0,0 +1,7 @@ + + +Python bugs + + + + diff --git a/languages/python/file_templates/Makefile.am b/languages/python/file_templates/Makefile.am new file mode 100644 index 00000000..0846fdf2 --- /dev/null +++ b/languages/python/file_templates/Makefile.am @@ -0,0 +1,4 @@ +templatedir = $(kde_datadir)/kdevfilecreate/file-templates +template_DATA = py + + diff --git a/languages/python/file_templates/py b/languages/python/file_templates/py new file mode 100644 index 00000000..64192c64 --- /dev/null +++ b/languages/python/file_templates/py @@ -0,0 +1,7 @@ +########################################################################### +# Copyright (C) $YEAR$ by $AUTHOR$ +# <$EMAIL$> +# +# Copyright: See COPYING file that comes with this distribution +# +########################################################################### diff --git a/languages/python/kde_pydoc.py b/languages/python/kde_pydoc.py new file mode 100755 index 00000000..0516f172 --- /dev/null +++ b/languages/python/kde_pydoc.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +""" +""" + +__author__ = "David Nolden, Ka-Ping Yee " +__version__ = "6 April 2006" + +import sys, imp, os, stat, re, types, cgi +from repr import Repr +from string import expandtabs, find, join, lower, split, strip, rstrip +import pydoc + + + + +def cleanlinks(string): + """Changes the links to work with the pydoc:-notation""" + finalstring = "" + string = str(string).replace(".html","") + pos = 0 + mark = " __maxdepth): + notprocessed.append(path) + return + dir = path + for file in os.listdir(dir): + path = os.path.join(dir, file) + if os.path.isdir(path): + writedocs(path, file + '.' + pkgpath, depth) + if os.path.isfile(path): + writedocs(path, pkgpath, depth) + if os.path.isfile(path): + modname = pydoc.inspect.getmodulename(path) + if modname: + writedoc(pkgpath + modname) + + if(depth == 1): + if(len(notprocessed) != 0): + print "
the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":
" + for x in notprocessed: + print cgi.escape(x) + "
" + +def writedoc(key,top=False): + """Write HTML documentation to a file in the current directory.""" + if(type(key) == str and (key == "modules" or key == "/.")): + heading = pydoc.html.heading( + '
 ' + 'Python: Index of Modules' + '', + '#ffffff', '#7799ee') + builtins = [] + for name in sys.builtin_module_names: + builtins.append('
%s' % (cgi.escape(name,quote=True), cgi.escape(name))) + indices = ['

Built-in modules: ' + cgi.escape(join(builtins, ', '))] + seen = {} + for dir in pydoc.pathdirs(): + indices.append(pydoc.html.index(dir, seen)) + 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) + "
go to index"; + else: + object = key + + if object: + print cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object))) + + + +if __name__ == '__main__': + import getopt + class BadUsage: pass + + try: + opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') + + print "" + print "" + print "" + + if args: + for arg in args: + try: + if os.path.isdir(arg): writedocs(arg) + + 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)) + else: + raise BadUsage + + except (getopt.error, BadUsage): + print "need parameters\n" diff --git a/languages/python/kdevpythonsupport.desktop b/languages/python/kdevpythonsupport.desktop new file mode 100644 index 00000000..9f15e39f --- /dev/null +++ b/languages/python/kdevpythonsupport.desktop @@ -0,0 +1,85 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Python Support +Comment[ca]=Suport per a Python +Comment[da]=Python-understøttelse +Comment[de]=Unterstützung für Python +Comment[el]=Υποστήριξη Python +Comment[es]=Soporte para Python +Comment[et]=Pythoni toetus +Comment[eu]=Python euskarria +Comment[fa]=پشتیبانی پیتون +Comment[fr]=Prise en charge du langage PYTHON +Comment[ga]=Tacaíocht Python +Comment[gl]=Soporte para Python +Comment[hi]=पायथन समर्थन +Comment[hu]=Python-támogatás +Comment[is]=Python stuðningur +Comment[it]=Supporto per Python +Comment[ja]=Python サポート +Comment[nds]=Ünnerstütten för Python +Comment[ne]=पाइथोन समर्थन +Comment[nl]=Ondersteuning voor Python +Comment[pl]=Obsługa Pythona +Comment[pt]=Suporte a Python +Comment[pt_BR]=Suporte ao Python +Comment[ru]=Поддержка языка Python +Comment[sk]=Python podpora +Comment[sl]=Podpora za Python +Comment[sr]=Подршка за Python +Comment[sr@Latn]=Podrška za Python +Comment[sv]=Python-stöd +Comment[ta]=பைதான் ஆதரவு +Comment[tg]=Ёрӣ намудани забони Python +Comment[tr]=Python Desteği +Comment[zh_CN]=Python 支持 +Comment[zh_TW]=Python 支援 +Name=KDevPythonSupport +Name[da]=KDevelop Python-understøttelse +Name[de]=Unterstützung für Python (KDevelop) +Name[hi]=के-डेव-पायथन-समर्थन +Name[nds]=Python-Ünnerstütten för KDevelop +Name[pl]=KDevObsługaPythona +Name[sk]=KDev Python podpora +Name[sv]=KDevelop Python-stöd +Name[ta]=கெடெவ் பைதான் ஆதரவு +Name[tg]=Ёрӣ намудани забони Python +Name[zh_TW]=KDevelop Python 支援 +GenericName=Python Support +GenericName[ca]=Suport per a Python +GenericName[da]=Python-understøttelse +GenericName[de]=Unterstützung für Python +GenericName[el]=Υποστήριξη Python +GenericName[es]=Soporte para Python +GenericName[et]=Pythoni toetus +GenericName[eu]=Python euskarria +GenericName[fa]=پشتیبانی پیتون +GenericName[fr]=Prise en charge du langage PYTHON +GenericName[ga]=Tacaíocht Python +GenericName[gl]=Soporte para Python +GenericName[hi]=पायथन समर्थन +GenericName[hu]=Python-támogatás +GenericName[it]=Supporto per Python +GenericName[ja]=Python サポート +GenericName[nds]=Ünnerstütten för Python +GenericName[ne]=पाइथोन समर्थन +GenericName[nl]=Ondersteuning voor Python +GenericName[pl]=Obsługa Pythona +GenericName[pt]=Suporte a Python +GenericName[pt_BR]=Suporte ao Python +GenericName[ru]=Поддержка языка Python +GenericName[sk]=Python podpora +GenericName[sl]=Podpora za Python +GenericName[sr]=Подршка за Python +GenericName[sr@Latn]=Podrška za Python +GenericName[sv]=Python-stöd +GenericName[ta]=பைதான் ஆதரவு +GenericName[tg]=Ёрӣ намудани забони Python +GenericName[tr]=Python Desteği +GenericName[zh_CN]=Python 支持 +GenericName[zh_TW]=Python 支援 +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevpythonsupport +X-KDevelop-Version=5 +X-KDevelop-Language=Python diff --git a/languages/python/kdevpythonsupport.rc b/languages/python/kdevpythonsupport.rc new file mode 100644 index 00000000..d19011b8 --- /dev/null +++ b/languages/python/kdevpythonsupport.rc @@ -0,0 +1,16 @@ + + + +

+ + + + + + + + + + + + diff --git a/languages/python/pydoc.cpp b/languages/python/pydoc.cpp new file mode 100644 index 00000000..79f184d7 --- /dev/null +++ b/languages/python/pydoc.cpp @@ -0,0 +1,113 @@ +#include "pydoc.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace KIO; + + +PydocProtocol::PydocProtocol(const QCString &pool, const QCString &app) + : SlaveBase("pydoc", pool, app), key() +{ + python = KGlobal::dirs()->findExe("python"); + script = locate("data", "kio_pydoc/kde_pydoc.py"); +} + + +PydocProtocol::~PydocProtocol() +{} + + +void PydocProtocol::get(const KURL& url) +{ + mimeType("text/html"); + key = url.path(); + + QString cmd = KProcess::quote(python); + cmd += " "; + cmd += KProcess::quote(script); + cmd += " -w "; + cmd += KProcess::quote(key); + + FILE *fd = popen(cmd.local8Bit().data(), "r"); + char buffer[4096]; + QByteArray array; + + while (!feof(fd)) { + int n = fread(buffer, 1, 2048, fd); + if (n == -1) { + pclose(fd); + return; + } + array.setRawData(buffer, n); + data(array); + array.resetRawData(buffer, n); + } + + pclose(fd); + finished(); +} + + +void PydocProtocol::mimetype(const KURL&) +{ + mimeType( "text/html" ); + finished(); +} + + +QCString PydocProtocol::errorMessage() +{ + return QCString( "" + i18n("Error in pydoc").local8Bit() + "" ); +} + + +void PydocProtocol::stat(const KURL &/*url*/) +{ + UDSAtom uds_atom; + uds_atom.m_uds = KIO::UDS_FILE_TYPE; + uds_atom.m_long = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO; + + UDSEntry uds_entry; + uds_entry.append(uds_atom); + + statEntry(uds_entry); + finished(); +} + + +void PydocProtocol::listDir(const KURL &url) +{ + error( KIO::ERR_CANNOT_ENTER_DIRECTORY, url.path() ); +} + + +extern "C" { + + int kdemain(int argc, char **argv) + { + KInstance instance( "kio_pydoc" ); + KGlobal::locale()->setMainCatalogue("kdevelop"); + + if (argc != 4) { + fprintf(stderr, "Usage: kio_pydoc protocol domain-socket1 domain-socket2\n"); + exit(-1); + } + + PydocProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + return 0; + } + +} diff --git a/languages/python/pydoc.h b/languages/python/pydoc.h new file mode 100644 index 00000000..e17a257a --- /dev/null +++ b/languages/python/pydoc.h @@ -0,0 +1,30 @@ +#ifndef _PYDOC_H_ +#define _PYDOC_H_ + +#include +#include + + +class PydocProtocol : public KIO::SlaveBase +{ +public: + PydocProtocol(const QCString &pool, const QCString &app); + virtual ~PydocProtocol(); + + virtual void get(const KURL& url); + virtual void stat(const KURL& url); + virtual void mimetype(const KURL& url); + virtual void listDir(const KURL& url); + +protected: + void decodeURL(const KURL &url); + void decodePath(QString path); + QCString errorMessage(); + +private: + QString python; + QString script; + QString key; +}; + +#endif diff --git a/languages/python/pydoc.protocol b/languages/python/pydoc.protocol new file mode 100644 index 00000000..4801357f --- /dev/null +++ b/languages/python/pydoc.protocol @@ -0,0 +1,9 @@ +[Protocol] +exec=kio_pydoc +protocol=pydoc +input=none +output=filesystem +reading=true +listing=Name +determineMimetypeFromExtension=false +Icon=help diff --git a/languages/python/pythonconfigwidget.cpp b/languages/python/pythonconfigwidget.cpp new file mode 100644 index 00000000..87472477 --- /dev/null +++ b/languages/python/pythonconfigwidget.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "pythonconfigwidget.h" + +#include +#include +#include "domutil.h" + + +PythonConfigWidget::PythonConfigWidget(QDomDocument &projectDom, + QWidget *parent, const char *name) + : PythonConfigWidgetBase(parent, name), dom(projectDom) +{ + interpreter_edit->setText(DomUtil::readEntry(dom, "/kdevpythonsupport/run/interpreter")); + terminal_box->setChecked(DomUtil::readBoolEntry(dom, "/kdevpythonsupport/run/terminal")); +} + + +PythonConfigWidget::~PythonConfigWidget() +{} + + +void PythonConfigWidget::accept() +{ + DomUtil::writeEntry(dom, "/kdevpythonsupport/run/interpreter", interpreter_edit->text()); + DomUtil::writeBoolEntry(dom, "/kdevpythonsupport/run/terminal", terminal_box->isChecked()); +} + +#include "pythonconfigwidget.moc" diff --git a/languages/python/pythonconfigwidget.h b/languages/python/pythonconfigwidget.h new file mode 100644 index 00000000..22708c29 --- /dev/null +++ b/languages/python/pythonconfigwidget.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _PYTHONCONFIGWIDGET_H_ +#define _PYTHONCONFIGWIDGET_H_ + +#include "pythonconfigwidgetbase.h" +#include + + +class PythonConfigWidget : public PythonConfigWidgetBase +{ + Q_OBJECT + +public: + PythonConfigWidget( QDomDocument &projectDom, QWidget *parent=0, const char *name=0 ); + ~PythonConfigWidget(); + +public slots: + void accept(); + +private: + QDomDocument &dom; +}; + +#endif diff --git a/languages/python/pythonconfigwidgetbase.ui b/languages/python/pythonconfigwidgetbase.ui new file mode 100644 index 00000000..d3228822 --- /dev/null +++ b/languages/python/pythonconfigwidgetbase.ui @@ -0,0 +1,121 @@ + +PythonConfigWidgetBase + + + python_config_widget + + + + 0 + 0 + 600 + 480 + + + + Python + + + + unnamed + + + + interpreter_label + + + Python &interpreter: + + + interpreter_edit + + + + + Layout1 + + + + unnamed + + + 0 + + + + + interpreter_edit + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + Spacer3 + + + Vertical + + + Minimum + + + + 20 + 20 + + + + + + terminal_box + + + &Execute programs in a terminal + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + kdialog.h + + + + + klineedit.h + + diff --git a/languages/python/pythonimplementationwidget.cpp b/languages/python/pythonimplementationwidget.cpp new file mode 100644 index 00000000..151fe9c3 --- /dev/null +++ b/languages/python/pythonimplementationwidget.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "pythonimplementationwidget.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +PythonImplementationWidget::PythonImplementationWidget(KDevLanguageSupport* part, + QWidget* parent, const char* name, bool modal) + : ImplementationWidget(part, parent, name, modal) +{ +} + + +PythonImplementationWidget::~PythonImplementationWidget() +{ +} + + +QStringList PythonImplementationWidget::createClassFiles() +{ +// QString template_py = "require '$BASEFILENAME$'\n\nclass $CLASSNAME$ < $BASECLASSNAME$\n\n def initialize(*k)\n super(*k)\n end\n\nend\n"; + QString template_py = "from qt import *\nfrom $BASEFILENAME$ import *\nclass $CLASSNAME$($BASECLASSNAME$):\n\n def __init__(self,parent,name):\n $BASECLASSNAME$.__init__(self,parent,name)\n \n\n\n"; + + QFileInfo formInfo(m_formName); + template_py.replace(QRegExp("\\$BASEFILENAME\\$"), formInfo.baseName()+".py"); + template_py.replace(QRegExp("\\$CLASSNAME\\$"), classNameEdit->text()); + template_py.replace(QRegExp("\\$BASECLASSNAME\\$"), m_baseClassName); + + template_py = FileTemplate::read(m_part, "py") + template_py; + + QString file_py = fileNameEdit->text() + ".py"; + if (!m_part->project()->activeDirectory().isEmpty()) + file_py = m_part->project()->activeDirectory() + "/" + file_py; + QFile file(QDir::cleanDirPath(m_part->project()->projectDirectory() + "/" + file_py)); + if (!file.open(IO_WriteOnly)) { + KMessageBox::error(0, i18n("Cannot write to file")); + return QStringList(); + } + QTextStream stream(&file); + stream << template_py; + file.close(); + + QStringList files; + files.append(file_py); + return files; +} + +#include "pythonimplementationwidget.moc" diff --git a/languages/python/pythonimplementationwidget.h b/languages/python/pythonimplementationwidget.h new file mode 100644 index 00000000..abae4a4c --- /dev/null +++ b/languages/python/pythonimplementationwidget.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef PYTHONIMPLEMENTATIONWIDGET_H +#define PYTHONIMPLEMENTATIONWIDGET_H + +#include + +class PythonImplementationWidget : public ImplementationWidget +{ +Q_OBJECT +public: + PythonImplementationWidget(KDevLanguageSupport* part, QWidget* parent = 0, const char* name = 0, bool modal = true); + + ~PythonImplementationWidget(); + + virtual QStringList createClassFiles(); + +}; + +#endif diff --git a/languages/python/pythonsupportpart.cpp b/languages/python/pythonsupportpart.cpp new file mode 100644 index 00000000..1b0e76da --- /dev/null +++ b/languages/python/pythonsupportpart.cpp @@ -0,0 +1,410 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "pythonsupportpart.h" +#include "pythonconfigwidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qtdesignerpythonintegration.h" +#include "pythonimplementationwidget.h" + +typedef KDevGenericFactory PythonSupportFactory; +static const KDevPluginInfo data("kdevpythonsupport"); +K_EXPORT_COMPONENT_FACTORY( libkdevpythonsupport, PythonSupportFactory( data ) ) + +PythonSupportPart::PythonSupportPart(QObject *parent, const char *name, const QStringList &) + : KDevLanguageSupport(&data, parent, name ? name : "PythonSupportPart") +{ + setInstance(PythonSupportFactory::instance()); + + setXMLFile("kdevpythonsupport.rc"); + + connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); + connect( partController(), SIGNAL(savedFile(const KURL&)), + this, SLOT(savedFile(const KURL&)) ); + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), + this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); + + KAction *action; + + action = new KAction( i18n("Execute Program"), "exec", 0, + this, SLOT(slotExecute()), + actionCollection(), "build_exec" ); + action->setToolTip( i18n("Execute program") ); + action->setWhatsThis(i18n("Execute program

Runs the Python program.")); + + action = new KAction( i18n("Execute String..."), "exec", 0, + this, SLOT(slotExecuteString()), + actionCollection(), "build_execstring" ); + action->setToolTip( i18n("Execute string") ); + action->setWhatsThis(i18n("Execute String

Executes a string as Python code.")); + + action = new KAction( i18n("Start Python Interpreter"), "exec", 0, + this, SLOT(slotStartInterpreter()), + actionCollection(), "build_runinterpreter" ); + action->setToolTip( i18n("Start Python interpreter") ); + action->setWhatsThis(i18n("Start python interpreter

Starts the Python interpreter without a program")); + + action = new KAction( i18n("Python Documentation..."), 0, + this, SLOT(slotPydoc()), + actionCollection(), "help_pydoc" ); + action->setToolTip( i18n("Python documentation") ); + action->setWhatsThis(i18n("Python documentation

Shows a Python documentation page.")); +} + + +PythonSupportPart::~PythonSupportPart() +{} + + +void PythonSupportPart::contextMenu(QPopupMenu *popup, const Context *context) +{ + if (context->hasType(Context::FileContext)){ + const FileContext *fc = static_cast(context); + //this is a .ui file and only selection contains only one such file + KURL url = fc->urls().first(); + if (url.fileName().endsWith(".ui")) + { + m_contextFileName = url.fileName(); + int id = popup->insertItem(i18n("Create or Select Implementation..."), this, SLOT(slotCreateSubclass())); + popup->setWhatsThis(id, i18n("Create or select implementation

Creates or selects a subclass of selected form for use with integrated KDevDesigner.")); + } + } +} + + +void PythonSupportPart::projectConfigWidget(KDialogBase *dlg) +{ + QVBox *vbox = dlg->addVBoxPage(i18n("Python")); + PythonConfigWidget *w = new PythonConfigWidget(*projectDom(), vbox, "python config widget"); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + + +void PythonSupportPart::projectOpened() +{ + kdDebug(9014) << "projectOpened()" << endl; + + connect( project(), SIGNAL(addedFilesToProject(const QStringList &)), + this, SLOT(addedFilesToProject(const QStringList &)) ); + connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)), + this, SLOT(removedFilesFromProject(const QStringList &)) ); + + // We want to parse only after all components have been + // properly initialized + QTimer::singleShot(0, this, SLOT(initialParse())); +} + + +void PythonSupportPart::projectClosed() +{ +} + + +void PythonSupportPart::maybeParse(const QString fileName) +{ + QFileInfo fi(fileName); + if (fi.extension() == "py") { + + if( codeModel()->hasFile(fileName) ){ + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); + } + + parse( fileName ); + } +} + + +void PythonSupportPart::initialParse() +{ + kdDebug(9014) << "initialParse()" << endl; + + if (project()) { + kapp->setOverrideCursor(waitCursor); + QStringList files = project()->allFiles(); + for (QStringList::Iterator it = files.begin(); it != files.end() ;++it) { + kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl; + maybeParse(project()->projectDirectory() + "/" + *it); + } + + emit updatedSourceInfo(); + kapp->restoreOverrideCursor(); + } else { + kdDebug(9014) << "No project" << endl; + } +} + + +void PythonSupportPart::addedFilesToProject(const QStringList &fileList) +{ + kdDebug(9014) << "addedFilesToProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + QString fileName = project()->projectDirectory() + "/" + ( *it ); + maybeParse( fileName ); + emit addedSourceInfo( fileName ); + } + + //emit updatedSourceInfo(); +} + + +void PythonSupportPart::removedFilesFromProject(const QStringList &fileList) +{ + kdDebug(9014) << "removedFilesFromProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + QString fileName = project()->projectDirectory() + "/" + ( *it ); + + if( codeModel()->hasFile(fileName) ){ + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); + } + } + + //emit updatedSourceInfo(); +} + + +void PythonSupportPart::savedFile(const KURL &fileName) +{ + kdDebug(9014) << "savedFile()" << endl; + + if (project()->allFiles().contains(fileName.path().mid ( project()->projectDirectory().length() + 1 ))) { + maybeParse(fileName.path()); + emit addedSourceInfo( fileName.path() ); + } +} + + +KDevLanguageSupport::Features PythonSupportPart::features() +{ + return Features(Classes | Functions); +} + + +KMimeType::List PythonSupportPart::mimeTypes( ) +{ + KMimeType::List list; + KMimeType::Ptr mime = KMimeType::mimeType( "text/x-python" ); + if( mime ) + list << mime; + + mime = KMimeType::mimeType( "application/x-python" ); + if( mime ) + list << mime; + + return list; +} + +void PythonSupportPart::parse(const QString &fileName) +{ + QFile f(QFile::encodeName(fileName)); + if (!f.open(IO_ReadOnly)) + return; + QTextStream stream(&f); + + QRegExp classre("^[ \t]*class[ \t]+([A-Za-z0-9_]+)[ \t]*(\\(([A-Za-z0-9_, \t]+)\\))?.*$"); + QRegExp methodre("^[ \t]*def[ \t]+([A-Za-z0-9_]+).*$"); + + FileDom m_file = codeModel()->create(); + m_file->setName( fileName ); + + ClassDom lastClass; + QString rawline; + QCString line; + int lineNo = 0; + while (!stream.atEnd()) { + rawline = stream.readLine(); + line = rawline.stripWhiteSpace().local8Bit(); + if (classre.search(line) != -1) { + + lastClass = codeModel()->create(); + lastClass->setName(classre.cap(1)); + lastClass->setFileName( fileName ); + lastClass->setStartPosition( lineNo, 0 ); + + QStringList parentList = QStringList::split(",", classre.cap(3)); + QStringList::ConstIterator it; + for (it = parentList.begin(); it != parentList.end(); ++it) { + QString baseName = (*it).stripWhiteSpace(); + kdDebug(9014) << "Add parent" << baseName << endl; + lastClass->addBaseClass( baseName ); + } + + if (m_file->hasClass(lastClass->name())) { + ClassDom old = m_file->classByName( lastClass->name() )[ 0 ]; + old->setFileName( lastClass->fileName() ); + + int line, col; + lastClass->getStartPosition( &line, &col ); + old->setStartPosition( line, col ); + + lastClass = old; + } else { + kdDebug(9014) << "Add class " << lastClass->name() << endl; + m_file->addClass( lastClass ); + } + + } else if (methodre.search(line) != -1 ) { + + FunctionDom method = codeModel()->create(); + method->setName(methodre.cap(1)); + method->setFileName( fileName ); + method->setStartPosition( lineNo, 0 ); + + if (lastClass && rawline.left(3) != "def") { + if( !lastClass->hasFunction(method->name()) ) + lastClass->addFunction( method ); + QStringList scope; + scope << lastClass->name(); + method->setScope( scope ); + + } else if( !m_file->hasFunction(method->name()) ){ + m_file->addFunction( method ); + lastClass = 0; + } + } + ++lineNo; + } + + f.close(); + + codeModel()->addFile( m_file ); +} + + +QString PythonSupportPart::interpreter() +{ + QString prog = DomUtil::readEntry(*projectDom(), "/kdevpythonsupport/run/interpreter"); + if (prog.isEmpty()) + prog = "python"; + + return prog; +} + + +void PythonSupportPart::startApplication(const QString &program) +{ + bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevpythonsupport/run/terminal"); + if (KDevAppFrontend *appFrontend = extension("KDevelop/AppFrontend")) + appFrontend->startAppCommand(QString::QString(), program, inTerminal); +} + + +void PythonSupportPart::slotExecute() +{ + QString program = project()->mainProgram(); + QString cmd = interpreter() + " " + program; + startApplication(cmd); +} + + +void PythonSupportPart::slotStartInterpreter() +{ + startApplication(interpreter()); +} + + +void PythonSupportPart::slotExecuteString() +{ + bool ok; + QString cmd = KInputDialog::getText(i18n("String to Execute"), i18n("String to execute:"), QString::null, &ok, 0); + if (ok) { + cmd.prepend("'"); + cmd.append("'"); + startApplication(cmd); + } +} + + +void PythonSupportPart::slotPydoc() +{ + bool ok; + QString key = KInputDialog::getText(i18n("Show Python Documentation"), i18n("Show Python documentation on keyword:"), "", &ok, 0); + if (ok && !key.isEmpty()) { + QString url = "pydoc:"; + url += key; + partController()->showDocument(KURL(url)); + } +} + +KDevDesignerIntegration *PythonSupportPart::designer(KInterfaceDesigner::DesignerType type) +{ + KDevDesignerIntegration *des = 0; + switch (type) + { + case KInterfaceDesigner::QtDesigner: + des = m_designers[type]; + if (des == 0) + { + PythonImplementationWidget *impl = new PythonImplementationWidget(this); + des = new QtDesignerPythonIntegration(this, impl); + des->loadSettings(*project()->projectDom(), + "kdevpythonsupport/designerintegration"); + m_designers[type] = des; + } + break; + case KInterfaceDesigner::Glade: + break; + } + return des; + +} + +void PythonSupportPart::slotCreateSubclass() +{ + QFileInfo fi(m_contextFileName); + kdDebug(9014) << k_funcinfo << " file: " << m_contextFileName << " ext: " << fi.extension(false) << endl; + if (fi.extension(false) != "ui") + return; + QtDesignerPythonIntegration *des = dynamic_cast(designer(KInterfaceDesigner::QtDesigner)); + if (des) + { + kdDebug(9014) << "ok: " << des << endl; + kdDebug(9014) << "have impl: " << des->selectImplementation(m_contextFileName); + } + kdDebug(9014) << "end: " << des << endl; +} + +#include "pythonsupportpart.moc" diff --git a/languages/python/pythonsupportpart.h b/languages/python/pythonsupportpart.h new file mode 100644 index 00000000..ad2085e5 --- /dev/null +++ b/languages/python/pythonsupportpart.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _PYTHONSUPPORTPART_H_ +#define _PYTHONSUPPORTPART_H_ + + +#include "kdevlanguagesupport.h" + +class KDialogBase; +class QStringList; +class QPopupMenu; +class Context; + +class PythonSupportPart : public KDevLanguageSupport +{ + Q_OBJECT + +public: + PythonSupportPart( QObject *parent, const char *name, const QStringList & ); + ~PythonSupportPart(); + + virtual KDevDesignerIntegration *designer(KInterfaceDesigner::DesignerType type); + +public slots: + void contextMenu(QPopupMenu *popup, const Context *context); + void slotCreateSubclass(); + +protected: + virtual Features features(); + virtual KMimeType::List mimeTypes(); + +private slots: + void projectConfigWidget(KDialogBase *dlg); + void projectOpened(); + void projectClosed(); + void savedFile(const KURL &fileName); + void addedFilesToProject(const QStringList &fileList); + void removedFilesFromProject(const QStringList &fileList); + void slotExecute(); + void slotExecuteString(); + void slotStartInterpreter(); + + // Internal + void initialParse(); + void slotPydoc(); + +private: + QString interpreter(); + void startApplication(const QString &program); + void maybeParse(const QString fileName); + void parse(const QString &fileName); + + QMap m_designers; + QString m_contextFileName; +}; + +#endif diff --git a/languages/python/qtdesignerpythonintegration.cpp b/languages/python/qtdesignerpythonintegration.cpp new file mode 100644 index 00000000..5a47d810 --- /dev/null +++ b/languages/python/qtdesignerpythonintegration.cpp @@ -0,0 +1,97 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "qtdesignerpythonintegration.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "codemodel_utils.h" +#include "implementationwidget.h" + +QtDesignerPythonIntegration::QtDesignerPythonIntegration(KDevLanguageSupport* part, ImplementationWidget* impl) + :QtDesignerIntegration(part, impl, false, 0) +{ +} + + +QtDesignerPythonIntegration::~QtDesignerPythonIntegration() +{ +} + + +void QtDesignerPythonIntegration::addFunctionToClass(KInterfaceDesigner::Function function, ClassDom klass) +{ + m_part->partController()->editDocument( KURL( klass->fileName() ) ); + KTextEditor::EditInterface* editIface = dynamic_cast( m_part->partController()->activePart() ); + if( !editIface ){ + /// @todo show messagebox +// QDialog::accept(); + return; + } + + kdDebug(9014) << "===============" << endl; + + int line, column; + klass->getStartPosition( &line, &column ); + + // compute the insertion point + QPair point; + point.first = line + 1; + point.second = column; + + const FunctionList functionList = klass->functionList(); + if (functionList.count() > 0) + { + int funEndLine, funEndColumn; + functionList.first()->getEndPosition(&funEndLine, &funEndColumn); + point.second = funEndColumn; + } + + QString func = function.function; + func.replace("()", ""); + QString str = " def " + func + "(self):\n\n"; + + kdDebug(9014) << "insert " << str << " into " << point.first << endl; + + editIface->insertText(point.first, 0 /*pt.second*/, str ); + + KTextEditor::View *activeView = dynamic_cast( m_part->partController()->activePart()->widget() ); + if (activeView) + { + KTextEditor::ViewCursorInterface* cursor = dynamic_cast(activeView ); + if (cursor) + cursor->setCursorPositionReal(point.first, 4); + } +} + +#include "qtdesignerpythonintegration.moc" diff --git a/languages/python/qtdesignerpythonintegration.h b/languages/python/qtdesignerpythonintegration.h new file mode 100644 index 00000000..8ac5d5be --- /dev/null +++ b/languages/python/qtdesignerpythonintegration.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef QTDESIGNERPYTHONINTEGRATION_H +#define QTDESIGNERPYTHONINTEGRATION_H + +#include + +class QtDesignerPythonIntegration : public QtDesignerIntegration +{ +Q_OBJECT +public: + QtDesignerPythonIntegration(KDevLanguageSupport* part, ImplementationWidget* impl); + + ~QtDesignerPythonIntegration(); + + virtual void addFunctionToClass(KInterfaceDesigner::Function function, ClassDom klass); + +}; + +#endif -- cgit v1.2.3