fpdb/test_Python_Libs.py

86 lines
2.4 KiB
Python
Raw Normal View History

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
2009-12-08 23:48:52 +01:00
"""test2.py
Test if gtk is working.
"""
# Copyright 2008-2010, Ray E. Barker
2009-12-08 23:48:52 +01:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
import sys
import os
2010-02-05 14:29:07 +01:00
import Configuration
config_path = Configuration.get_default_config_path()
2009-12-08 23:48:52 +01:00
try:
import gobject as _gobject
print "Import of gobject:\tSuccess"
2009-12-08 23:48:52 +01:00
import pygtk
print "Import of pygtk:\tSuccess"
2009-12-08 23:48:52 +01:00
pygtk.require('2.0')
import gtk
print "Import of gtk:\t\tSuccess"
import pango
print "Import of pango:\tSuccess"
2009-12-08 23:48:52 +01:00
if os.name == 'nt':
import win32
import win32api
print "Import of win32:\tSuccess"
try:
import matplotlib
matplotlib.use('GTK')
print "Import of matplotlib:\tSuccess"
import numpy
print "Import of numpy:\tSuccess"
import pylab
print "Import of pylab:\tSuccess"
except:
print "\nError:", sys.exc_info()
print "\npress return to finish"
sys.stdin.readline()
2009-12-08 23:48:52 +01:00
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.set_title("Test GTK")
win.set_border_width(1)
win.set_default_size(600, 500)
win.set_resizable(True)
#win.show()
dia = gtk.Dialog("Test GTK",
win,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CLOSE, gtk.RESPONSE_OK))
dia.set_default_size(500, 300)
2010-02-05 14:29:07 +01:00
l = gtk.Label("GTK is working!\nConfig location: %s" %config_path)
2009-12-08 23:48:52 +01:00
dia.vbox.add(l)
l.show()
response = dia.run()
if response == gtk.RESPONSE_ACCEPT:
pass
dia.destroy()
except:
print "\nError:", sys.exc_info()
print "\npress return to finish"
sys.stdin.readline()