Merge lp:~ralsina/ubuntuone-windows-installer/ui_files_2 into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 23
Merged at revision: 3
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/ui_files_2
Merge into: lp:ubuntuone-windows-installer
Diff against target: 176 lines (+84/-44)
4 files modified
data/qt/license.ui (+6/-41)
ubuntuone_installer/gui/qt/__init__.py (+0/-2)
ubuntuone_installer/gui/qt/gui.py (+59/-1)
ubuntuone_installer/gui/qt/ui/__init__.py (+19/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/ui_files_2
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
dobey (community) Approve
Review via email: mp+65388@code.launchpad.net

Commit message

Implements the first page of the wizard (license information), including a "print" button.

Description of the change

Implements the first page of the wizard (license information), including a "print" button.

To test:

On linux, run

PYTHONPATH=. python bin/ubuntuone-installer-qt

Clicking print should give you a standard printing dialog, which you should be able to use to print to a PDF file (or to a real printer)

If you "finish" or "cancel" the wizard, the app is stuck (that's a bug for another branch)

To post a comment you must log in.
23. By Roberto Alsina

Open links on external browser

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Alejandro J. Cura (alecu) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/qt/license.ui'
--- data/qt/license.ui 2011-06-21 16:06:01 +0000
+++ data/qt/license.ui 2011-06-21 18:47:23 +0000
@@ -29,49 +29,14 @@
29<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"></p>29<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"></p>
30&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;As free software, this programme is distributed without warranty. See the GNU General Public License for more details at &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>30&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;As free software, this programme is distributed without warranty. See the GNU General Public License for more details at &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
31 </property>31 </property>
32 <property name="openExternalLinks">
33 <bool>true</bool>
34 </property>
35 <property name="openLinks">
36 <bool>true</bool>
37 </property>
32 </widget>38 </widget>
33 </item>39 </item>
34 <item>
35 <layout class="QHBoxLayout" name="horizontalLayout">
36 <item>
37 <widget class="QPushButton" name="agree">
38 <property name="text">
39 <string>Disagree &amp;&amp; Cancel</string>
40 </property>
41 </widget>
42 </item>
43 <item>
44 <widget class="QPushButton" name="printButton">
45 <property name="text">
46 <string>Print</string>
47 </property>
48 </widget>
49 </item>
50 <item>
51 <spacer name="horizontalSpacer">
52 <property name="orientation">
53 <enum>Qt::Horizontal</enum>
54 </property>
55 <property name="sizeHint" stdset="0">
56 <size>
57 <width>40</width>
58 <height>20</height>
59 </size>
60 </property>
61 </spacer>
62 </item>
63 <item>
64 <widget class="QPushButton" name="disagree">
65 <property name="text">
66 <string>Agree &amp;&amp; Install</string>
67 </property>
68 <property name="default">
69 <bool>true</bool>
70 </property>
71 </widget>
72 </item>
73 </layout>
74 </item>
75 </layout>40 </layout>
76 </widget>41 </widget>
77 <resources/>42 <resources/>
7843
=== modified file 'ubuntuone_installer/gui/qt/__init__.py'
--- ubuntuone_installer/gui/qt/__init__.py 2011-06-21 16:36:01 +0000
+++ ubuntuone_installer/gui/qt/__init__.py 2011-06-21 18:47:23 +0000
@@ -18,5 +18,3 @@
1818
19"""The Qt graphical interface for the Ubuntu One Installer."""19"""The Qt graphical interface for the Ubuntu One Installer."""
2020
21from PyQt4 import QtGui, QtCore
22
2321
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-06-21 16:36:01 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-06-21 18:47:23 +0000
@@ -23,11 +23,59 @@
23from PyQt4 import QtGui23from PyQt4 import QtGui
2424
25from ubuntuone_installer.logger import setup_logging25from ubuntuone_installer.logger import setup_logging
2626from ubuntuone_installer.gui.qt.ui import license_ui
27
28import gettext
29
30_ = gettext.gettext
2731
28logger = setup_logging('qt.gui')32logger = setup_logging('qt.gui')
2933
3034
35class LicensePage(QtGui.QWizardPage):
36 """Wizard Page that displays the license info and links to the GPL"""
37
38 # Invalid constant names and Qt-inherited methods
39 # pylint: disable=C0103
40
41 LICENSE_PAGE = 0
42
43 def __init__(self, parent=None):
44 QtGui.QWizardPage.__init__(self, parent)
45 self.ui = license_ui.Ui_Form()
46 self.ui.setupUi(self)
47
48 def initializePage(self):
49 """Setup UI details"""
50
51 # We need custom buttons
52 self.wizard().setButtonText(QtGui.QWizard.CustomButton1, _("&Print"))
53 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, True)
54
55 # Set the right texts and connections for buttons
56 self.setButtonText(QtGui.QWizard.NextButton, _("Agree && Install"))
57 self.setButtonText(QtGui.QWizard.CancelButton,
58 _("Disagree && Cancel"))
59 self.setButtonText(QtGui.QWizard.CustomButton1, _("&Print"))
60 self.wizard().customButtonClicked.connect(self.printDocument)
61
62 def printDocument(self, button_id):
63 """Print the document displayed in textBrowser"""
64
65 if button_id == QtGui.QWizard.CustomButton1:
66 document = self.ui.textBrowser.document()
67 printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
68
69 dialog = QtGui.QPrintDialog(printer, self)
70
71 dialog.setWindowTitle(_("Send to printer"))
72 if dialog.exec_() != QtGui.QDialog.Accepted:
73 return
74 printer.setFullPage(True)
75 printer.setPageSize(QtGui.QPrinter.A4)
76 document.print_(printer)
77
78
31class MainWindow(QtGui.QWizard):79class MainWindow(QtGui.QWizard):
32 """The Main Window of the Installer wizard."""80 """The Main Window of the Installer wizard."""
3381
@@ -36,6 +84,16 @@
36 QtGui.QWizard.__init__(self)84 QtGui.QWizard.__init__(self)
37 self.close_callback = close_callback85 self.close_callback = close_callback
3886
87 self.setOption(self.NoBackButtonOnStartPage, True)
88
89 # PyQt doesn't support the (int, page) version of addPage
90 # Add the pages in the right order
91
92 # pylint: disable=C0103
93 self.LICENSE_PAGE = self.addPage(LicensePage())
94 # Dummy page to have a "Next"
95 self.addPage(QtGui.QWizardPage())
96
39 # Invalid name "closeEvent"97 # Invalid name "closeEvent"
40 # pylint: disable=C010398 # pylint: disable=C0103
4199
42100
=== added directory 'ubuntuone_installer/gui/qt/ui'
=== added file 'ubuntuone_installer/gui/qt/ui/__init__.py'
--- ubuntuone_installer/gui/qt/ui/__init__.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/ui/__init__.py 2011-06-21 18:47:23 +0000
@@ -0,0 +1,19 @@
1# -*- coding: utf-8 -*-
2
3# Authors: Alejandro J. Cura <alecu@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"""The Qt graphical interface for the Ubuntu One Installer."""

Subscribers

People subscribed via source and target branches