# Copyright (c) 2000-2001 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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.

"""About window"""

__revision__ = "$Id: AboutWindow.py,v 1.14 2001/09/20 07:53:15 guil Exp $"

from DialogWindow import DialogWindow, unicode_to_gtk
from gtk import *
from os.path import normpath,normcase,join
from narval.lib import *

class AboutWindow(DialogWindow) :
    """About window using singleton pattern"""

    def __init__(self) :        
        DialogWindow.__init__(self,unicode_to_gtk(_("About... ")))
        self.connect("delete-event",self._exit)
        text = """
Copyright (c) 2000-2001 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr/ -- mailto:contact@logilab.fr

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. http://www.fsf.org
"""
        import xml, sys
        version = unicode_to_gtk(_("Versions used are :"))+"\n"+\
                  unicode_to_gtk(_("XML version : "))+xml.__version__+"\n"+\
                  unicode_to_gtk(_("Python version : "))+sys.version

        # build widget
        widget = GtkVBox()
        img = GtkPixmap(self,normpath(join(config.get_home(),'graphics/splash.xpm')))
        widget.pack_start(img)
        widget.pack_start(GtkLabel("\nhttp://www.logilab.org"))
        widget.pack_start(GtkLabel(unicode_to_gtk(_("\nmailto : contact@logilab.fr\n\nCopyright (c) 2001 LOGILAB S.A. (Paris, FRANCE)."))))
        widget.show_all()
        
        notebook = GtkNotebook()
        notebook.append_page(widget,GtkLabel(unicode_to_gtk(_("About LOGILAB"))))
        notebook.append_page(GtkLabel(text),GtkLabel(unicode_to_gtk(_("License"))))
        notebook.append_page(GtkLabel(version),GtkLabel(unicode_to_gtk(_("Versions"))))
        notebook.show_all()
        
        self.append_dialog(notebook)
        self.ok_button.show()
        self.ok_button.set_flags(CAN_DEFAULT|HAS_DEFAULT)
        self.ok_button.connect_object('clicked',lambda w:w.destroy(),self)
            
    def _exit(self,*args):
        self.destroy()
