[anjuta/python-support: 26/28] Add PyGTK project template. Fixes bug #608304.
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/python-support: 26/28] Add PyGTK project template. Fixes bug #608304.
- Date: Thu, 5 Aug 2010 17:51:52 +0000 (UTC)
commit 08bf9e9c332862ee5cc9c2f0dde9c840f307bd1d
Author: Leandro Mattioli <leandro mattioli gmail com>
Date: Sun Jan 31 00:18:44 2010 -0200
Add PyGTK project template. Fixes bug #608304.
plugins/project-wizard/templates/pygtk-logo.png | Bin 0 -> 4825 bytes
plugins/project-wizard/templates/pygtk.wiz | 94 ++++++++++++++++++++
.../templates/pygtk/configure.ac.tpl | 67 ++++++++++++++
.../project-wizard/templates/pygtk/data/project.ui | 39 ++++++++
.../project-wizard/templates/pygtk/po/POTFILES.in | 4 +
.../project-wizard/templates/pygtk/project.anjuta | 37 ++++++++
.../templates/pygtk/src/Makefile.am.tpl | 22 +++++
plugins/project-wizard/templates/pygtk/src/main.py | 45 +++++++++
8 files changed, 308 insertions(+), 0 deletions(-)
---
diff --git a/plugins/project-wizard/templates/pygtk-logo.png b/plugins/project-wizard/templates/pygtk-logo.png
new file mode 100644
index 0000000..d3d3015
Binary files /dev/null and b/plugins/project-wizard/templates/pygtk-logo.png differ
diff --git a/plugins/project-wizard/templates/pygtk.wiz b/plugins/project-wizard/templates/pygtk.wiz
new file mode 100644
index 0000000..39b2cac
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk.wiz
@@ -0,0 +1,94 @@
+<project-wizard>
+ <_name>PyGTK (automake)</_name>
+ <_description>PyGTK project using automake</_description>
+ <icon>pygtk-logo.png</icon>
+ <category>Python</category>
+ <required-program>automake</required-program>
+ <required-program>autoconf</required-program>
+ <required-program>make</required-program>
+ <required-program>python</required-program>
+ <required-package>gtk+-2.0 >= 2.8</required-package>
+ <!-- Not working: <required-package>python-gtk2</required-package>-->
+</project-wizard>
+
+<page name="basic" _label="Basic information" _description="General Project Information">
+ <property type="string" name="Name" _label="Project Name:" _description="project name" default="pygtk-foobar" summary="yes" restriction="filename" mandatory="yes"/>
+ <property type="string" name="Author" _label="Author:" _description="" default="[+UserName+]" mandatory="yes"/>
+ <property type="string" name="Email" _label="Email address:" _description="" default="[+EmailAddress+]" mandatory="no"/>
+ <property type="string" name="Version" _label="Version:" default="0.1" mandatory="yes"/>
+</page>
+
+<page name="options" _label="Project options" _description="Options for project build system">
+ <property type="directory" name="Destination" _label="Destination:" _description="" default="[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]" mandatory="yes" exist="no" summary="yes"/>
+ <property type="list" name="License" _label="License" _description="Select code license" default="GPL" editable="no">
+ <item name="GPL" _label="General Public License (GPL)"/>
+ <item name="LGPL" _label="Lesser General Public License (LGPL)"/>
+ <item name="BSD" _label="Berkeley Software Distribution License (BSD)"/>
+ <item name="None" _label="No license"/>
+ </property>
+ <property type="hidden" name="NameUpper" default="[+(string-upcase (get "Name"))+]"/>
+ <property type="hidden" name="NameLower" default="[+(string-downcase (get "Name"))+]"/>
+ <property type="hidden" name="NameCUpper" default="[+(string->c-name! (string-substitute (string-upcase (get "Name")) " " "_"))+]"/>
+ <property type="hidden" name="NameCLower" default="[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]"/>
+ <property type="hidden" name="NameHLower" default="[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]"/>
+ <property type="hidden" name="HavePackage" default="0"/>
+ <property type="boolean" name="HaveSharedlib" _label="Add shared library support:" _description="Adds support for building shared libraries in your project" default="1"/>
+ <property type="hidden" name="HaveGtkDoc" _label="Add gtk-doc system:" _description="gtk-doc is used to compile API documentations for GObject based classes" default="0"/>
+ <property type="hidden" name="HaveI18n" _label="Add internationalization:" _description="Adds support for internationalization so that your project can have translations in different languages" default="0"/>
+ <property type="hidden" name="HavePackageExtra" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
+</page>
+
+[+IF (=(get "HavePackageExtra") "1")+]
+<page name="packages" _label="Configure external packages" _description="Configure external packages">
+ <property type="string" name="PackageModule1" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 >= 2.2.0'" mandatory="yes"/>
+ <property type="string" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 >= 2.2.0'" mandatory="yes"/>
+ <property type="string" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 >= 2.2.0'"/>
+ <property type="string" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 >= 2.2.0'"/>
+ <property type="string" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 >= 2.2.0'"/>
+</page>
+[+ENDIF+]
+
+<content>
+ <directory source="terminal" destination="[+Destination+]">
+ <file source="AUTHORS"/>
+ <file source="ChangeLog"/>
+ <file source="Makefile.am.tpl" destination="Makefile.am"/>
+ <file source="NEWS"/>
+ <file source="README"/>
+ <file source="autogen.sh" executable="yes"/>
+ <file source="cvsignore" destination=".cvsignore"/>
+ <directory source="src">
+ <file source="cvsignore" destination=".cvsignore"/>
+ </directory>
+ [+IF (=(get "HaveI18n") "1") +]
+ <directory source="po">
+ <file source="ChangeLog"/>
+ <file source="LINGUAS" />
+ <file source="cvsignore" destination=".cvsignore"/>
+ </directory>
+ [+ENDIF+]
+ </directory>
+ <directory source="pygtk" destination="[+Destination+]">
+ [+IF (=(get "HaveI18n") "1") +]
+ <directory source="po">
+ <file source="POTFILES.in"/>
+ </directory>
+ [+ENDIF+]
+ <file destination="[+NameHLower+].anjuta" source="project.anjuta"/>
+ <file source="configure.ac.tpl" destination="configure.ac"/>
+ <directory source="src">
+ <file source="main.py" destination="[+NameHLower+].py" executable="yes"/>
+ <file source="Makefile.am.tpl" destination="Makefile.am"/>
+ </directory>
+ <directory source="data">
+ <file source="project.ui" destination="[+NameHLower+].ui"/>
+ </directory>
+ </directory>
+ <directory source="licenses" destination="[+Destination+]">
+ <file source="[+License+]" destination="COPYING"/>
+ </directory>
+</content>
+
+<action>
+ <open file="[+Destination+]/[+NameHLower+].anjuta"/>
+</action>
diff --git a/plugins/project-wizard/templates/pygtk/configure.ac.tpl b/plugins/project-wizard/templates/pygtk/configure.ac.tpl
new file mode 100644
index 0000000..c3278fd
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/configure.ac.tpl
@@ -0,0 +1,67 @@
+[+ autogen5 template +]
+dnl Process this file with autoconf to produce a configure script.
+dnl Created by Anjuta application wizard.
+
+AC_INIT([+NameHLower+], [+Version+])
+
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+
+AM_PATH_PYTHON
+
+[+IF (=(get "HaveI18n") "1")+]
+dnl ***************************************************************************
+dnl Internatinalization
+dnl ***************************************************************************
+GETTEXT_PACKAGE=[+NameHLower+]
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+[+ENDIF+]
+
+[+IF (=(get "HavePackage") "1")+]
+PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]])
+[+ENDIF+]
+
+[+IF (=(get "HaveGtkDoc") "1")+]
+##################################################
+# Check for gtk-doc.
+##################################################
+AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
+if test "x$with_html_dir" = "x" ; then
+ HTML_DIR='${datadir}/gtk-doc/html'
+else
+ HTML_DIR=$with_html_dir
+fi
+AC_SUBST(HTML_DIR)
+
+gtk_doc_min_version=1.0
+AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
+if pkg-config --atleast-version=$gtk_doc_min_version gtk-doc; then
+ AC_MSG_RESULT(yes)
+ GTKDOC=true
+else
+ AC_MSG_RESULT(no)
+ GTKDOC=false
+fi
+dnl Let people disable the gtk-doc stuff.
+AC_ARG_ENABLE(gtk-doc,
+ [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
+ enable_gtk_doc="$enableval", enable_gtk_doc=auto)
+if test x$enable_gtk_doc = xauto ; then
+ if test x$GTKDOC = xtrue ; then
+ enable_gtk_doc=yes
+ else
+ enable_gtk_doc=no
+ fi
+fi
+AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+[+ENDIF+]
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+[+IF (=(get "HaveI18n") "1")+]po/Makefile.in[+ENDIF+]
+])
diff --git a/plugins/project-wizard/templates/pygtk/data/project.ui b/plugins/project-wizard/templates/pygtk/data/project.ui
new file mode 100644
index 0000000..de3fdb8
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/data/project.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="window1">
+ <signal name="destroy_event" handler="quit"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Hello, World!</property>
+ </object>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="change_text"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/plugins/project-wizard/templates/pygtk/po/POTFILES.in b/plugins/project-wizard/templates/pygtk/po/POTFILES.in
new file mode 100644
index 0000000..3385caf
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/po/POTFILES.in
@@ -0,0 +1,4 @@
+[+ autogen5 template +]
+# List of source files containing translatable strings.
+
+src/main.py
diff --git a/plugins/project-wizard/templates/pygtk/project.anjuta b/plugins/project-wizard/templates/pygtk/project.anjuta
new file mode 100644
index 0000000..585bc50
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/project.anjuta
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<anjuta>
+ <plugin name="GBF Project Manager"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaProjectManager"/>
+ <require group="Project"
+ attribute="Supported-Project-Types"
+ value="automake"/>
+ </plugin>
+ <plugin name="Symbol Browser"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaSymbolManager"/>
+ </plugin>
+ <plugin name="Make Build System"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaBuildable"/>
+ <require group="Build"
+ attribute="Supported-Build-Types"
+ value="make"/>
+ </plugin>
+ <plugin name="Task Manager"
+ url="http://anjuta.org/plugins/"
+ mandatory="no">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaTodo"/>
+ </plugin>
+</anjuta>
diff --git a/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl b/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl
new file mode 100644
index 0000000..40c9f2e
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl
@@ -0,0 +1,22 @@
+[+ autogen5 template +]
+## Process this file with automake to produce Makefile.in
+## Created by Anjuta
+
+uidir = $(datadir)/[+NameHLower+]/ui
+ui_DATA = ../data/[+NameHLower+].ui
+
+## The main script
+bin_SCRIPTS = [+NameHLower+].py
+
+## Directory where .class files will be installed
+[+NameCLower+]dir = $(pythondir)/[+NameHLower+]
+
+EXTRA_DIST = $(ui_DATA)
+
+[+NameCLower+]_PYTHON = \
+ [+NameHLower+].py
+
+# Remove ui directory on uninstall
+uninstall-local:
+ -rm -r $(uidir)
+ -rm -r $(datadir)/[+NameHLower+]
diff --git a/plugins/project-wizard/templates/pygtk/src/main.py b/plugins/project-wizard/templates/pygtk/src/main.py
new file mode 100644
index 0000000..cc05ac7
--- /dev/null
+++ b/plugins/project-wizard/templates/pygtk/src/main.py
@@ -0,0 +1,45 @@
+[+ autogen5 template +]
+#!/usr/bin/python
+#
+# main.py
+# Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
+#
+[+CASE (get "License") +]
+[+ == "BSD" +][+(bsd (get "Name") (get "Author") "# ")+]
+[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") "# ")+]
+[+ == "GPL" +][+(gpl (get "Name") "# ")+]
+[+ESAC+]
+
+import sys
+try:
+ import gtk
+except ImportError:
+ sys.exit("pygtk not found.")
+
+#Comment the first line and uncomment the second before installing
+#or making the tarball (alternatively, use project variables)
+UI_FILE = "data/[+NameHLower+].ui"
+#UI_FILE = "/usr/local/share/[+NameHLower+]/ui/[+NameHLower+].ui"
+
+
+class GUI:
+ def __init__(self):
+ self.builder = gtk.Builder()
+ self.builder.add_from_file(UI_FILE)
+ self.window = self.builder.get_object("window1")
+ self.label = self.builder.get_object("label1")
+ self.builder.connect_signals(self)
+
+ def change_text(self, widget, *event):
+ self.label.set_text("Hello, pygtk world!")
+
+ def quit(self, widget, *event):
+ gtk.main_quit()
+
+def main():
+ app = GUI()
+ app.window.show()
+ gtk.main()
+
+if __name__ == "__main__":
+ sys.exit(main())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]