#!/usr/bin/python # This is -*- Python -*- import sys, string, time #sys.path.append("/opt/pygtk/lib/python2.3/site-packages") import pygtk pygtk.require("2.0") import pango, gtk sys.path.append("..") # add path for gnoetics library import gnoetics import appwindow, splash, textpicker, poemtextview, poemtileview gtk.gdk.threads_init() # A hack: read a font off of the command line if len(sys.argv) == 2: font = pango.FontDescription(sys.argv[1]) poemtextview.PoemTextView.default_font = font poemtileview.PoemTileView.default_font = font ############################################################################# ### ### Initial Set-up ### def setup(): tri = gnoetics.Trimodel() sys.stderr.write("*** Loading... ") t1 = time.time() count = 0 for txt in gnoetics.Library(dir="../texts-ts"): tri.add_text(txt) count += 1 t2 = time.time() sys.stderr.write("done. (%.1fs)\n" % (t2-t1)) sys.stderr.write("*** Preparing model... ") t1 = time.time() tri.prepare() t2 = time.time() sys.stderr.write("done. (%.1fs)\n" % (t2-t1)) sys.stderr.write("\n") poem = gnoetics.BlankVerse(3, 4) appwin = appwindow.AppWindow(model=tri) appwin.set_poem(poem) appwin.show_all() def post_splash_cb(): appwindow.launch(is_first=True) # No splash screen, just go straight to the callback. #splash.splash(4, post_splash_cb) post_splash_cb() gtk.main()