1
# -*- coding: utf-8 -*-
3
# Authors: Roberto Alsina <roberto.alsina@canonical.com>
5
# Copyright 2011 Canonical Ltd.
7
# This program is free software: you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 3, as published
9
# by the Free Software Foundation.
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranties of
13
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14
# PURPOSE. See the GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License along
17
# with this program. If not, see <http://www.gnu.org/licenses/>.
19
"""Widget to view the Terms Of Service."""
23
from PyQt4 import QtGui
25
import ubuntu_sso.qt.gui as sso_gui
30
class TosPage(sso_gui.TosPage):
32
"""Page to display the Terms of Service."""
34
# initializePage is inherited
35
# pylint: disable=C0103
36
def initializePage(self):
37
"""Setup UI details."""
38
# Set the right texts and connections for buttons
39
self.setButtonText(QtGui.QWizard.NextButton, _("Agree && Install"))
40
self.setButtonText(QtGui.QWizard.CancelButton,
41
_("Disagree && Cancel"))
42
self.setButtonText(QtGui.QWizard.CustomButton1, _("&Print"))
44
# This is just to catch an exception thrown when nothing
45
# is connected to the signal. It's not an exceptional
48
self.wizard().customButtonClicked.disconnect()
52
self.wizard().customButtonClicked.connect(self.print_document)
54
self.wizard().setButtonLayout([
55
QtGui.QWizard.CustomButton1,
56
QtGui.QWizard.BackButton,
57
QtGui.QWizard.Stretch])
59
def print_document(self, button_id):
60
"""Print the document displayed in textBrowser."""
61
if button_id == QtGui.QWizard.CustomButton1:
62
previewer = QtGui.QPrintPreviewDialog(
63
paintRequested=self.ui.terms_webkit.print_)