[anjuta] project-wizard: Add ability to not use Gtk.Builder to pygtk project



commit 380dea65ccf18efb6af50f66fbc81723cd738991
Author: Johannes Schmid <jhs gnome org>
Date:   Sat Mar 19 19:21:07 2011 -0400

    project-wizard: Add ability to not use Gtk.Builder to pygtk project

 plugins/project-wizard/templates/pygtk.wiz.in      |    2 +-
 .../templates/pygtk/src/Makefile.am.tpl            |    9 ++++++++-
 plugins/project-wizard/templates/pygtk/src/main.py |    7 +++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/plugins/project-wizard/templates/pygtk.wiz.in b/plugins/project-wizard/templates/pygtk.wiz.in
index f5f698b..0dc821e 100644
--- a/plugins/project-wizard/templates/pygtk.wiz.in
+++ b/plugins/project-wizard/templates/pygtk.wiz.in
@@ -35,7 +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"/>
+		<property type="boolean" 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")+]
diff --git a/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl b/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl
index 40c9f2e..5cd94d0 100644
--- a/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/pygtk/src/Makefile.am.tpl
@@ -2,8 +2,10 @@
 ## Process this file with automake to produce Makefile.in
 ## Created by Anjuta
 
+[+IF (=(get "HaveBuilderUI") "1")+]
 uidir = $(datadir)/[+NameHLower+]/ui
 ui_DATA = ../data/[+NameHLower+].ui
+[+ENDIF+]
 
 ## The main script
 bin_SCRIPTS = [+NameHLower+].py
@@ -11,12 +13,17 @@ bin_SCRIPTS = [+NameHLower+].py
 ## Directory where .class files will be installed
 [+NameCLower+]dir = $(pythondir)/[+NameHLower+]
 
-EXTRA_DIST = $(ui_DATA)
 
 [+NameCLower+]_PYTHON = \
 	[+NameHLower+].py
 
+[+IF (=(get "HaveBuilderUI") "1")+]
+EXTRA_DIST = $(ui_DATA)
+[+ENDIF+]
+
 # Remove ui directory on uninstall
 uninstall-local:
+[+IF (=(get "HaveBuilderUI") "1")+]
 	-rm -r $(uidir)
+[+ENDIF+]
 	-rm -r $(datadir)/[+NameHLower+]
diff --git a/plugins/project-wizard/templates/pygtk/src/main.py b/plugins/project-wizard/templates/pygtk/src/main.py
index 68c39c4..9c96b08 100644
--- a/plugins/project-wizard/templates/pygtk/src/main.py
+++ b/plugins/project-wizard/templates/pygtk/src/main.py
@@ -20,11 +20,18 @@ UI_FILE = "[+NameHLower+].ui"
 
 class GUI:
 	def __init__(self):
+[+IF (=(get "HaveBuilderUI") "1")+]
 		self.builder = Gtk.Builder()
 		self.builder.add_from_file(UI_FILE)
 		self.builder.connect_signals(self)
 
 		window = self.builder.get_object('window')
+[+ELSE+]
+		window = Gtk.Window()
+		window.set_title ("Hello World")
+		window.connect_after('destroy', self.destroy)
+[+ENDIF+]
+
 		window.show_all()
 
 	def destroy(window, self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]