########################################################################
#
#  Copyright (C) 2009, CZ.NIC, z.s.p.o.
# 
#  This file is part of dnstester.
#
#  dnstester 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.
#
#  dnstester 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 pygtk
pygtk.require("2.0")
import gtk, gobject
import images

import lang, messages, labeltext, clickable, config
from page import Page

class PageSummary(Page):

    type = gtk.ASSISTANT_PAGE_SUMMARY
    title = 'summary_title'
    number = 8
    focus_label = 'gtk-close'
    
    def __init__(self, parent):
        Page.__init__(self, parent)
        self.widget = self.create_vbox()

    def create_vbox(self):
        vbox = gtk.VBox()
        vbox.set_border_width(20)

        self.label = labeltext.LabelText(padding=0)
        vbox.pack_start(self.label, False, False)

        link = clickable.Clickable('@@' + config.summary_link, config.summary_link)
        vbox.pack_start(link, False, False)

        newline = gtk.Label('\n')
        vbox.pack_start(newline, False, False)

        logo = gtk.Image()
        filename = 'logo_' + lang.language
        logo.set_from_file(images.fullname(filename + '.png'))
        logo.show()
        vbox.pack_start(logo, True, True)

        vbox.show_all()
        return vbox


    def on_before_show(self):
        Page.on_before_show(self)
        if self.parent.get_upload_result():
            tag = 'summary_goodbye'
        else:
            tag = 'summary_failed'

        self.label.set_text_tag(tag)

