[anjuta] project-wizard: Fixed pygtk project to use pygobject instead of pygtk
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: Fixed pygtk project to use pygobject instead of pygtk
- Date: Thu, 17 Mar 2011 21:42:57 +0000 (UTC)
commit 6dcd92512cbb32a876c6aa6d93fda135e1ac5442
Author: Johannes Schmid <jhs gnome org>
Date: Thu Mar 17 17:25:36 2011 -0400
project-wizard: Fixed pygtk project to use pygobject instead of pygtk
configure.ac | 1 -
plugins/project-wizard/templates/pygtk.wiz.in | 16 ++++++---
plugins/project-wizard/templates/pygtk/Makefile.am | 2 +-
.../templates/pygtk/data/Makefile.am | 5 ---
.../project-wizard/templates/pygtk/data/project.ui | 39 --------------------
plugins/project-wizard/templates/pygtk/src/main.py | 37 ++++++++-----------
6 files changed, 27 insertions(+), 73 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 129f415..4413c46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,7 +802,6 @@ plugins/project-wizard/templates/python/po/Makefile
plugins/project-wizard/templates/pygtk/Makefile
plugins/project-wizard/templates/pygtk/src/Makefile
plugins/project-wizard/templates/pygtk/po/Makefile
-plugins/project-wizard/templates/pygtk/data/Makefile
plugins/project-wizard/templates/vala-gtk/Makefile
plugins/project-wizard/templates/vala-gtk/src/Makefile
plugins/project-wizard/templates/wxwin/Makefile
diff --git a/plugins/project-wizard/templates/pygtk.wiz.in b/plugins/project-wizard/templates/pygtk.wiz.in
index d8c3b29..f5f698b 100644
--- a/plugins/project-wizard/templates/pygtk.wiz.in
+++ b/plugins/project-wizard/templates/pygtk.wiz.in
@@ -2,14 +2,14 @@
<project-wizard>
<_name>PyGTK (automake)</_name>
<_description>PyGTK project using automake</_description>
- <icon>pygtk-logo.png</icon>
+ <icon>gtk-logo.png</icon>
<category>Python</category>
<order>1</order>
<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>
+ <required-package>gtk+-3.0</required-package>
<!-- Not working: <required-package>python-gtk2</required-package>-->
</project-wizard>
@@ -35,6 +35,7 @@
<property type="hidden" name="NameHLower" default='[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]'/>
<property type="boolean" name="HaveI18n" _label="Add internationalization:" _description="Adds support for internationalization so that your project can have translations in different languages" default="0"/>
<property type="boolean" name="HavePackage" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
+ <property type="hidden" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:" _description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at runtime" default="1"/>
</page>
[+IF (=(get "HavePackage") "1")+]
@@ -69,10 +70,15 @@
<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="gtk" destination="[+Destination+]">
+ <directory source="src">
+[+IF (=(get "HaveBuilderUI") "1")+]
+ <file source="project.ui" destination="[+NameHLower+].ui"/>
+[+ENDIF+]
+ </directory>
+ </directory>
+
<directory source="licenses" destination="[+Destination+]">
<file source="[+License+]" destination="COPYING"/>
</directory>
diff --git a/plugins/project-wizard/templates/pygtk/Makefile.am b/plugins/project-wizard/templates/pygtk/Makefile.am
index 0b2c63e..f266588 100644
--- a/plugins/project-wizard/templates/pygtk/Makefile.am
+++ b/plugins/project-wizard/templates/pygtk/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = src po data
+SUBDIRS = src po
wizard_filesdir = $(anjuta_data_dir)/project/pygtk
wizard_files_DATA = \
diff --git a/plugins/project-wizard/templates/pygtk/src/main.py b/plugins/project-wizard/templates/pygtk/src/main.py
index cc05ac7..68c39c4 100644
--- a/plugins/project-wizard/templates/pygtk/src/main.py
+++ b/plugins/project-wizard/templates/pygtk/src/main.py
@@ -10,36 +10,29 @@
[+ == "GPL" +][+(gpl (get "Name") "# ")+]
[+ESAC+]
-import sys
-try:
- import gtk
-except ImportError:
- sys.exit("pygtk not found.")
+from gi.repository import Gtk, GdkPixbuf, Gdk
+import os, sys
#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 = "[+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 __init__(self):
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file(UI_FILE)
+ self.builder.connect_signals(self)
- def quit(self, widget, *event):
- gtk.main_quit()
+ window = self.builder.get_object('window')
+ window.show_all()
-def main():
- app = GUI()
- app.window.show()
- gtk.main()
+ def destroy(window, self):
+ Gtk.main_quit()
+def main():
+ app = GUI()
+ Gtk.main()
+
if __name__ == "__main__":
sys.exit(main())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]