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

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 34
Merged at revision: 9
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/fix_800381
Merge into: lp:ubuntuone-windows-installer
Prerequisite: lp:~ralsina/ubuntuone-windows-installer/fix_800383
Diff against target: 332 lines (+218/-39)
5 files modified
data/qt/congratulations.ui (+44/-36)
data/qt/sync_now_or_later.ui (+86/-0)
ubuntuone_installer/gui/qt/gui.py (+11/-3)
ubuntuone_installer/gui/qt/sync_now_or_later.py (+44/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+33/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/fix_800381
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+65502@code.launchpad.net

Commit message

Implement the page that lets the user choose between "sync now" / "sync later" / "sync selectively"

Description of the change

Implement the page that lets the user choose between "sync now" / "sync later" / "sync selectively"

This page contains three radio buttons, and the standard back / next buttons.

It should start the sync process (or not) according to user choice, and enable/disable the "sync in progress" indicator in the congratulations page in the same way.

Missing after this branch lands: actually starting or not the sync.

To test IRL (on Linux):

PYTHONPATH=. python bin/ubuntuone-installer-qt

click next, you get a screen with three options. If you choose the 1st or 3rd options and click next, you get a message about how it's syncing now.
If you choose "Sync Later" you don't get that message.

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

test fixes, use .ui instead of .page_ui

26. By Roberto Alsina

Style fixes

27. By Roberto Alsina

Use snake_case

Revision history for this message
Natalia Bidart (nataliabidart) :
review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Nice branch! A couple of comments:

If I click on "Agree & Install", then on "Back", two buttons are gone from the dialog and only one remains.

Typo: "I want to choose want to sync"
                         ^
                       "what"

review: Needs Fixing
28. By Roberto Alsina

Merged current trunk so it's easier to merge back when it's ready

29. By Roberto Alsina

pep8 fix

30. By Roberto Alsina

Moved the SyncNowOrLaterPage to its own file

31. By Roberto Alsina

Fix a test broken by code I lost while merging

32. By Roberto Alsina

style fixes

Revision history for this message
Alejandro J. Cura (alecu) wrote :

This import is broken:
from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage

it seems it should be:
from ubuntuone_installer.gui.qt.ui.sync_now_or_later import SyncNowOrLaterPage

review: Needs Fixing
33. By Roberto Alsina

add file I forgot to add before

Revision history for this message
Roberto Alsina (ralsina) wrote :

> This import is broken:
> from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
>
> it seems it should be:
> from ubuntuone_installer.gui.qt.ui.sync_now_or_later import SyncNowOrLaterPage

Argh, forgot to bzr add a file!

Fixed now.

34. By Roberto Alsina

style fixes

Revision history for this message
Alejandro J. Cura (alecu) wrote :

The code in the branch looks good, and run-tests.bat runs sucessfully.
My dev env is borked, so I'm not able to IRL test.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/qt/congratulations.ui'
2--- data/qt/congratulations.ui 2011-06-21 20:46:27 +0000
3+++ data/qt/congratulations.ui 2011-06-29 11:45:57 +0000
4@@ -46,42 +46,50 @@
5 </widget>
6 </item>
7 <item>
8- <layout class="QHBoxLayout" name="horizontalLayout">
9- <item>
10- <widget class="QLabel" name="label_4">
11- <property name="text">
12- <string>IMAGE GOES HERE?</string>
13- </property>
14- </widget>
15- </item>
16- <item>
17- <layout class="QVBoxLayout" name="verticalLayout">
18- <item>
19- <widget class="QLabel" name="label_5">
20- <property name="font">
21- <font>
22- <weight>75</weight>
23- <bold>true</bold>
24- </font>
25- </property>
26- <property name="text">
27- <string>Sync in progress...</string>
28- </property>
29- </widget>
30- </item>
31- <item>
32- <widget class="QLabel" name="label_6">
33- <property name="text">
34- <string>Your folders have started to sync in the background, launch the dahboard to get more information about the sync in progress</string>
35- </property>
36- <property name="wordWrap">
37- <bool>true</bool>
38- </property>
39- </widget>
40- </item>
41- </layout>
42- </item>
43- </layout>
44+ <widget class="QWidget" name="progressContainer" native="true">
45+ <layout class="QHBoxLayout" name="horizontalLayout">
46+ <property name="spacing">
47+ <number>0</number>
48+ </property>
49+ <property name="margin">
50+ <number>0</number>
51+ </property>
52+ <item>
53+ <widget class="QLabel" name="label_4">
54+ <property name="text">
55+ <string>IMAGE GOES HERE?</string>
56+ </property>
57+ </widget>
58+ </item>
59+ <item>
60+ <layout class="QVBoxLayout" name="verticalLayout">
61+ <item>
62+ <widget class="QLabel" name="label_5">
63+ <property name="font">
64+ <font>
65+ <weight>75</weight>
66+ <bold>true</bold>
67+ </font>
68+ </property>
69+ <property name="text">
70+ <string>Sync in progress...</string>
71+ </property>
72+ </widget>
73+ </item>
74+ <item>
75+ <widget class="QLabel" name="label_6">
76+ <property name="text">
77+ <string>Your folders have started to sync in the background, launch the dahboard to get more information about the sync in progress</string>
78+ </property>
79+ <property name="wordWrap">
80+ <bool>true</bool>
81+ </property>
82+ </widget>
83+ </item>
84+ </layout>
85+ </item>
86+ </layout>
87+ </widget>
88 </item>
89 <item>
90 <spacer name="verticalSpacer">
91
92=== added file 'data/qt/sync_now_or_later.ui'
93--- data/qt/sync_now_or_later.ui 1970-01-01 00:00:00 +0000
94+++ data/qt/sync_now_or_later.ui 2011-06-29 11:45:57 +0000
95@@ -0,0 +1,86 @@
96+<?xml version="1.0" encoding="UTF-8"?>
97+<ui version="4.0">
98+ <class>Form</class>
99+ <widget class="QWidget" name="Form">
100+ <property name="geometry">
101+ <rect>
102+ <x>0</x>
103+ <y>0</y>
104+ <width>426</width>
105+ <height>387</height>
106+ </rect>
107+ </property>
108+ <property name="windowTitle">
109+ <string>Form</string>
110+ </property>
111+ <layout class="QVBoxLayout" name="verticalLayout">
112+ <property name="spacing">
113+ <number>24</number>
114+ </property>
115+ <item>
116+ <widget class="QLabel" name="label">
117+ <property name="font">
118+ <font>
119+ <pointsize>14</pointsize>
120+ <weight>75</weight>
121+ <bold>true</bold>
122+ </font>
123+ </property>
124+ <property name="text">
125+ <string>Syncing your computer with the cloud</string>
126+ </property>
127+ </widget>
128+ </item>
129+ <item>
130+ <widget class="QLabel" name="label_9">
131+ <property name="text">
132+ <string>It seems that you have already some folders in the cloud.
133+Do you want to sync everything with this computer now?</string>
134+ </property>
135+ <property name="wordWrap">
136+ <bool>true</bool>
137+ </property>
138+ </widget>
139+ </item>
140+ <item>
141+ <widget class="QRadioButton" name="sync_now">
142+ <property name="text">
143+ <string>Yes, sync all now</string>
144+ </property>
145+ <property name="checked">
146+ <bool>true</bool>
147+ </property>
148+ </widget>
149+ </item>
150+ <item>
151+ <widget class="QRadioButton" name="sync_later">
152+ <property name="text">
153+ <string>No, I'll do it later</string>
154+ </property>
155+ </widget>
156+ </item>
157+ <item>
158+ <widget class="QRadioButton" name="sync_custom">
159+ <property name="text">
160+ <string>Yes, but I want to choose what to sync</string>
161+ </property>
162+ </widget>
163+ </item>
164+ <item>
165+ <spacer name="verticalSpacer">
166+ <property name="orientation">
167+ <enum>Qt::Vertical</enum>
168+ </property>
169+ <property name="sizeHint" stdset="0">
170+ <size>
171+ <width>20</width>
172+ <height>54</height>
173+ </size>
174+ </property>
175+ </spacer>
176+ </item>
177+ </layout>
178+ </widget>
179+ <resources/>
180+ <connections/>
181+</ui>
182
183=== modified file 'ubuntuone_installer/gui/qt/gui.py'
184--- ubuntuone_installer/gui/qt/gui.py 2011-06-27 09:42:04 +0000
185+++ ubuntuone_installer/gui/qt/gui.py 2011-06-29 11:45:57 +0000
186@@ -72,6 +72,7 @@
187 license_ui,
188 congratulations_ui,
189 )
190+from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
191
192 _ = gettext.gettext
193 SIGN_IN = _("Sign In")
194@@ -243,6 +244,11 @@
195 QtGui.QWizard.Stretch,
196 QtGui.QWizard.FinishButton,
197 ])
198+ if self.field("sync_now").toBool() \
199+ or self.field("sync_custom").toBool():
200+ self.ui.progressContainer.setVisible(True)
201+ else:
202+ self.ui.progressContainer.setVisible(False)
203
204
205 class MainWindow(QtGui.QWizard):
206@@ -253,7 +259,8 @@
207
208 LICENSE_PAGE = 0
209 SIGNIN_PAGE = 1
210- CONGRATULATIONS_PAGE = 2
211+ SYNC_NOW_OR_LATER_PAGE = 2
212+ CONGRATULATIONS_PAGE = 3
213
214 # definition of the signals raised by the widget (for SSO)
215 recoverableError = QtCore.pyqtSignal('QString', 'QString')
216@@ -339,6 +346,7 @@
217
218 # End of SSO pages
219
220+ self.SYNC_NOW_OR_LATER_PAGE = self.addPage(SyncNowOrLaterPage())
221 self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage())
222
223 # Invalid name "closeEvent"
224@@ -355,13 +363,13 @@
225 """Called on successful login."""
226 self._next_id = self.SUCCESS_PAGE
227 self.next()
228- self._next_id = self.CONGRATULATIONS_PAGE
229+ self._next_id = self.SYNC_NOW_OR_LATER_PAGE
230
231 def registration_success_slot(self):
232 """Called on successful registration."""
233 self._next_id = self.SUCCESS_PAGE
234 self.next()
235- self._next_id = self.CONGRATULATIONS_PAGE
236+ self._next_id = self.SYNC_NOW_OR_LATER_PAGE
237
238 def done(self, result):
239 """The main window is being closed, call any custom callback."""
240
241=== added file 'ubuntuone_installer/gui/qt/sync_now_or_later.py'
242--- ubuntuone_installer/gui/qt/sync_now_or_later.py 1970-01-01 00:00:00 +0000
243+++ ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-06-29 11:45:57 +0000
244@@ -0,0 +1,44 @@
245+# -*- coding: utf-8 -*-
246+
247+# Authors: Roberto Alsina <roberto.alsina@canonical.com>
248+#
249+# Copyright 2011 Canonical Ltd.
250+#
251+# This program is free software: you can redistribute it and/or modify it
252+# under the terms of the GNU General Public License version 3, as published
253+# by the Free Software Foundation.
254+#
255+# This program is distributed in the hope that it will be useful, but
256+# WITHOUT ANY WARRANTY; without even the implied warranties of
257+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
258+# PURPOSE. See the GNU General Public License for more details.
259+#
260+# You should have received a copy of the GNU General Public License along
261+# with this program. If not, see <http://www.gnu.org/licenses/>.
262+
263+"""The user interface for the Ubuntu One Installer."""
264+
265+from PyQt4 import QtGui
266+
267+from ubuntuone_installer.gui.qt.ui import sync_now_or_later_ui
268+
269+
270+class SyncNowOrLaterPage(QtGui.QWizardPage):
271+ """User can choose whether to sync now, later, or selectively"""
272+
273+ def __init__(self, parent=None):
274+ QtGui.QWizardPage.__init__(self, parent)
275+ self.ui = sync_now_or_later_ui.Ui_Form()
276+ self.ui.setupUi(self)
277+ self.registerField("sync_now", self.ui.sync_now)
278+ self.registerField("sync_later", self.ui.sync_later)
279+ self.registerField("sync_custom", self.ui.sync_custom)
280+
281+ # Invalid names of Qt-inherited methods
282+ # pylint: disable=C0103
283+
284+ def initializePage(self):
285+ """Setup UI details"""
286+ self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)
287+ self.wizard().setOption(QtGui.QWizard.NoCancelButton, True)
288+ self.wizard()._next_id = None
289
290=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
291--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-06-27 09:59:34 +0000
292+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-06-29 11:45:57 +0000
293@@ -109,6 +109,39 @@
294 self.ui.done(result=0)
295 self.assertEqual(self._called, False)
296
297+ def test_sync_now_shows_message(self):
298+ """If the user selects 'Sync Now' the congrats page shows a message"""
299+ congrats_page = self.ui.page(self.ui.CONGRATULATIONS_PAGE)
300+ congrats_page.setField("sync_now", True)
301+
302+ # Show the congrats page
303+ self.ui.setStartId(self.ui.CONGRATULATIONS_PAGE)
304+ self.ui.restart()
305+ self.ui.show()
306+
307+ # Check the properties have the right values
308+ self.assertEqual(congrats_page.field("sync_later").toBool(),
309+ False)
310+ self.assertEqual(
311+ congrats_page.ui.progressContainer.isVisible(), True)
312+
313+ def test_sync_later_hides_message(self):
314+ """If the user selects 'Sync Later' the congrats page
315+ hides a message"""
316+ congrats_page = self.ui.page(self.ui.CONGRATULATIONS_PAGE)
317+ congrats_page.setField("sync_later", True)
318+
319+ # Show the congrats page
320+ self.ui.setStartId(self.ui.CONGRATULATIONS_PAGE)
321+ self.ui.restart()
322+ self.ui.show()
323+
324+ # Check the properties have the right values
325+ self.assertEqual(congrats_page.field("sync_now").toBool(),
326+ False)
327+ self.assertEqual(
328+ congrats_page.ui.progressContainer.isVisible(), False)
329+
330 def test_credential_parameters(self):
331 """Test if the credentials are created the same way
332 as in control panel."""

Subscribers

People subscribed via source and target branches