#!/usr/bin/env python
# -*- mode: python; coding: koi8-r; -*-
# (c) Con Radchenko, 2004. mailto:bofh@pochta.ru
#
# 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 Library 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.
# Copyright 2002 Duke University 

import os
import sys
import gtk
from gtk import gdk
from pybookreader.dictclient.pygtkdict import PyGtkDict

#dictclient_rc_file = os.path.expanduser('~/.pydictrc')
from pybookreader.config import dictclient_rc_file, dictclient_history_file

# search glade file
gf = 'pybookreader/dictclient/pygtkdict.glade'
dictclient_glade_file = None
for d in sys.path:
    f = os.path.join(d, gf)
    if os.path.exists(f):
        dictclient_glade_file = f
        break

if dictclient_glade_file:
    dict_client = PyGtkDict(dictclient_glade_file,
                            dictclient_rc_file,
                            dictclient_history_file)
    dict_client.window.connect('destroy', lambda w: gtk.main_quit())
    gdk.threads_init()
    gtk.main()
else:
    print >> sys.stderr, 'Can\'t find glade file - exit'

