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
=== modified file 'data/qt/congratulations.ui'
--- data/qt/congratulations.ui 2011-06-21 20:46:27 +0000
+++ data/qt/congratulations.ui 2011-06-29 11:45:57 +0000
@@ -46,42 +46,50 @@
46 </widget>46 </widget>
47 </item>47 </item>
48 <item>48 <item>
49 <layout class="QHBoxLayout" name="horizontalLayout">49 <widget class="QWidget" name="progressContainer" native="true">
50 <item>50 <layout class="QHBoxLayout" name="horizontalLayout">
51 <widget class="QLabel" name="label_4">51 <property name="spacing">
52 <property name="text">52 <number>0</number>
53 <string>IMAGE GOES HERE?</string>53 </property>
54 </property>54 <property name="margin">
55 </widget>55 <number>0</number>
56 </item>56 </property>
57 <item>57 <item>
58 <layout class="QVBoxLayout" name="verticalLayout">58 <widget class="QLabel" name="label_4">
59 <item>59 <property name="text">
60 <widget class="QLabel" name="label_5">60 <string>IMAGE GOES HERE?</string>
61 <property name="font">61 </property>
62 <font>62 </widget>
63 <weight>75</weight>63 </item>
64 <bold>true</bold>64 <item>
65 </font>65 <layout class="QVBoxLayout" name="verticalLayout">
66 </property>66 <item>
67 <property name="text">67 <widget class="QLabel" name="label_5">
68 <string>Sync in progress...</string>68 <property name="font">
69 </property>69 <font>
70 </widget>70 <weight>75</weight>
71 </item>71 <bold>true</bold>
72 <item>72 </font>
73 <widget class="QLabel" name="label_6">73 </property>
74 <property name="text">74 <property name="text">
75 <string>Your folders have started to sync in the background, launch the dahboard to get more information about the sync in progress</string>75 <string>Sync in progress...</string>
76 </property>76 </property>
77 <property name="wordWrap">77 </widget>
78 <bool>true</bool>78 </item>
79 </property>79 <item>
80 </widget>80 <widget class="QLabel" name="label_6">
81 </item>81 <property name="text">
82 </layout>82 <string>Your folders have started to sync in the background, launch the dahboard to get more information about the sync in progress</string>
83 </item>83 </property>
84 </layout>84 <property name="wordWrap">
85 <bool>true</bool>
86 </property>
87 </widget>
88 </item>
89 </layout>
90 </item>
91 </layout>
92 </widget>
85 </item>93 </item>
86 <item>94 <item>
87 <spacer name="verticalSpacer">95 <spacer name="verticalSpacer">
8896
=== added file 'data/qt/sync_now_or_later.ui'
--- data/qt/sync_now_or_later.ui 1970-01-01 00:00:00 +0000
+++ data/qt/sync_now_or_later.ui 2011-06-29 11:45:57 +0000
@@ -0,0 +1,86 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>Form</class>
4 <widget class="QWidget" name="Form">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>426</width>
10 <height>387</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="spacing">
18 <number>24</number>
19 </property>
20 <item>
21 <widget class="QLabel" name="label">
22 <property name="font">
23 <font>
24 <pointsize>14</pointsize>
25 <weight>75</weight>
26 <bold>true</bold>
27 </font>
28 </property>
29 <property name="text">
30 <string>Syncing your computer with the cloud</string>
31 </property>
32 </widget>
33 </item>
34 <item>
35 <widget class="QLabel" name="label_9">
36 <property name="text">
37 <string>It seems that you have already some folders in the cloud.
38Do you want to sync everything with this computer now?</string>
39 </property>
40 <property name="wordWrap">
41 <bool>true</bool>
42 </property>
43 </widget>
44 </item>
45 <item>
46 <widget class="QRadioButton" name="sync_now">
47 <property name="text">
48 <string>Yes, sync all now</string>
49 </property>
50 <property name="checked">
51 <bool>true</bool>
52 </property>
53 </widget>
54 </item>
55 <item>
56 <widget class="QRadioButton" name="sync_later">
57 <property name="text">
58 <string>No, I'll do it later</string>
59 </property>
60 </widget>
61 </item>
62 <item>
63 <widget class="QRadioButton" name="sync_custom">
64 <property name="text">
65 <string>Yes, but I want to choose what to sync</string>
66 </property>
67 </widget>
68 </item>
69 <item>
70 <spacer name="verticalSpacer">
71 <property name="orientation">
72 <enum>Qt::Vertical</enum>
73 </property>
74 <property name="sizeHint" stdset="0">
75 <size>
76 <width>20</width>
77 <height>54</height>
78 </size>
79 </property>
80 </spacer>
81 </item>
82 </layout>
83 </widget>
84 <resources/>
85 <connections/>
86</ui>
087
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-06-27 09:42:04 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-06-29 11:45:57 +0000
@@ -72,6 +72,7 @@
72 license_ui,72 license_ui,
73 congratulations_ui,73 congratulations_ui,
74)74)
75from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
7576
76_ = gettext.gettext77_ = gettext.gettext
77SIGN_IN = _("Sign In")78SIGN_IN = _("Sign In")
@@ -243,6 +244,11 @@
243 QtGui.QWizard.Stretch,244 QtGui.QWizard.Stretch,
244 QtGui.QWizard.FinishButton,245 QtGui.QWizard.FinishButton,
245 ])246 ])
247 if self.field("sync_now").toBool() \
248 or self.field("sync_custom").toBool():
249 self.ui.progressContainer.setVisible(True)
250 else:
251 self.ui.progressContainer.setVisible(False)
246252
247253
248class MainWindow(QtGui.QWizard):254class MainWindow(QtGui.QWizard):
@@ -253,7 +259,8 @@
253259
254 LICENSE_PAGE = 0260 LICENSE_PAGE = 0
255 SIGNIN_PAGE = 1261 SIGNIN_PAGE = 1
256 CONGRATULATIONS_PAGE = 2262 SYNC_NOW_OR_LATER_PAGE = 2
263 CONGRATULATIONS_PAGE = 3
257264
258 # definition of the signals raised by the widget (for SSO)265 # definition of the signals raised by the widget (for SSO)
259 recoverableError = QtCore.pyqtSignal('QString', 'QString')266 recoverableError = QtCore.pyqtSignal('QString', 'QString')
@@ -339,6 +346,7 @@
339346
340 # End of SSO pages347 # End of SSO pages
341348
349 self.SYNC_NOW_OR_LATER_PAGE = self.addPage(SyncNowOrLaterPage())
342 self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage())350 self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage())
343351
344 # Invalid name "closeEvent"352 # Invalid name "closeEvent"
@@ -355,13 +363,13 @@
355 """Called on successful login."""363 """Called on successful login."""
356 self._next_id = self.SUCCESS_PAGE364 self._next_id = self.SUCCESS_PAGE
357 self.next()365 self.next()
358 self._next_id = self.CONGRATULATIONS_PAGE366 self._next_id = self.SYNC_NOW_OR_LATER_PAGE
359367
360 def registration_success_slot(self):368 def registration_success_slot(self):
361 """Called on successful registration."""369 """Called on successful registration."""
362 self._next_id = self.SUCCESS_PAGE370 self._next_id = self.SUCCESS_PAGE
363 self.next()371 self.next()
364 self._next_id = self.CONGRATULATIONS_PAGE372 self._next_id = self.SYNC_NOW_OR_LATER_PAGE
365373
366 def done(self, result):374 def done(self, result):
367 """The main window is being closed, call any custom callback."""375 """The main window is being closed, call any custom callback."""
368376
=== added file 'ubuntuone_installer/gui/qt/sync_now_or_later.py'
--- ubuntuone_installer/gui/qt/sync_now_or_later.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-06-29 11:45:57 +0000
@@ -0,0 +1,44 @@
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"""The user interface for the Ubuntu One Installer."""
20
21from PyQt4 import QtGui
22
23from ubuntuone_installer.gui.qt.ui import sync_now_or_later_ui
24
25
26class SyncNowOrLaterPage(QtGui.QWizardPage):
27 """User can choose whether to sync now, later, or selectively"""
28
29 def __init__(self, parent=None):
30 QtGui.QWizardPage.__init__(self, parent)
31 self.ui = sync_now_or_later_ui.Ui_Form()
32 self.ui.setupUi(self)
33 self.registerField("sync_now", self.ui.sync_now)
34 self.registerField("sync_later", self.ui.sync_later)
35 self.registerField("sync_custom", self.ui.sync_custom)
36
37 # Invalid names of Qt-inherited methods
38 # pylint: disable=C0103
39
40 def initializePage(self):
41 """Setup UI details"""
42 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)
43 self.wizard().setOption(QtGui.QWizard.NoCancelButton, True)
44 self.wizard()._next_id = None
045
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-06-27 09:59:34 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-06-29 11:45:57 +0000
@@ -109,6 +109,39 @@
109 self.ui.done(result=0)109 self.ui.done(result=0)
110 self.assertEqual(self._called, False)110 self.assertEqual(self._called, False)
111111
112 def test_sync_now_shows_message(self):
113 """If the user selects 'Sync Now' the congrats page shows a message"""
114 congrats_page = self.ui.page(self.ui.CONGRATULATIONS_PAGE)
115 congrats_page.setField("sync_now", True)
116
117 # Show the congrats page
118 self.ui.setStartId(self.ui.CONGRATULATIONS_PAGE)
119 self.ui.restart()
120 self.ui.show()
121
122 # Check the properties have the right values
123 self.assertEqual(congrats_page.field("sync_later").toBool(),
124 False)
125 self.assertEqual(
126 congrats_page.ui.progressContainer.isVisible(), True)
127
128 def test_sync_later_hides_message(self):
129 """If the user selects 'Sync Later' the congrats page
130 hides a message"""
131 congrats_page = self.ui.page(self.ui.CONGRATULATIONS_PAGE)
132 congrats_page.setField("sync_later", True)
133
134 # Show the congrats page
135 self.ui.setStartId(self.ui.CONGRATULATIONS_PAGE)
136 self.ui.restart()
137 self.ui.show()
138
139 # Check the properties have the right values
140 self.assertEqual(congrats_page.field("sync_now").toBool(),
141 False)
142 self.assertEqual(
143 congrats_page.ui.progressContainer.isVisible(), False)
144
112 def test_credential_parameters(self):145 def test_credential_parameters(self):
113 """Test if the credentials are created the same way146 """Test if the credentials are created the same way
114 as in control panel."""147 as in control panel."""

Subscribers

People subscribed via source and target branches