#!/usr/bin/env python
#
# Dots - A braille translation program.
#
# Copyright (C) 2009 Eitan Isaacson
#
# 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 3 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, see <http://www.gnu.org/licenses/>.

import os.path, sys
import pygtk
pygtk.require('2.0')
import gtk

# We can't rely on prefix if we're installed by relocated RPM. Instead, we 
# use __file__ and for now hope that lib is relative to bin.
sys.prefix = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
libs = os.path.join(sys.prefix, 'lib',
                    'python2.6', 'site-packages')
# point to the proper site-packages path
sys.path.insert(1, libs)

# This might be run from the build dir.
_dirname = os.path.dirname(__file__)
if os.path.dirname(__file__) != "/opt/gnome/bin":
    srcdir = os.path.normpath(os.path.join(_dirname, '..'))
    sys.path.insert(1, srcdir)
    import dots
    dots.host_settings.gtkbuilder_dir = os.path.join(srcdir, 'data')
else:
    import dots

main_window = dots.AppWindow()
main_window.run()
