2
# -*- coding: utf-8 -*-
4
# glChess is a 2D/3D chess game for GNOME. This is the startup
5
# script which imports the relevant modules. Please keep the startup
6
# script in sync between glChess and gnome-sudoku.
8
# Copyright (c) 2008 You may use and distribute this
9
# software under the terms of the GNU General Public License,
15
# Some version of PyGTK require this to be called before importing the gtk module
19
# Ignore any exceptions writing to stdout using print statements
22
self.stdout = sys.stdout
25
return self.stdout.fileno()
27
def write(self, data):
29
self.stdout.write(data)
32
sys.stdout = SafeStdout()
34
# Setup bugbuddy to report unhandled exceptions.
37
bugbuddy.install('glchess')
46
from gettext import gettext as _
48
gettext.bindtextdomain('gnome-games', os.path.join('@prefix@', 'share', 'locale'))
49
gettext.textdomain('gnome-games')
50
# Translators: This is the title of the dialog displayed if glChess cannot start
51
title = _("Chess incorrectly installed")
52
# Translators: This is the contents of the dialog displayed if glChess cannot start
53
description = _("""Chess is not able to start because required application files are not installed. If you are currently upgrading your system please wait until the upgrade has completed.""")
60
print '-' * len(title)
63
dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, message_format = title)
64
dialog.format_secondary_text(description)
65
dialog.add_button(gtk.STOCK_QUIT, gtk.RESPONSE_CLOSE)
69
# Chek if we are installed
70
root_dir = os.path.dirname(__file__)
71
if os.path.exists(os.path.join(root_dir, 'Makefile.am')):
72
sys.path.insert(0, os.path.abspath(root_dir))
74
sys.modules['glchess'] = sys.modules['lib']
77
# Import glChess from pyexecdir or system installation.
78
from glchess.glchess import start_game
81
# Import of glChess failed. Show error message.