~ralsina/ubuntuone-windows-installer/order-mattes

« back to all changes in this revision

Viewing changes to ubuntuone_installer/gui/qt/tos.py

Modified setup account page to reduce the height size.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
# Authors: Roberto Alsina <roberto.alsina@canonical.com>
4
 
#
5
 
# Copyright 2011 Canonical Ltd.
6
 
#
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.
10
 
#
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.
15
 
#
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/>.
18
 
 
19
 
"""Widget to view the Terms Of Service."""
20
 
 
21
 
import gettext
22
 
 
23
 
from PyQt4 import QtGui
24
 
 
25
 
import ubuntu_sso.qt.gui as sso_gui
26
 
 
27
 
_ = gettext.gettext
28
 
 
29
 
 
30
 
class TosPage(sso_gui.TosPage):
31
 
 
32
 
    """Page to display the Terms of Service."""
33
 
 
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"))
43
 
 
44
 
        # This is just to catch an exception thrown when nothing
45
 
        # is connected to the signal. It's not an exceptional
46
 
        # condition at all.
47
 
        try:
48
 
            self.wizard().customButtonClicked.disconnect()
49
 
        except TypeError:
50
 
            pass
51
 
 
52
 
        self.wizard().customButtonClicked.connect(self.print_document)
53
 
 
54
 
        self.wizard().setButtonLayout([
55
 
            QtGui.QWizard.CustomButton1,
56
 
            QtGui.QWizard.BackButton,
57
 
            QtGui.QWizard.Stretch])
58
 
 
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_)
64
 
            previewer.exec_()