project-wizard: bgo #732672 - Suggestion to use a Glade prompted handler name rather...
[anjuta.git] / plugins / project-wizard / templates / pygtk / src / main.py
blob4bca3f6a92060c71c192d0131a50380c2f9c5a5f
1 [+ autogen5 template +]
2 #!/usr/bin/env python
3 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
4 [+INCLUDE (string-append "indent.tpl") \+]
5 # [+INVOKE EMACS-MODELINE MODE="Python; coding: utf-8" +]
6 [+INVOKE START-INDENT\+]
8 # main.py
9 # Copyright (C) [+(shell "date +%Y")+] [+Author+][+IF (get "Email")+] <[+Email+]>[+ENDIF+]
11 [+INVOKE LICENSE-DESCRIPTION PFX="# " PROGRAM=(get "Name") OWNER=(get "Author") \+]
13 from gi.repository import Gtk, GdkPixbuf, Gdk
14 import os, sys
16 [+IF (=(get "HaveBuilderUI") "1")+]
17 #Comment the first line and uncomment the second before installing
18 #or making the tarball (alternatively, use project variables)
19 UI_FILE = "src/[+NameHLower+].ui"
20 #UI_FILE = "/usr/local/share/[+NameHLower+]/ui/[+NameHLower+].ui"
21 [+ENDIF+]
23 class GUI:
24 def __init__(self):
25 [+IF (=(get "HaveBuilderUI") "1")+]
26 self.builder = Gtk.Builder()
27 self.builder.add_from_file(UI_FILE)
28 self.builder.connect_signals(self)
30 window = self.builder.get_object('window')
31 [+ELSE+]
32 window = Gtk.Window()
33 window.set_title ("Hello World")
34 window.connect_after('destroy', self.on_window_destroy)
35 [+ENDIF+]
37 window.show_all()
39 def on_window_destroy(self, window):
40 Gtk.main_quit()
42 def main():
43 app = GUI()
44 Gtk.main()
46 if __name__ == "__main__":
47 sys.exit(main())
48 [+INVOKE END-INDENT\+]