Merge lp:~nataliabidart/ubuntuone-control-panel/unify-account-and-service into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 191
Merged at revision: 190
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/unify-account-and-service
Merge into: lp:ubuntuone-control-panel
Diff against target: 1045 lines (+211/-644)
11 files modified
data/qt/account.ui (+153/-0)
data/qt/controlpanel.ui (+10/-21)
data/qt/profile.ui (+0/-136)
data/qt/services.ui (+0/-209)
data/qt/ubuntuonebin.ui (+0/-48)
ubuntuone/controlpanel/gui/qt/account.py (+23/-24)
ubuntuone/controlpanel/gui/qt/services.py (+0/-66)
ubuntuone/controlpanel/gui/qt/tests/test_account.py (+22/-13)
ubuntuone/controlpanel/gui/qt/tests/test_services.py (+0/-84)
ubuntuone/controlpanel/gui/qt/tests/test_ubuntuonebin.py (+0/-27)
ubuntuone/controlpanel/gui/qt/ubuntuonebin.py (+3/-16)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/unify-account-and-service
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+68743@code.launchpad.net

Commit message

- Unified Services and Profile tab into an Account tab (LP: #813099).

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

Looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/qt/account.ui'
2--- data/qt/account.ui 1970-01-01 00:00:00 +0000
3+++ data/qt/account.ui 2011-07-21 20:09:30 +0000
4@@ -0,0 +1,153 @@
5+<?xml version="1.0" encoding="UTF-8"?>
6+<ui version="4.0">
7+ <class>Form</class>
8+ <widget class="QWidget" name="Form">
9+ <property name="geometry">
10+ <rect>
11+ <x>0</x>
12+ <y>0</y>
13+ <width>321</width>
14+ <height>205</height>
15+ </rect>
16+ </property>
17+ <property name="windowTitle">
18+ <string>Form</string>
19+ </property>
20+ <layout class="QVBoxLayout" name="verticalLayout">
21+ <property name="margin">
22+ <number>0</number>
23+ </property>
24+ <item>
25+ <widget class="QGroupBox" name="horizontalGroupBox">
26+ <property name="title">
27+ <string>Personal details</string>
28+ </property>
29+ <layout class="QHBoxLayout" name="horizontalLayout">
30+ <item>
31+ <layout class="QVBoxLayout" name="verticalLayout_2">
32+ <item>
33+ <widget class="QLabel" name="name_label">
34+ <property name="text">
35+ <string/>
36+ </property>
37+ </widget>
38+ </item>
39+ <item>
40+ <widget class="QLabel" name="email_label">
41+ <property name="text">
42+ <string/>
43+ </property>
44+ </widget>
45+ </item>
46+ </layout>
47+ </item>
48+ <item>
49+ <spacer name="horizontalSpacer_3">
50+ <property name="orientation">
51+ <enum>Qt::Horizontal</enum>
52+ </property>
53+ <property name="sizeHint" stdset="0">
54+ <size>
55+ <width>40</width>
56+ <height>20</height>
57+ </size>
58+ </property>
59+ </spacer>
60+ </item>
61+ <item>
62+ <widget class="GoToWebButton" name="edit_profile_button">
63+ <property name="text">
64+ <string>Edit personal details online</string>
65+ </property>
66+ </widget>
67+ </item>
68+ <item>
69+ <spacer name="horizontalSpacer_4">
70+ <property name="orientation">
71+ <enum>Qt::Horizontal</enum>
72+ </property>
73+ <property name="sizeHint" stdset="0">
74+ <size>
75+ <width>40</width>
76+ <height>20</height>
77+ </size>
78+ </property>
79+ </spacer>
80+ </item>
81+ </layout>
82+ </widget>
83+ </item>
84+ <item>
85+ <widget class="QGroupBox" name="horizontalGroupBox_2">
86+ <property name="title">
87+ <string>Your services</string>
88+ </property>
89+ <layout class="QHBoxLayout" name="horizontalLayout_2">
90+ <item>
91+ <widget class="QLabel" name="services_description_label">
92+ <property name="text">
93+ <string/>
94+ </property>
95+ </widget>
96+ </item>
97+ <item>
98+ <spacer name="horizontalSpacer">
99+ <property name="orientation">
100+ <enum>Qt::Horizontal</enum>
101+ </property>
102+ <property name="sizeHint" stdset="0">
103+ <size>
104+ <width>40</width>
105+ <height>20</height>
106+ </size>
107+ </property>
108+ </spacer>
109+ </item>
110+ <item>
111+ <widget class="GoToWebButton" name="edit_services_button">
112+ <property name="text">
113+ <string>Edit your services online</string>
114+ </property>
115+ </widget>
116+ </item>
117+ <item>
118+ <spacer name="horizontalSpacer_2">
119+ <property name="orientation">
120+ <enum>Qt::Horizontal</enum>
121+ </property>
122+ <property name="sizeHint" stdset="0">
123+ <size>
124+ <width>40</width>
125+ <height>20</height>
126+ </size>
127+ </property>
128+ </spacer>
129+ </item>
130+ </layout>
131+ </widget>
132+ </item>
133+ <item>
134+ <spacer name="verticalSpacer">
135+ <property name="orientation">
136+ <enum>Qt::Vertical</enum>
137+ </property>
138+ <property name="sizeHint" stdset="0">
139+ <size>
140+ <width>20</width>
141+ <height>40</height>
142+ </size>
143+ </property>
144+ </spacer>
145+ </item>
146+ </layout>
147+ </widget>
148+ <customwidgets>
149+ <customwidget>
150+ <class>GoToWebButton</class>
151+ <extends>QPushButton</extends>
152+ <header>ubuntuone.controlpanel.gui.qt.gotoweb</header>
153+ </customwidget>
154+ </customwidgets>
155+ <resources/>
156+ <connections/>
157+</ui>
158
159=== modified file 'data/qt/controlpanel.ui'
160--- data/qt/controlpanel.ui 2011-07-20 16:31:52 +0000
161+++ data/qt/controlpanel.ui 2011-07-21 20:09:30 +0000
162@@ -7,7 +7,7 @@
163 <x>0</x>
164 <y>0</y>
165 <width>536</width>
166- <height>284</height>
167+ <height>389</height>
168 </rect>
169 </property>
170 <property name="sizePolicy">
171@@ -279,11 +279,6 @@
172 <string>Folders</string>
173 </attribute>
174 </widget>
175- <widget class="ServicesPanel" name="services_tab">
176- <attribute name="title">
177- <string>Services</string>
178- </attribute>
179- </widget>
180 <widget class="DevicesPanel" name="devices_tab">
181 <attribute name="title">
182 <string>Devices</string>
183@@ -294,7 +289,7 @@
184 <string>Preferences</string>
185 </attribute>
186 </widget>
187- <widget class="ProfilePanel" name="profile_tab">
188+ <widget class="AccountPanel" name="account_tab">
189 <attribute name="title">
190 <string>Account information</string>
191 </attribute>
192@@ -328,10 +323,10 @@
193 <number>5</number>
194 </property>
195 <property name="leftMargin">
196- <number>0</number>
197+ <number>3</number>
198 </property>
199 <property name="rightMargin">
200- <number>0</number>
201+ <number>3</number>
202 </property>
203 <item>
204 <widget class="GoToWebButton" name="help_button">
205@@ -426,12 +421,6 @@
206 <container>1</container>
207 </customwidget>
208 <customwidget>
209- <class>ServicesPanel</class>
210- <extends>QWidget</extends>
211- <header>ubuntuone.controlpanel.gui.qt.services</header>
212- <container>1</container>
213- </customwidget>
214- <customwidget>
215 <class>DevicesPanel</class>
216 <extends>QWidget</extends>
217 <header>ubuntuone.controlpanel.gui.qt.devices</header>
218@@ -444,12 +433,6 @@
219 <container>1</container>
220 </customwidget>
221 <customwidget>
222- <class>ProfilePanel</class>
223- <extends>QWidget</extends>
224- <header>ubuntuone.controlpanel.gui.qt.profile</header>
225- <container>1</container>
226- </customwidget>
227- <customwidget>
228 <class>FileSyncStatus</class>
229 <extends>QWidget</extends>
230 <header>ubuntuone.controlpanel.gui.qt.filesyncstatus</header>
231@@ -460,6 +443,12 @@
232 <extends>QPushButton</extends>
233 <header>ubuntuone.controlpanel.gui.qt.gotoweb</header>
234 </customwidget>
235+ <customwidget>
236+ <class>AccountPanel</class>
237+ <extends>QWidget</extends>
238+ <header>ubuntuone.controlpanel.gui.qt.account</header>
239+ <container>1</container>
240+ </customwidget>
241 </customwidgets>
242 <tabstops>
243 <tabstop>tab_widget</tabstop>
244
245=== removed file 'data/qt/profile.ui'
246--- data/qt/profile.ui 2011-07-11 11:19:09 +0000
247+++ data/qt/profile.ui 1970-01-01 00:00:00 +0000
248@@ -1,136 +0,0 @@
249-<?xml version="1.0" encoding="UTF-8"?>
250-<ui version="4.0">
251- <class>Form</class>
252- <widget class="QWidget" name="Form">
253- <property name="geometry">
254- <rect>
255- <x>0</x>
256- <y>0</y>
257- <width>456</width>
258- <height>189</height>
259- </rect>
260- </property>
261- <property name="windowTitle">
262- <string notr="true">Form</string>
263- </property>
264- <layout class="QVBoxLayout" name="verticalLayout">
265- <item>
266- <widget class="QGroupBox" name="groupBox">
267- <property name="title">
268- <string>Profile</string>
269- </property>
270- <layout class="QHBoxLayout" name="horizontalLayout">
271- <item>
272- <layout class="QFormLayout" name="formLayout">
273- <property name="fieldGrowthPolicy">
274- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
275- </property>
276- <item row="0" column="1">
277- <widget class="QLineEdit" name="fullname_lineedit">
278- <property name="text">
279- <string/>
280- </property>
281- </widget>
282- </item>
283- <item row="1" column="0">
284- <widget class="QLabel" name="email_label">
285- <property name="text">
286- <string>Email</string>
287- </property>
288- <property name="buddy">
289- <cstring>email_lineedit</cstring>
290- </property>
291- </widget>
292- </item>
293- <item row="1" column="1">
294- <widget class="QLineEdit" name="email_lineedit">
295- <property name="text">
296- <string/>
297- </property>
298- <property name="placeholderText">
299- <string/>
300- </property>
301- </widget>
302- </item>
303- <item row="2" column="0">
304- <widget class="QLabel" name="password_label">
305- <property name="text">
306- <string>Password</string>
307- </property>
308- <property name="buddy">
309- <cstring>password_lineedit</cstring>
310- </property>
311- </widget>
312- </item>
313- <item row="2" column="1">
314- <widget class="QLineEdit" name="password_lineedit">
315- <property name="text">
316- <string/>
317- </property>
318- <property name="echoMode">
319- <enum>QLineEdit::PasswordEchoOnEdit</enum>
320- </property>
321- </widget>
322- </item>
323- <item row="0" column="0">
324- <widget class="QLabel" name="fullname_label">
325- <property name="text">
326- <string>Full name</string>
327- </property>
328- <property name="buddy">
329- <cstring>fullname_lineedit</cstring>
330- </property>
331- </widget>
332- </item>
333- </layout>
334- </item>
335- <item>
336- <spacer name="horizontalSpacer">
337- <property name="orientation">
338- <enum>Qt::Horizontal</enum>
339- </property>
340- <property name="sizeType">
341- <enum>QSizePolicy::Expanding</enum>
342- </property>
343- <property name="sizeHint" stdset="0">
344- <size>
345- <width>40</width>
346- <height>20</height>
347- </size>
348- </property>
349- </spacer>
350- </item>
351- <item>
352- <widget class="QPushButton" name="edit_profile_button">
353- <property name="text">
354- <string>Go to web to edit your profile</string>
355- </property>
356- </widget>
357- </item>
358- </layout>
359- </widget>
360- </item>
361- <item>
362- <spacer name="verticalSpacer">
363- <property name="orientation">
364- <enum>Qt::Vertical</enum>
365- </property>
366- <property name="sizeHint" stdset="0">
367- <size>
368- <width>20</width>
369- <height>40</height>
370- </size>
371- </property>
372- </spacer>
373- </item>
374- </layout>
375- </widget>
376- <tabstops>
377- <tabstop>fullname_lineedit</tabstop>
378- <tabstop>email_lineedit</tabstop>
379- <tabstop>password_lineedit</tabstop>
380- <tabstop>edit_profile_button</tabstop>
381- </tabstops>
382- <resources/>
383- <connections/>
384-</ui>
385
386=== removed file 'data/qt/services.ui'
387--- data/qt/services.ui 2011-07-11 11:19:09 +0000
388+++ data/qt/services.ui 1970-01-01 00:00:00 +0000
389@@ -1,209 +0,0 @@
390-<?xml version="1.0" encoding="UTF-8"?>
391-<ui version="4.0">
392- <class>Form</class>
393- <widget class="QWidget" name="Form">
394- <property name="geometry">
395- <rect>
396- <x>0</x>
397- <y>0</y>
398- <width>341</width>
399- <height>248</height>
400- </rect>
401- </property>
402- <property name="windowTitle">
403- <string notr="true">Form</string>
404- </property>
405- <layout class="QVBoxLayout" name="verticalLayout">
406- <item>
407- <layout class="QVBoxLayout" name="mobile_plan_verticallayout">
408- <item>
409- <layout class="QHBoxLayout" name="horizontalLayout">
410- <item>
411- <widget class="QLabel" name="mobile_plan_title_label">
412- <property name="text">
413- <string notr="true"/>
414- </property>
415- </widget>
416- </item>
417- <item>
418- <spacer name="horizontalSpacer">
419- <property name="orientation">
420- <enum>Qt::Horizontal</enum>
421- </property>
422- <property name="sizeHint" stdset="0">
423- <size>
424- <width>40</width>
425- <height>20</height>
426- </size>
427- </property>
428- </spacer>
429- </item>
430- <item>
431- <widget class="QLabel" name="mobile_plan_trial_label">
432- <property name="text">
433- <string notr="true"/>
434- </property>
435- </widget>
436- </item>
437- </layout>
438- </item>
439- <item>
440- <widget class="Line" name="mobile_plan_horizontal_line">
441- <property name="orientation">
442- <enum>Qt::Horizontal</enum>
443- </property>
444- </widget>
445- </item>
446- <item>
447- <widget class="QLabel" name="mobile_plan_billing_label">
448- <property name="text">
449- <string notr="true"/>
450- </property>
451- </widget>
452- </item>
453- <item>
454- <layout class="QHBoxLayout" name="horizontalLayout_2">
455- <item>
456- <spacer name="horizontalSpacer_2">
457- <property name="orientation">
458- <enum>Qt::Horizontal</enum>
459- </property>
460- <property name="sizeHint" stdset="0">
461- <size>
462- <width>40</width>
463- <height>20</height>
464- </size>
465- </property>
466- </spacer>
467- </item>
468- <item>
469- <widget class="QPushButton" name="mobile_plan_modify_button">
470- <property name="text">
471- <string>Go to the web to modify your plan</string>
472- </property>
473- </widget>
474- </item>
475- <item>
476- <spacer name="horizontalSpacer_3">
477- <property name="orientation">
478- <enum>Qt::Horizontal</enum>
479- </property>
480- <property name="sizeHint" stdset="0">
481- <size>
482- <width>40</width>
483- <height>20</height>
484- </size>
485- </property>
486- </spacer>
487- </item>
488- </layout>
489- </item>
490- </layout>
491- </item>
492- <item>
493- <layout class="QVBoxLayout" name="storage_plan_verticallayout">
494- <item>
495- <layout class="QHBoxLayout" name="horizontalLayout_3">
496- <item>
497- <widget class="QLabel" name="storage_plan_total_label">
498- <property name="text">
499- <string notr="true"/>
500- </property>
501- </widget>
502- </item>
503- <item>
504- <spacer name="horizontalSpacer_4">
505- <property name="orientation">
506- <enum>Qt::Horizontal</enum>
507- </property>
508- <property name="sizeHint" stdset="0">
509- <size>
510- <width>40</width>
511- <height>20</height>
512- </size>
513- </property>
514- </spacer>
515- </item>
516- <item>
517- <widget class="QLabel" name="storage_plan_usage_label">
518- <property name="text">
519- <string notr="true"/>
520- </property>
521- </widget>
522- </item>
523- </layout>
524- </item>
525- <item>
526- <widget class="Line" name="storage_plan_horizontalline">
527- <property name="orientation">
528- <enum>Qt::Horizontal</enum>
529- </property>
530- </widget>
531- </item>
532- <item>
533- <widget class="QLabel" name="storage_plan_label">
534- <property name="text">
535- <string notr="true"/>
536- </property>
537- <property name="textFormat">
538- <enum>Qt::PlainText</enum>
539- </property>
540- </widget>
541- </item>
542- <item>
543- <layout class="QHBoxLayout" name="horizontalLayout_4">
544- <item>
545- <spacer name="horizontalSpacer_5">
546- <property name="orientation">
547- <enum>Qt::Horizontal</enum>
548- </property>
549- <property name="sizeHint" stdset="0">
550- <size>
551- <width>40</width>
552- <height>20</height>
553- </size>
554- </property>
555- </spacer>
556- </item>
557- <item>
558- <widget class="QPushButton" name="storage_plan_modify_button">
559- <property name="text">
560- <string>Go to the web to update your storage</string>
561- </property>
562- </widget>
563- </item>
564- <item>
565- <spacer name="horizontalSpacer_6">
566- <property name="orientation">
567- <enum>Qt::Horizontal</enum>
568- </property>
569- <property name="sizeHint" stdset="0">
570- <size>
571- <width>40</width>
572- <height>20</height>
573- </size>
574- </property>
575- </spacer>
576- </item>
577- </layout>
578- </item>
579- </layout>
580- </item>
581- <item>
582- <spacer name="verticalSpacer_2">
583- <property name="orientation">
584- <enum>Qt::Vertical</enum>
585- </property>
586- <property name="sizeHint" stdset="0">
587- <size>
588- <width>20</width>
589- <height>40</height>
590- </size>
591- </property>
592- </spacer>
593- </item>
594- </layout>
595- </widget>
596- <resources/>
597- <connections/>
598-</ui>
599
600=== removed file 'data/qt/ubuntuonebin.ui'
601--- data/qt/ubuntuonebin.ui 2011-07-11 11:19:09 +0000
602+++ data/qt/ubuntuonebin.ui 1970-01-01 00:00:00 +0000
603@@ -1,48 +0,0 @@
604-<?xml version="1.0" encoding="UTF-8"?>
605-<ui version="4.0">
606- <class>Form</class>
607- <widget class="QWidget" name="Form">
608- <property name="geometry">
609- <rect>
610- <x>0</x>
611- <y>0</y>
612- <width>248</width>
613- <height>59</height>
614- </rect>
615- </property>
616- <property name="windowTitle">
617- <string notr="true">Form</string>
618- </property>
619- <layout class="QVBoxLayout" name="verticalLayout">
620- <item>
621- <layout class="QHBoxLayout" name="horizontalLayout">
622- <item>
623- <widget class="QLabel" name="title_label">
624- <property name="text">
625- <string notr="true">The Panel Title</string>
626- </property>
627- </widget>
628- </item>
629- <item>
630- <spacer name="horizontalSpacer">
631- <property name="orientation">
632- <enum>Qt::Horizontal</enum>
633- </property>
634- <property name="sizeHint" stdset="0">
635- <size>
636- <width>40</width>
637- <height>20</height>
638- </size>
639- </property>
640- </spacer>
641- </item>
642- </layout>
643- </item>
644- <item>
645- <widget class="QWidget" name="container" native="true"/>
646- </item>
647- </layout>
648- </widget>
649- <resources/>
650- <connections/>
651-</ui>
652
653=== renamed file 'ubuntuone/controlpanel/gui/qt/profile.py' => 'ubuntuone/controlpanel/gui/qt/account.py'
654--- ubuntuone/controlpanel/gui/qt/profile.py 2011-06-21 22:46:08 +0000
655+++ ubuntuone/controlpanel/gui/qt/account.py 2011-07-21 20:09:30 +0000
656@@ -1,6 +1,7 @@
657 # -*- coding: utf-8 -*-
658
659 # Authors: Alejandro J. Cura <alecu@canonical.com>
660+# Natalia B. Bidart <natalia.bidart@canonical.com>
661 #
662 # Copyright 2011 Canonical Ltd.
663 #
664@@ -18,26 +19,29 @@
665
666 """The user interface for the control panel for Ubuntu One."""
667
668-# Unused import QtGui
669-# pylint: disable=W0611
670-from PyQt4 import QtGui, QtCore
671-# pylint: enable=W0611
672 from twisted.internet import defer
673
674 from ubuntuone.controlpanel.logger import setup_logging, log_call
675-from ubuntuone.controlpanel.gui import EDIT_PROFILE_LINK
676-from ubuntuone.controlpanel.gui.qt import uri_hook
677+from ubuntuone.controlpanel.gui import (
678+ EDIT_ACCOUNT_LINK,
679+ EDIT_PROFILE_LINK,
680+)
681 from ubuntuone.controlpanel.gui.qt.ubuntuonebin import UbuntuOneBin
682-from ubuntuone.controlpanel.gui.qt.ui import profile_ui
683-
684-
685-logger = setup_logging('qt.profile')
686-
687-
688-class ProfilePanel(UbuntuOneBin):
689- """The Profile Tab Panel widget"""
690-
691- ui_class = profile_ui
692+from ubuntuone.controlpanel.gui.qt.ui import account_ui
693+
694+
695+logger = setup_logging('qt.account')
696+
697+
698+class AccountPanel(UbuntuOneBin):
699+ """The Account Tab Panel widget"""
700+
701+ ui_class = account_ui
702+
703+ def _setup(self):
704+ """Do some extra setupping for the UI."""
705+ self.ui.edit_profile_button.uri = EDIT_PROFILE_LINK
706+ self.ui.edit_services_button.uri = EDIT_ACCOUNT_LINK
707
708 @defer.inlineCallbacks
709 def load(self):
710@@ -49,13 +53,8 @@
711 @log_call(logger.debug)
712 def process_info(self, info):
713 """Process and display the account info."""
714- self.ui.fullname_lineedit.setText(info["name"])
715- self.ui.email_lineedit.setText(info["email"])
716- self.ui.password_lineedit.setText("swordfish")
717+ self.ui.name_label.setText(info["name"])
718+ self.ui.email_label.setText(info["email"])
719+ self.ui.services_description_label.setText(info["type"])
720
721 self.is_processing = False
722-
723- @QtCore.pyqtSlot()
724- def on_edit_profile_button_clicked(self):
725- """The edit profile button was clicked."""
726- uri_hook(EDIT_PROFILE_LINK)
727
728=== removed file 'ubuntuone/controlpanel/gui/qt/services.py'
729--- ubuntuone/controlpanel/gui/qt/services.py 2011-06-21 22:46:08 +0000
730+++ ubuntuone/controlpanel/gui/qt/services.py 1970-01-01 00:00:00 +0000
731@@ -1,66 +0,0 @@
732-# -*- coding: utf-8 -*-
733-
734-# Authors: Alejandro J. Cura <alecu@canonical.com>
735-#
736-# Copyright 2011 Canonical Ltd.
737-#
738-# This program is free software: you can redistribute it and/or modify it
739-# under the terms of the GNU General Public License version 3, as published
740-# by the Free Software Foundation.
741-#
742-# This program is distributed in the hope that it will be useful, but
743-# WITHOUT ANY WARRANTY; without even the implied warranties of
744-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
745-# PURPOSE. See the GNU General Public License for more details.
746-#
747-# You should have received a copy of the GNU General Public License along
748-# with this program. If not, see <http://www.gnu.org/licenses/>.
749-
750-"""The user interface for the control panel for Ubuntu One."""
751-
752-from gettext import gettext as _
753-from twisted.internet import defer
754-
755-# Unused import QtGui
756-# pylint: disable=W0611
757-from PyQt4 import QtGui, QtCore
758-# pylint: enable=W0611
759-
760-from ubuntuone.controlpanel.logger import setup_logging, log_call
761-from ubuntuone.controlpanel.gui import EDIT_ACCOUNT_LINK
762-from ubuntuone.controlpanel.gui.qt import uri_hook
763-from ubuntuone.controlpanel.gui.qt.ubuntuonebin import UbuntuOneBin
764-from ubuntuone.controlpanel.gui.qt.ui import services_ui
765-
766-
767-logger = setup_logging('qt.services')
768-
769-
770-class ServicesPanel(UbuntuOneBin):
771- """The ServicesFolders Tab Panel widget"""
772-
773- title = _('Selected plans and storage')
774- ui_class = services_ui
775-
776- @defer.inlineCallbacks
777- def load(self):
778- """Load info."""
779- self.is_processing = True
780- info = yield self.backend.account_info()
781- self.process_info(info)
782-
783- @log_call(logger.debug)
784- def process_info(self, info):
785- """Process and display the account info."""
786- self.ui.storage_plan_label.setText(info["type"])
787- self.is_processing = False
788-
789- @QtCore.pyqtSlot()
790- def on_mobile_plan_modify_button_clicked(self):
791- """The mobile plan modify button was clicked."""
792- uri_hook(EDIT_ACCOUNT_LINK)
793-
794- @QtCore.pyqtSlot()
795- def on_storage_plan_modify_button_clicked(self):
796- """The storage plan modify button was clicked."""
797- uri_hook(EDIT_ACCOUNT_LINK)
798
799=== renamed file 'ubuntuone/controlpanel/gui/qt/tests/test_profile.py' => 'ubuntuone/controlpanel/gui/qt/tests/test_account.py'
800--- ubuntuone/controlpanel/gui/qt/tests/test_profile.py 2011-07-11 11:19:09 +0000
801+++ ubuntuone/controlpanel/gui/qt/tests/test_account.py 2011-07-21 20:09:30 +0000
802@@ -16,29 +16,30 @@
803 # You should have received a copy of the GNU General Public License along
804 # with this program. If not, see <http://www.gnu.org/licenses/>.
805
806-"""Tests for the profile tab."""
807+"""Tests for the account tab."""
808
809 from twisted.internet import defer
810
811-from ubuntuone.controlpanel.gui.qt import profile as gui
812+from ubuntuone.controlpanel.gui import qt
813+from ubuntuone.controlpanel.gui.qt import account as gui
814 from ubuntuone.controlpanel.gui.qt.tests import (
815- SAMPLE_ACCOUNT_INFO, SAMPLE_EMAIL, SAMPLE_NAME,
816+ SAMPLE_ACCOUNT_INFO, SAMPLE_EMAIL, SAMPLE_NAME, SAMPLE_PLAN,
817 )
818 from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (
819 UbuntuOneBinTestCase,
820 )
821
822
823-class ProfilePanelTestCase(UbuntuOneBinTestCase):
824+class AccountPanelTestCase(UbuntuOneBinTestCase):
825 """Test the qt control panel."""
826
827- innerclass_ui = gui.profile_ui
828+ innerclass_ui = gui.account_ui
829 innerclass_name = "Ui_Form"
830- class_ui = gui.ProfilePanel
831+ class_ui = gui.AccountPanel
832
833 @defer.inlineCallbacks
834 def setUp(self):
835- yield super(ProfilePanelTestCase, self).setUp()
836+ yield super(AccountPanelTestCase, self).setUp()
837 self.ui.backend.next_result = SAMPLE_ACCOUNT_INFO
838
839 def test_is_processing_while_asking_info(self):
840@@ -67,13 +68,21 @@
841 def test_process_info(self):
842 """The info is processed when ready."""
843 self.ui.process_info(SAMPLE_ACCOUNT_INFO)
844- self.assertEqual(self.ui.ui.fullname_lineedit.text(), SAMPLE_NAME)
845- self.assertEqual(self.ui.ui.email_lineedit.text(), SAMPLE_EMAIL)
846- self.assertEqual(self.ui.ui.password_lineedit.text(), "swordfish")
847+ self.assertEqual(self.ui.ui.name_label.text(), SAMPLE_NAME)
848+ self.assertEqual(self.ui.ui.email_label.text(), SAMPLE_EMAIL)
849+ self.assertEqual(self.ui.ui.services_description_label.text(),
850+ SAMPLE_PLAN)
851
852- def test_edit_profile_button(self):
853- """When clicking the edit profile button, the proper url is opened."""
854- self.patch(gui, 'uri_hook', self._set_called)
855+ def test_edit_account_button(self):
856+ """When clicking the edit account button, the proper url is opened."""
857+ self.patch(qt, 'uri_hook', self._set_called)
858 self.ui.ui.edit_profile_button.click()
859
860 self.assertEqual(self._called, ((gui.EDIT_PROFILE_LINK,), {}))
861+
862+ def test_edit_services_button(self):
863+ """When clicking the mobile plan button, the proper url is opened."""
864+ self.patch(qt, 'uri_hook', self._set_called)
865+ self.ui.ui.edit_services_button.click()
866+
867+ self.assertEqual(self._called, ((gui.EDIT_ACCOUNT_LINK,), {}))
868
869=== removed file 'ubuntuone/controlpanel/gui/qt/tests/test_services.py'
870--- ubuntuone/controlpanel/gui/qt/tests/test_services.py 2011-07-11 11:19:09 +0000
871+++ ubuntuone/controlpanel/gui/qt/tests/test_services.py 1970-01-01 00:00:00 +0000
872@@ -1,84 +0,0 @@
873-# -*- coding: utf-8 -*-
874-
875-# Author: Alejandro J. Cura <alecu@canonical.com>
876-#
877-# Copyright 2011 Canonical Ltd.
878-#
879-# This program is free software: you can redistribute it and/or modify it
880-# under the terms of the GNU General Public License version 3, as published
881-# by the Free Software Foundation.
882-#
883-# This program is distributed in the hope that it will be useful, but
884-# WITHOUT ANY WARRANTY; without even the implied warranties of
885-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
886-# PURPOSE. See the GNU General Public License for more details.
887-#
888-# You should have received a copy of the GNU General Public License along
889-# with this program. If not, see <http://www.gnu.org/licenses/>.
890-
891-"""Tests for the services tab."""
892-
893-from twisted.internet import defer
894-
895-from ubuntuone.controlpanel.gui.qt import services as gui
896-from ubuntuone.controlpanel.gui.qt.tests import (
897- SAMPLE_ACCOUNT_INFO, SAMPLE_PLAN,
898-)
899-from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (
900- UbuntuOneBinTestCase,
901-)
902-
903-
904-class ServicesPanelTestCase(UbuntuOneBinTestCase):
905- """Test the qt control panel."""
906-
907- innerclass_ui = gui.services_ui
908- innerclass_name = "Ui_Form"
909- class_ui = gui.ServicesPanel
910-
911- @defer.inlineCallbacks
912- def setUp(self):
913- yield super(ServicesPanelTestCase, self).setUp()
914- self.ui.backend.next_result = SAMPLE_ACCOUNT_INFO
915-
916- def test_is_processing_while_asking_info(self):
917- """The ui is processing while the contents are loaded."""
918- def check():
919- """The ui must be is_processing."""
920- self.assertTrue(self.ui.is_processing, 'ui must be processing')
921- return SAMPLE_ACCOUNT_INFO
922-
923- self.patch(self.ui.backend, 'account_info', check)
924-
925- return self.ui.load() # trigger the info request
926-
927- def test_is_not_processing_after_info_ready(self):
928- """The ui is not processing when contents are load."""
929- self.ui.process_info(SAMPLE_ACCOUNT_INFO)
930-
931- self.assertFalse(self.ui.is_processing)
932-
933- @defer.inlineCallbacks
934- def test_info_is_requested_on_load(self):
935- """The info is requested to the backend."""
936- yield self.ui.load()
937- self.assert_backend_called('account_info')
938-
939- def test_process_info(self):
940- """The info is processed when ready."""
941- self.ui.process_info(SAMPLE_ACCOUNT_INFO)
942- self.assertEqual(self.ui.ui.storage_plan_label.text(), SAMPLE_PLAN)
943-
944- def test_mobile_plan_modify_button(self):
945- """When clicking the mobile plan button, the proper url is opened."""
946- self.patch(gui, 'uri_hook', self._set_called)
947- self.ui.ui.mobile_plan_modify_button.click()
948-
949- self.assertEqual(self._called, ((gui.EDIT_ACCOUNT_LINK,), {}))
950-
951- def test_storage_plan_modify_button(self):
952- """When clicking the storage plan button, the proper url is opened."""
953- self.patch(gui, 'uri_hook', self._set_called)
954- self.ui.ui.storage_plan_modify_button.click()
955-
956- self.assertEqual(self._called, ((gui.EDIT_ACCOUNT_LINK,), {}))
957
958=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_ubuntuonebin.py'
959--- ubuntuone/controlpanel/gui/qt/tests/test_ubuntuonebin.py 2011-07-20 16:31:52 +0000
960+++ ubuntuone/controlpanel/gui/qt/tests/test_ubuntuonebin.py 2011-07-21 20:09:30 +0000
961@@ -37,13 +37,6 @@
962 self.assertIsInstance(self.ui.backend,
963 gui.backend.ControlBackend)
964
965- # pylint: disable=W0221
966- def test_init_loads_ui(self):
967- """The __init__ method loads the ui."""
968- expected_setup_ui = lambda ui: ui.bin_ui.container
969- super(UbuntuOneBinTestCase, self).test_init_loads_ui(expected_setup_ui)
970- # pylint: enable=W0221
971-
972 def test_is_not_processing_after_creation(self):
973 """After creation, is not processing."""
974 self.assertFalse(self.ui.is_processing)
975@@ -72,23 +65,3 @@
976
977 self.assertFalse(self.ui.isEnabled())
978 self.assertTrue(self.ui.overlay.isVisible())
979-
980- def test_title_when_none(self):
981- """The title is the empty string when class title is None."""
982-
983- class MyBin(gui.UbuntuOneBin):
984- """Inherit to set a class title."""
985- title = None
986-
987- ui = MyBin()
988- self.assertEqual(ui.bin_ui.title_label.text(), '')
989-
990- def test_title_when_not_none(self):
991- """The title is the empty string when class title is None."""
992-
993- class MyBin(gui.UbuntuOneBin):
994- """Inherit to set a class title."""
995- title = 'Hello World!'
996-
997- ui = MyBin()
998- self.assertEqual(ui.bin_ui.title_label.text(), MyBin.title)
999
1000=== modified file 'ubuntuone/controlpanel/gui/qt/ubuntuonebin.py'
1001--- ubuntuone/controlpanel/gui/qt/ubuntuonebin.py 2011-07-20 16:31:52 +0000
1002+++ ubuntuone/controlpanel/gui/qt/ubuntuonebin.py 2011-07-21 20:09:30 +0000
1003@@ -18,39 +18,26 @@
1004
1005 """The base widget for the Control Panel tabs."""
1006
1007-from PyQt4 import QtGui, QtCore
1008+from PyQt4 import QtGui
1009
1010 from ubuntuone.controlpanel import backend
1011-from ubuntuone.controlpanel.gui.qt.ui import ubuntuonebin_ui
1012 from ubuntuone.controlpanel.gui.qt.loadingoverlay import LoadingOverlay
1013
1014
1015 class UbuntuOneBin(QtGui.QWidget):
1016 """The base widget for the Control Panel's tabs."""
1017
1018- title = None
1019 ui_class = None
1020
1021 def __init__(self, parent=None):
1022 """Initialize the UI of the widget."""
1023 QtGui.QWidget.__init__(self, parent)
1024-
1025- self.bin_ui = ubuntuonebin_ui.Ui_Form()
1026- self.bin_ui.setupUi(self)
1027-
1028- if self.title is None:
1029- self.bin_ui.title_label.setText('')
1030- else:
1031- self.bin_ui.title_label.setText(self.title)
1032-
1033 self.ui = None
1034 if self.ui_class is not None:
1035 # self.ui_class is not callable
1036+ self.ui = self.ui_class.Ui_Form()
1037 # pylint: disable=E1102
1038- self.ui = self.ui_class.Ui_Form()
1039- self.ui.setupUi(self.bin_ui.container)
1040- # connect all signals to this instance
1041- QtCore.QMetaObject.connectSlotsByName(self)
1042+ self.ui.setupUi(self)
1043
1044 self.overlay = LoadingOverlay(self)
1045 self.overlay.hide()

Subscribers

People subscribed via source and target branches