Merge lp:~gary-lasker/software-center/recommendations-opt-out into lp:software-center
- recommendations-opt-out
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 2880 |
Proposed branch: | lp:~gary-lasker/software-center/recommendations-opt-out |
Merge into: | lp:software-center |
Diff against target: |
324 lines (+125/-25) 6 files modified
data/ui/gtk3/SoftwareCenter.ui (+16/-6) softwarecenter/ui/gtk3/app.py (+36/-7) softwarecenter/ui/gtk3/views/catview_gtk.py (+1/-1) softwarecenter/ui/gtk3/widgets/containers.py (+4/-0) softwarecenter/ui/gtk3/widgets/recommendations.py (+54/-9) test/gtk3/test_recommendations_widgets.py (+14/-2) |
To merge this branch: | bzr merge lp:~gary-lasker/software-center/recommendations-opt-out |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
software-store-developers | Pending | ||
Review via email: mp+97928@code.launchpad.net |
Commit message
Description of the change
This branch implements the recommendations opt-out feature as specified in the most recent Software Center spec from mpt (https:/
In the case where the user has not yet opted in, this menu item reads "Turn On Recommendations
Unfortunately, this branch is light on tests for the small amout of new stuff, but in actuality there is not much new code for which tests will be terribly important. The "heavy" code is already tested -- this is really just some small UI additions. Nevertheless, I apologize for that, and a follow-on branch is forthcoming that will improve this coverage. In the interest of getting this last remaining important piece of recommender functionality merged in time for it to be covered under our current outstanding string freeze/UI freeze exception bug 956779, I'm submitting the MP now.
Thanks!
- 2858. By Gary Lasker
-
trunkify
- 2859. By Gary Lasker
-
make a new class Recommendations
OptInDialog in the recommendations module and use it - 2860. By Gary Lasker
-
add new tests so that all of the recommendations widget panels are tested
Gary Lasker (gary-lasker) wrote : | # |
Michael Vogt (mvo) wrote : | # |
Thanks for your branch. This is fine but I did some fixes in lp:~mvo/software-center/recommendations-opt-out/
please double check them and merge back.
Preview Diff
1 | === modified file 'data/ui/gtk3/SoftwareCenter.ui' | |||
2 | --- data/ui/gtk3/SoftwareCenter.ui 2011-11-29 18:52:13 +0000 | |||
3 | +++ data/ui/gtk3/SoftwareCenter.ui 2012-03-19 01:17:20 +0000 | |||
4 | @@ -158,12 +158,6 @@ | |||
5 | 158 | </object> | 158 | </object> |
6 | 159 | </child> | 159 | </child> |
7 | 160 | <child> | 160 | <child> |
8 | 161 | <object class="GtkSeparatorMenuItem" id="separator_login"> | ||
9 | 162 | <property name="visible">True</property> | ||
10 | 163 | <property name="can_focus">False</property> | ||
11 | 164 | </object> | ||
12 | 165 | </child> | ||
13 | 166 | <child> | ||
14 | 167 | <object class="GtkMenuItem" id="menuitem_reinstall_purchases"> | 161 | <object class="GtkMenuItem" id="menuitem_reinstall_purchases"> |
15 | 168 | <property name="visible">True</property> | 162 | <property name="visible">True</property> |
16 | 169 | <property name="can_focus">False</property> | 163 | <property name="can_focus">False</property> |
17 | @@ -454,6 +448,22 @@ | |||
18 | 454 | <signal name="toggled" handler="on_menuitem_add_to_launcher_toggled" swapped="no"/> | 448 | <signal name="toggled" handler="on_menuitem_add_to_launcher_toggled" swapped="no"/> |
19 | 455 | </object> | 449 | </object> |
20 | 456 | </child> | 450 | </child> |
21 | 451 | <child> | ||
22 | 452 | <object class="GtkSeparatorMenuItem" id="separator_recommendations_opt_in"> | ||
23 | 453 | <property name="visible">True</property> | ||
24 | 454 | <property name="can_focus">False</property> | ||
25 | 455 | </object> | ||
26 | 456 | </child> | ||
27 | 457 | <child> | ||
28 | 458 | <object class="GtkMenuItem" id="menuitem_recommendations"> | ||
29 | 459 | <property name="visible">True</property> | ||
30 | 460 | <property name="can_focus">False</property> | ||
31 | 461 | <property name="use_action_appearance">False</property> | ||
32 | 462 | <property name="label" translatable="yes">Turn On Recommendations...</property> | ||
33 | 463 | <property name="use_underline">True</property> | ||
34 | 464 | <signal name="activate" handler="on_menuitem_recommendations_activate" swapped="no"/> | ||
35 | 465 | </object> | ||
36 | 466 | </child> | ||
37 | 457 | </object> | 467 | </object> |
38 | 458 | </child> | 468 | </child> |
39 | 459 | </object> | 469 | </object> |
40 | 460 | 470 | ||
41 | === modified file 'softwarecenter/ui/gtk3/app.py' | |||
42 | --- softwarecenter/ui/gtk3/app.py 2012-03-16 17:49:04 +0000 | |||
43 | +++ softwarecenter/ui/gtk3/app.py 2012-03-19 01:17:20 +0000 | |||
44 | @@ -89,6 +89,8 @@ | |||
45 | 89 | get_appmanager) | 89 | get_appmanager) |
46 | 90 | from softwarecenter.ui.gtk3.session.viewmanager import ( | 90 | from softwarecenter.ui.gtk3.session.viewmanager import ( |
47 | 91 | ViewManager, get_viewmanager) | 91 | ViewManager, get_viewmanager) |
48 | 92 | from softwarecenter.ui.gtk3.widgets.recommendations import ( | ||
49 | 93 | RecommendationsOptInDialog) | ||
50 | 92 | 94 | ||
51 | 93 | from softwarecenter.config import get_config | 95 | from softwarecenter.config import get_config |
52 | 94 | from softwarecenter.backend import get_install_backend | 96 | from softwarecenter.backend import get_install_backend |
53 | @@ -370,14 +372,14 @@ | |||
54 | 370 | 372 | ||
55 | 371 | # Adapt menu entries | 373 | # Adapt menu entries |
56 | 372 | supported_menuitem = self.builder.get_object( | 374 | supported_menuitem = self.builder.get_object( |
58 | 373 | "menuitem_view_supported_only") | 375 | "menuitem_view_supported_only") |
59 | 374 | supported_menuitem.set_label(self.distro.get_supported_filter_name()) | 376 | supported_menuitem.set_label(self.distro.get_supported_filter_name()) |
60 | 375 | file_menu = self.builder.get_object("menu1") | 377 | file_menu = self.builder.get_object("menu1") |
61 | 376 | 378 | ||
62 | 377 | if not self.distro.DEVELOPER_URL: | 379 | if not self.distro.DEVELOPER_URL: |
63 | 378 | help_menu = self.builder.get_object("menu_help") | 380 | help_menu = self.builder.get_object("menu_help") |
64 | 379 | developer_separator = self.builder.get_object( | 381 | developer_separator = self.builder.get_object( |
66 | 380 | "separator_developer") | 382 | "separator_developer") |
67 | 381 | help_menu.remove(developer_separator) | 383 | help_menu.remove(developer_separator) |
68 | 382 | developer_menuitem = self.builder.get_object("menuitem_developer") | 384 | developer_menuitem = self.builder.get_object("menuitem_developer") |
69 | 383 | help_menu.remove(developer_menuitem) | 385 | help_menu.remove(developer_menuitem) |
70 | @@ -495,6 +497,9 @@ | |||
71 | 495 | 497 | ||
72 | 496 | def on_available_pane_created(self, widget): | 498 | def on_available_pane_created(self, widget): |
73 | 497 | self.available_pane.searchentry.grab_focus() | 499 | self.available_pane.searchentry.grab_focus() |
74 | 500 | rec_panel = self.available_pane.cat_view.recommended_for_you_panel | ||
75 | 501 | self._update_recommendations_menuitem( | ||
76 | 502 | opted_in=rec_panel.recommender_agent.is_opted_in()) | ||
77 | 498 | # connect a signal to monitor the recommendations opt-in state and | 503 | # connect a signal to monitor the recommendations opt-in state and |
78 | 499 | # persist the recommendations uuid on an opt-in | 504 | # persist the recommendations uuid on an opt-in |
79 | 500 | self.available_pane.cat_view.recommended_for_you_panel.connect( | 505 | self.available_pane.cat_view.recommended_for_you_panel.connect( |
80 | @@ -507,13 +512,25 @@ | |||
81 | 507 | #~ def on_installed_pane_created(self, widget): | 512 | #~ def on_installed_pane_created(self, widget): |
82 | 508 | #~ pass | 513 | #~ pass |
83 | 509 | 514 | ||
85 | 510 | def _on_recommendations_opt_in(self, agent, recommender_uuid): | 515 | def _on_recommendations_opt_in(self, rec_panel, recommender_uuid): |
86 | 511 | self.recommender_uuid = recommender_uuid | 516 | self.recommender_uuid = recommender_uuid |
87 | 517 | self._update_recommendations_menuitem(opted_in=True) | ||
88 | 512 | 518 | ||
90 | 513 | def _on_recommendations_opt_out(self): | 519 | def _on_recommendations_opt_out(self, rec_panel): |
91 | 514 | # if the user opts back out of the recommender service, we | 520 | # if the user opts back out of the recommender service, we |
93 | 515 | # reset the UUID to indicate it | 521 | # reset the recommender UUID to indicate it |
94 | 516 | self.recommender_uuid = "" | 522 | self.recommender_uuid = "" |
95 | 523 | self._update_recommendations_menuitem(opted_in=False) | ||
96 | 524 | |||
97 | 525 | def _update_recommendations_menuitem(self, opted_in): | ||
98 | 526 | recommendations_menuitem = self.builder.get_object( | ||
99 | 527 | "menuitem_recommendations") | ||
100 | 528 | if opted_in: | ||
101 | 529 | recommendations_menuitem.set_label( | ||
102 | 530 | _(u"Turn Off Recommendations")) | ||
103 | 531 | else: | ||
104 | 532 | recommendations_menuitem.set_label( | ||
105 | 533 | _(u"Turn On Recommendations...")) | ||
106 | 517 | 534 | ||
107 | 518 | def _on_update_software_center_agent_finished(self, pid, condition): | 535 | def _on_update_software_center_agent_finished(self, pid, condition): |
108 | 519 | LOG.info("software-center-agent finished with status %i" % | 536 | LOG.info("software-center-agent finished with status %i" % |
109 | @@ -764,7 +781,19 @@ | |||
110 | 764 | from softwarecenter.backend.scagent import SoftwareCenterAgent | 781 | from softwarecenter.backend.scagent import SoftwareCenterAgent |
111 | 765 | self.scagent = SoftwareCenterAgent() | 782 | self.scagent = SoftwareCenterAgent() |
112 | 766 | self.scagent.connect("available-for-me", | 783 | self.scagent.connect("available-for-me", |
114 | 767 | self._available_for_me_result) | 784 | self._available_for_me_result) |
115 | 785 | |||
116 | 786 | def on_menuitem_recommendations_activate(self, menu_item): | ||
117 | 787 | rec_panel = self.available_pane.cat_view.recommended_for_you_panel | ||
118 | 788 | if rec_panel.recommender_agent.is_opted_in(): | ||
119 | 789 | rec_panel.opt_out_of_recommendations_service() | ||
120 | 790 | else: | ||
121 | 791 | # build and show the opt-in dialog | ||
122 | 792 | opt_in_dialog = RecommendationsOptInDialog(self.icons) | ||
123 | 793 | res = opt_in_dialog.run() | ||
124 | 794 | opt_in_dialog.destroy() | ||
125 | 795 | if res == Gtk.ResponseType.YES: | ||
126 | 796 | rec_panel.opt_in_to_recommendations_service() | ||
127 | 768 | 797 | ||
128 | 769 | def on_menuitem_reinstall_purchases_activate(self, menuitem): | 798 | def on_menuitem_reinstall_purchases_activate(self, menuitem): |
129 | 770 | self.view_manager.set_active_view(ViewPages.AVAILABLE) | 799 | self.view_manager.set_active_view(ViewPages.AVAILABLE) |
130 | @@ -773,7 +802,7 @@ | |||
131 | 773 | if self.available_for_me_query: | 802 | if self.available_for_me_query: |
132 | 774 | # we already have the list of available items, so just show it | 803 | # we already have the list of available items, so just show it |
133 | 775 | self.available_pane.on_previous_purchases_activated( | 804 | self.available_pane.on_previous_purchases_activated( |
135 | 776 | self.available_for_me_query) | 805 | self.available_for_me_query) |
136 | 777 | else: | 806 | else: |
137 | 778 | # fetch the list of available items and show it | 807 | # fetch the list of available items and show it |
138 | 779 | self._create_scagent_if_needed() | 808 | self._create_scagent_if_needed() |
139 | 780 | 809 | ||
140 | === modified file 'softwarecenter/ui/gtk3/views/catview_gtk.py' | |||
141 | --- softwarecenter/ui/gtk3/views/catview_gtk.py 2012-03-15 21:19:02 +0000 | |||
142 | +++ softwarecenter/ui/gtk3/views/catview_gtk.py 2012-03-19 01:17:20 +0000 | |||
143 | @@ -579,7 +579,7 @@ | |||
144 | 579 | self.vbox.remove(self.recommended_for_you_in_cat) | 579 | self.vbox.remove(self.recommended_for_you_in_cat) |
145 | 580 | self.recommended_for_you_in_cat = RecommendationsPanelCategory( | 580 | self.recommended_for_you_in_cat = RecommendationsPanelCategory( |
146 | 581 | self, | 581 | self, |
148 | 582 | category) | 582 | category) |
149 | 583 | # only show the panel in the categories view when the user | 583 | # only show the panel in the categories view when the user |
150 | 584 | # is opted in to the recommender service | 584 | # is opted in to the recommender service |
151 | 585 | # FIXME: this is needed vs. a simple hide() on the widget because | 585 | # FIXME: this is needed vs. a simple hide() on the widget because |
152 | 586 | 586 | ||
153 | === modified file 'softwarecenter/ui/gtk3/widgets/containers.py' | |||
154 | --- softwarecenter/ui/gtk3/widgets/containers.py 2012-03-12 12:43:52 +0000 | |||
155 | +++ softwarecenter/ui/gtk3/widgets/containers.py 2012-03-19 01:17:20 +0000 | |||
156 | @@ -564,6 +564,10 @@ | |||
157 | 564 | self.more = MoreLink() | 564 | self.more = MoreLink() |
158 | 565 | self.header.pack_end(self.more, False, False, 0) | 565 | self.header.pack_end(self.more, False, False, 0) |
159 | 566 | 566 | ||
160 | 567 | def remove_more_button(self): | ||
161 | 568 | if hasattr(self, "more"): | ||
162 | 569 | self.header.remove(self.more) | ||
163 | 570 | |||
164 | 567 | def render_header(self, cr, a, border_radius, assets): | 571 | def render_header(self, cr, a, border_radius, assets): |
165 | 568 | 572 | ||
166 | 569 | if hasattr(self, "more"): | 573 | if hasattr(self, "more"): |
167 | 570 | 574 | ||
168 | === modified file 'softwarecenter/ui/gtk3/widgets/recommendations.py' | |||
169 | --- softwarecenter/ui/gtk3/widgets/recommendations.py 2012-03-15 22:23:21 +0000 | |||
170 | +++ softwarecenter/ui/gtk3/widgets/recommendations.py 2012-03-19 01:17:20 +0000 | |||
171 | @@ -91,7 +91,7 @@ | |||
172 | 91 | # add the new stuff | 91 | # add the new stuff |
173 | 92 | self.recommended_for_you_content = FlowableGrid() | 92 | self.recommended_for_you_content = FlowableGrid() |
174 | 93 | self.add(self.recommended_for_you_content) | 93 | self.add(self.recommended_for_you_content) |
176 | 94 | self.spinner_notebook.show_spinner(_("Receiving recommendations…")) | 94 | self.spinner_notebook.show_spinner(_(u"Receiving recommendations…")) |
177 | 95 | # get the recommendations from the recommender agent | 95 | # get the recommendations from the recommender agent |
178 | 96 | self.recommended_for_you_cat = RecommendedForYouCategory( | 96 | self.recommended_for_you_cat = RecommendedForYouCategory( |
179 | 97 | subcategory=self.subcategory) | 97 | subcategory=self.subcategory) |
180 | @@ -136,6 +136,12 @@ | |||
181 | 136 | ), | 136 | ), |
182 | 137 | } | 137 | } |
183 | 138 | 138 | ||
184 | 139 | TURN_ON_RECOMMENDATIONS_TEXT = _(u"Turn On Recommendations") | ||
185 | 140 | RECOMMENDATIONS_OPT_IN_TEXT = _(u"To make recommendations, " | ||
186 | 141 | "Ubuntu Software Center " | ||
187 | 142 | "will occasionally send to Canonical an anonymous list " | ||
188 | 143 | "of software currently installed.") | ||
189 | 144 | |||
190 | 139 | def __init__(self, catview): | 145 | def __init__(self, catview): |
191 | 140 | RecommendationsPanel.__init__(self, catview) | 146 | RecommendationsPanel.__init__(self, catview) |
192 | 141 | self.subcategory = None | 147 | self.subcategory = None |
193 | @@ -156,7 +162,7 @@ | |||
194 | 156 | self.add(self.recommended_for_you_content) | 162 | self.add(self.recommended_for_you_content) |
195 | 157 | 163 | ||
196 | 158 | # opt in button | 164 | # opt in button |
198 | 159 | button = Gtk.Button(_("Turn On Recommendations")) | 165 | button = Gtk.Button(self.TURN_ON_RECOMMENDATIONS_TEXT) |
199 | 160 | button.connect("clicked", self._on_opt_in_button_clicked) | 166 | button.connect("clicked", self._on_opt_in_button_clicked) |
200 | 161 | hbox = Gtk.Box(Gtk.Orientation.HORIZONTAL) | 167 | hbox = Gtk.Box(Gtk.Orientation.HORIZONTAL) |
201 | 162 | hbox.pack_start(button, False, False, 0) | 168 | hbox.pack_start(button, False, False, 0) |
202 | @@ -164,15 +170,16 @@ | |||
203 | 164 | self.opt_in_button = button # for tests | 170 | self.opt_in_button = button # for tests |
204 | 165 | 171 | ||
205 | 166 | # opt in text | 172 | # opt in text |
209 | 167 | text = _("To make recommendations, Ubuntu Software Center " | 173 | text = self.RECOMMENDATIONS_OPT_IN_TEXT |
207 | 168 | "will occasionally send to Canonical an anonymous list " | ||
208 | 169 | "of software currently installed.") | ||
210 | 170 | label = Gtk.Label(text) | 174 | label = Gtk.Label(text) |
211 | 171 | label.set_alignment(0, 0.5) | 175 | label.set_alignment(0, 0.5) |
212 | 172 | label.set_line_wrap(True) | 176 | label.set_line_wrap(True) |
213 | 173 | vbox.pack_start(label, False, False, 0) | 177 | vbox.pack_start(label, False, False, 0) |
214 | 174 | 178 | ||
215 | 175 | def _on_opt_in_button_clicked(self, button): | 179 | def _on_opt_in_button_clicked(self, button): |
216 | 180 | self.opt_in_to_recommendations_service() | ||
217 | 181 | |||
218 | 182 | def opt_in_to_recommendations_service(self): | ||
219 | 176 | # we upload the user profile here, and only after this is finished | 183 | # we upload the user profile here, and only after this is finished |
220 | 177 | # do we fire the request for recommendations and finally display | 184 | # do we fire the request for recommendations and finally display |
221 | 178 | # them here -- a spinner is shown for this process (the spec | 185 | # them here -- a spinner is shown for this process (the spec |
222 | @@ -180,6 +187,14 @@ | |||
223 | 180 | # progress info) | 187 | # progress info) |
224 | 181 | self._upload_user_profile_and_get_recommendations() | 188 | self._upload_user_profile_and_get_recommendations() |
225 | 182 | 189 | ||
226 | 190 | def opt_out_of_recommendations_service(self): | ||
227 | 191 | if self.recommended_for_you_content: | ||
228 | 192 | self.recommended_for_you_content.destroy() | ||
229 | 193 | self._show_opt_in_view() | ||
230 | 194 | self.remove_more_button() | ||
231 | 195 | self.show_all() | ||
232 | 196 | self.emit("recommendations-opt-out") | ||
233 | 197 | |||
234 | 183 | def _upload_user_profile_and_get_recommendations(self): | 198 | def _upload_user_profile_and_get_recommendations(self): |
235 | 184 | # initiate upload of the user profile here | 199 | # initiate upload of the user profile here |
236 | 185 | self._upload_user_profile() | 200 | self._upload_user_profile() |
237 | @@ -256,18 +271,42 @@ | |||
238 | 256 | self.hide() | 271 | self.hide() |
239 | 257 | 272 | ||
240 | 258 | 273 | ||
241 | 274 | class RecommendationsOptInDialog(Gtk.MessageDialog): | ||
242 | 275 | """ | ||
243 | 276 | Dialog to display the recommendations opt-in message when opt-in is | ||
244 | 277 | initiated from the menu. | ||
245 | 278 | """ | ||
246 | 279 | def __init__(self, icons): | ||
247 | 280 | Gtk.MessageDialog.__init__(self, flags=Gtk.DialogFlags.MODAL, | ||
248 | 281 | type=Gtk.MessageType.INFO) | ||
249 | 282 | self.set_title("") | ||
250 | 283 | icon_name = "softwarecenter" | ||
251 | 284 | if icons.has_icon(icon_name): | ||
252 | 285 | icon = Gtk.Image.new_from_icon_name(icon_name, | ||
253 | 286 | Gtk.IconSize.DIALOG) | ||
254 | 287 | self.set_image(icon) | ||
255 | 288 | icon.show() | ||
256 | 289 | self.format_secondary_text( | ||
257 | 290 | RecommendationsPanelLobby.RECOMMENDATIONS_OPT_IN_TEXT) | ||
258 | 291 | self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) | ||
259 | 292 | self.add_button(RecommendationsPanelLobby.TURN_ON_RECOMMENDATIONS_TEXT, | ||
260 | 293 | Gtk.ResponseType.YES) | ||
261 | 294 | self.set_default_response(Gtk.ResponseType.YES) | ||
262 | 295 | |||
263 | 296 | |||
264 | 259 | # test helpers | 297 | # test helpers |
266 | 260 | def get_test_window(): | 298 | def get_test_window(panel_type="lobby"): |
267 | 261 | import softwarecenter.log | 299 | import softwarecenter.log |
268 | 262 | softwarecenter.log.root.setLevel(level=logging.DEBUG) | 300 | softwarecenter.log.root.setLevel(level=logging.DEBUG) |
269 | 263 | fmt = logging.Formatter("%(name)s - %(message)s", None) | 301 | fmt = logging.Formatter("%(name)s - %(message)s", None) |
270 | 264 | softwarecenter.log.handler.setFormatter(fmt) | 302 | softwarecenter.log.handler.setFormatter(fmt) |
271 | 265 | 303 | ||
273 | 266 | # this is *way* to complicated we should *not* need a CatView | 304 | # this is *way* too complicated we should *not* need a CatView |
274 | 267 | # here! see FIXME in RecommendationsPanel.__init__() | 305 | # here! see FIXME in RecommendationsPanel.__init__() |
275 | 268 | from softwarecenter.ui.gtk3.views.catview_gtk import CategoriesViewGtk | 306 | from softwarecenter.ui.gtk3.views.catview_gtk import CategoriesViewGtk |
276 | 269 | from softwarecenter.testutils import ( | 307 | from softwarecenter.testutils import ( |
278 | 270 | get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache) | 308 | get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache, |
279 | 309 | get_test_categories) | ||
280 | 271 | cache = get_test_pkg_info() | 310 | cache = get_test_pkg_info() |
281 | 272 | db = get_test_db() | 311 | db = get_test_db() |
282 | 273 | icons = get_test_gtk3_icon_cache() | 312 | icons = get_test_gtk3_icon_cache() |
283 | @@ -277,7 +316,13 @@ | |||
284 | 277 | db, | 316 | db, |
285 | 278 | icons) | 317 | icons) |
286 | 279 | 318 | ||
288 | 280 | view = RecommendationsPanelLobby(catview) | 319 | if panel_type is "lobby": |
289 | 320 | view = RecommendationsPanelLobby(catview) | ||
290 | 321 | elif panel_type is "category": | ||
291 | 322 | cats = get_test_categories(db) | ||
292 | 323 | view = RecommendationsPanelCategory(catview, cats[0]) | ||
293 | 324 | else: # panel_type is "details": | ||
294 | 325 | view = RecommendationsPanelDetails(catview) | ||
295 | 281 | 326 | ||
296 | 282 | win = Gtk.Window() | 327 | win = Gtk.Window() |
297 | 283 | win.connect("destroy", lambda x: Gtk.main_quit()) | 328 | win.connect("destroy", lambda x: Gtk.main_quit()) |
298 | 284 | 329 | ||
299 | === modified file 'test/gtk3/test_recommendations_widgets.py' | |||
300 | --- test/gtk3/test_recommendations_widgets.py 2012-03-01 11:29:55 +0000 | |||
301 | +++ test/gtk3/test_recommendations_widgets.py 2012-03-19 01:17:20 +0000 | |||
302 | @@ -16,8 +16,20 @@ | |||
303 | 16 | 16 | ||
304 | 17 | class TestRecommendationsWidgets(unittest.TestCase): | 17 | class TestRecommendationsWidgets(unittest.TestCase): |
305 | 18 | 18 | ||
308 | 19 | def test_recommendations_widgets(self): | 19 | def test_recommendations_lobby(self): |
309 | 20 | win = get_test_window() | 20 | win = get_test_window(panel_type="lobby") |
310 | 21 | win.show_all() | ||
311 | 22 | GObject.timeout_add(TIMEOUT, lambda: win.destroy()) | ||
312 | 23 | Gtk.main() | ||
313 | 24 | |||
314 | 25 | def test_recommendations_category(self): | ||
315 | 26 | win = get_test_window(panel_type="category") | ||
316 | 27 | win.show_all() | ||
317 | 28 | GObject.timeout_add(TIMEOUT, lambda: win.destroy()) | ||
318 | 29 | Gtk.main() | ||
319 | 30 | |||
320 | 31 | def test_recommendations_details(self): | ||
321 | 32 | win = get_test_window(panel_type="details") | ||
322 | 21 | win.show_all() | 33 | win.show_all() |
323 | 22 | GObject.timeout_add(TIMEOUT, lambda: win.destroy()) | 34 | GObject.timeout_add(TIMEOUT, lambda: win.destroy()) |
324 | 23 | Gtk.main() | 35 | Gtk.main() |
Just a note that I factored the opt-in dialog code to its own class and added some new unit tests so that all of the recommendations panel widget types are tested now.