Merge lp:~elachuni/software-center/pep8-test-part12 into lp:software-center

Proposed by Anthony Lenton
Status: Merged
Merged at revision: 2855
Proposed branch: lp:~elachuni/software-center/pep8-test-part12
Merge into: lp:software-center
Prerequisite: lp:~elachuni/software-center/pep8-test-part11
Diff against target: 1394 lines (+287/-242)
6 files modified
softwarecenter/ui/gtk3/panes/availablepane.py (+99/-82)
softwarecenter/ui/gtk3/panes/basepane.py (+6/-8)
softwarecenter/ui/gtk3/panes/globalpane.py (+15/-11)
softwarecenter/ui/gtk3/panes/historypane.py (+44/-39)
softwarecenter/ui/gtk3/panes/installedpane.py (+122/-100)
test/test_pep8.py (+1/-2)
To merge this branch: bzr merge lp:~elachuni/software-center/pep8-test-part12
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+97552@code.launchpad.net

Description of the change

Made the remaining files in softwarecenter.ui.gtk3.panes pass the pep8 test.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

It's pep8 madness! Thank you, Anthony.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
2--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-03-06 22:10:15 +0000
3+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-03-15 01:02:25 +0000
4@@ -53,6 +53,7 @@
5
6 LOG = logging.getLogger(__name__)
7
8+
9 class AvailablePane(SoftwarePane):
10 """Widget that represents the available panel in software-center
11 It contains a search entry and navigation buttons
12@@ -60,10 +61,10 @@
13
14 class Pages():
15 # page names, useful for debugging
16- NAMES = ('lobby',
17+ NAMES = ('lobby',
18 'subcategory',
19 'list',
20- 'details',
21+ 'details',
22 'purchase',
23 )
24 # actual page id's
25@@ -75,17 +76,17 @@
26 # the default page
27 HOME = LOBBY
28
29- __gsignals__ = {'available-pane-created':(GObject.SignalFlags.RUN_FIRST,
30- None,
31- ())}
32+ __gsignals__ = {'available-pane-created': (GObject.SignalFlags.RUN_FIRST,
33+ None,
34+ ())}
35
36- def __init__(self,
37+ def __init__(self,
38 cache,
39- db,
40- distro,
41- icons,
42- datadir,
43- navhistory_back_action,
44+ db,
45+ distro,
46+ icons,
47+ datadir,
48+ navhistory_back_action,
49 navhistory_forward_action):
50 # parent
51 SoftwarePane.__init__(self, cache, db, distro, icons, datadir)
52@@ -100,21 +101,21 @@
53 self.current_app_by_category = {}
54 self.current_app_by_subcategory = {}
55 self.pane_name = _("Get Software")
56-
57+
58 # views to be created in init_view
59 self.cat_view = None
60 self.subcategories_view = None
61-
62+
63 # integrate with the Unity launcher
64 self.unity_launcher = UnityLauncher()
65-
66+
67 # flag to indicate whether applications should be added to the
68 # unity launcher when installed (this value is initialized by
69 # the config load in app.py)
70 self.add_to_launcher_enabled = True
71
72 def init_view(self):
73- if self.view_initialized:
74+ if self.view_initialized:
75 return
76
77 self.show_appview_spinner()
78@@ -134,21 +135,26 @@
79 #~ self.app_view._append_appcount(appcount)
80 #~ liststore.connect('appcount-changed', on_appcount_changed)
81 self.app_view.set_model(liststore)
82- liststore.connect(
83- "needs-refresh", lambda helper, pkgname: self.app_view.queue_draw())
84+ liststore.connect("needs-refresh",
85+ lambda helper, pkgname: self.app_view.queue_draw())
86
87 # purchase view
88 self.purchase_view = PurchaseView()
89 app_manager = get_appmanager()
90- app_manager.connect("purchase-requested", self.on_purchase_requested)
91- self.purchase_view.connect("purchase-succeeded", self.on_purchase_succeeded)
92- self.purchase_view.connect("purchase-failed", self.on_purchase_failed)
93- self.purchase_view.connect("purchase-cancelled-by-user", self.on_purchase_cancelled_by_user)
94- self.purchase_view.connect("purchase-needs-spinner", self.on_purchase_needs_spinner)
95+ app_manager.connect("purchase-requested",
96+ self.on_purchase_requested)
97+ self.purchase_view.connect("purchase-succeeded",
98+ self.on_purchase_succeeded)
99+ self.purchase_view.connect("purchase-failed",
100+ self.on_purchase_failed)
101+ self.purchase_view.connect("purchase-cancelled-by-user",
102+ self.on_purchase_cancelled_by_user)
103+ self.purchase_view.connect("purchase-needs-spinner",
104+ self.on_purchase_needs_spinner)
105
106 # categories, appview and details into the notebook in the bottom
107 self.scroll_categories = Gtk.ScrolledWindow()
108- self.scroll_categories.set_policy(Gtk.PolicyType.AUTOMATIC,
109+ self.scroll_categories.set_policy(Gtk.PolicyType.AUTOMATIC,
110 Gtk.PolicyType.AUTOMATIC)
111 self.cat_view = LobbyViewGtk(self.datadir, APP_INSTALL_PATH,
112 self.cache,
113@@ -156,16 +162,17 @@
114 self.icons,
115 self.apps_filter)
116 self.scroll_categories.add(self.cat_view)
117- self.notebook.append_page(self.scroll_categories, Gtk.Label(label="categories"))
118+ self.notebook.append_page(self.scroll_categories,
119+ Gtk.Label(label="categories"))
120
121 # sub-categories view
122 self.subcategories_view = SubCategoryViewGtk(self.datadir,
123- APP_INSTALL_PATH,
124- self.cache,
125- self.db,
126- self.icons,
127- self.apps_filter,
128- root_category=self.cat_view.categories[0])
129+ APP_INSTALL_PATH,
130+ self.cache,
131+ self.db,
132+ self.icons,
133+ self.apps_filter,
134+ root_category=self.cat_view.categories[0])
135 self.subcategories_view.connect(
136 "category-selected", self.on_subcategory_activated)
137 self.subcategories_view.connect(
138@@ -196,15 +203,19 @@
139 "application-activated", self.on_application_activated)
140
141 # details
142- self.notebook.append_page(self.scroll_details, Gtk.Label(label=NavButtons.DETAILS))
143+ self.notebook.append_page(self.scroll_details,
144+ Gtk.Label(label=NavButtons.DETAILS))
145
146 # purchase view
147- self.notebook.append_page(self.purchase_view, Gtk.Label(label=NavButtons.PURCHASE))
148+ self.notebook.append_page(self.purchase_view,
149+ Gtk.Label(label=NavButtons.PURCHASE))
150
151 # install backend
152- self.backend.connect("transactions-changed", self._on_transactions_changed)
153- self.backend.connect("transaction-started", self.on_transaction_started)
154-
155+ self.backend.connect("transactions-changed",
156+ self._on_transactions_changed)
157+ self.backend.connect("transaction-started",
158+ self.on_transaction_started)
159+
160 # now we are initialized
161 self.searchentry.set_sensitive(True)
162 self.emit("available-pane-created")
163@@ -230,7 +241,6 @@
164 vm.display_page(
165 self, AvailablePane.Pages.PURCHASE, self.state,
166 self.display_purchase)
167- return
168
169 def on_purchase_needs_spinner(self, appmanager, active):
170 vm = get_viewmanager()
171@@ -239,14 +249,14 @@
172 def on_purchase_succeeded(self, widget):
173 # switch to the details page to display the transaction is in progress
174 self._return_to_appdetails_view()
175-
176+
177 def on_purchase_failed(self, widget):
178 self._return_to_appdetails_view()
179 dialogs.error(None,
180 _("Failure in the purchase process."),
181 _("Sorry, something went wrong. Your payment "
182 "has been cancelled."))
183-
184+
185 def on_purchase_cancelled_by_user(self, widget):
186 self._return_to_appdetails_view()
187
188@@ -307,15 +317,16 @@
189 #~ def _show_hide_subcategories(self, show_category_applist=False):
190 #~ # check if have subcategories and are not in a subcategory
191 #~ # view - if so, show it
192- #~ if (self.notebook.get_current_page() == AvailablePane.Pages.LOBBY or
193- #~ self.notebook.get_current_page() == AvailablePane.Pages.DETAILS):
194+ #~ current_page = self.notebook.get_current_page()
195+ #~ if (current_page == AvailablePane.Pages.LOBBY or
196+ #~ current_page == AvailablePane.Pages.DETAILS):
197 #~ return
198 #~ if (not show_category_applist and
199 #~ self.state.category and
200 #~ self.state.category.subcategories and
201 #~ not (self.state.search_term or self.state.subcategory)):
202 #~ self.subcategories_view.set_subcategory(self.state.category,
203- #~ num_items=len(self.app_view.get_model()))
204+ #~ num_items=len(self.app_view.get_model()))
205 #~ self.notebook.set_current_page(AvailablePane.Pages.SUBCATEGORY)
206 #~ else:
207 #~ self.notebook.set_current_page(AvailablePane.Pages.LIST)
208@@ -326,7 +337,8 @@
209 return None
210 else:
211 if self.state.subcategory:
212- return self.current_app_by_subcategory.get(self.state.subcategory)
213+ return self.current_app_by_subcategory.get(
214+ self.state.subcategory)
215 else:
216 return self.current_app_by_category.get(self.state.category)
217
218@@ -336,11 +348,10 @@
219 return self.state.subcategory
220 elif self.state.category:
221 return self.state.category
222- return None
223
224 def unset_current_category(self):
225- """ unset the current showing category, but keep e.g. the current
226- search
227+ """ unset the current showing category, but keep e.g. the current
228+ search
229 """
230
231 self.state.category = None
232@@ -352,14 +363,14 @@
233 """
234 if self._is_custom_list_search(self.state.search_term):
235 self._update_action_bar()
236-
237- def on_transaction_started(self, backend, pkgname, appname, trans_id,
238+
239+ def on_transaction_started(self, backend, pkgname, appname, trans_id,
240 trans_type):
241 self._add_application_to_unity_launcher(
242 backend, pkgname, appname, trans_id, trans_type)
243
244- def _add_application_to_unity_launcher(self, backend, pkgname,
245- appname, trans_id,
246+ def _add_application_to_unity_launcher(self, backend, pkgname,
247+ appname, trans_id,
248 trans_type):
249 if not self.add_to_launcher_enabled:
250 return
251@@ -370,7 +381,7 @@
252 # we only care about installs
253 if not trans_type == TransactionTypes.INSTALL:
254 return
255-
256+
257 app = Application(pkgname=pkgname, appname=appname)
258 appdetails = app.get_details(self.db)
259 # we only add items to the launcher that have a desktop file
260@@ -385,9 +396,11 @@
261
262 # now gather up the unity launcher info items and send the app to the
263 # launcher service
264- launcher_info = self._get_unity_launcher_info(app, appdetails, trans_id)
265- self.unity_launcher.send_application_to_launcher(pkgname, launcher_info)
266-
267+ launcher_info = self._get_unity_launcher_info(app, appdetails,
268+ trans_id)
269+ self.unity_launcher.send_application_to_launcher(pkgname,
270+ launcher_info)
271+
272 def _get_unity_launcher_info(self, app, appdetails, trans_id):
273 (icon_size, icon_x, icon_y) = (
274 self._get_onscreen_icon_details_for_launcher_service(app))
275@@ -426,10 +439,10 @@
276 self._update_action_bar_buttons()
277
278 def _update_action_bar_buttons(self):
279- '''
280- update buttons in the action bar to implement the custom package lists feature,
281- see https://wiki.ubuntu.com/SoftwareCenter#Custom%20package%20lists
282- '''
283+ """Update buttons in the action bar to implement the custom package
284+ lists feature, see
285+ https://wiki.ubuntu.com/SoftwareCenter#Custom%20package%20lists
286+ """
287 if self._is_custom_list_search(self.state.search_term):
288 installable = []
289 for doc in self.enquirer.get_documents():
290@@ -439,9 +452,10 @@
291 not len(self.backend.pending_transactions) > 0):
292 app = Application(pkgname=pkgname)
293 installable.append(app)
294- button_text = gettext.ngettext("Install %(amount)s Item",
295- "Install %(amount)s Items",
296- len(installable)) % { 'amount': len(installable), }
297+ button_text = gettext.ngettext(
298+ "Install %(amount)s Item",
299+ "Install %(amount)s Items",
300+ len(installable)) % {'amount': len(installable)}
301 button = self.action_bar.get_button(ActionButtons.INSTALL)
302 if button and installable:
303 # Install all already offered. Update offer.
304@@ -457,7 +471,7 @@
305 else:
306 # Ensure button is removed.
307 self.action_bar.remove_button(ActionButtons.INSTALL)
308-
309+
310 def _install_current_appstore(self):
311 '''
312 Function that installs all applications displayed in the pane.
313@@ -478,17 +492,17 @@
314 self.backend.install_multiple(pkgnames, appnames, iconnames)
315
316 def set_state(self, nav_item):
317- return
318+ pass
319
320 def _clear_search(self):
321 self.searchentry.clear_with_no_signal()
322 self.apps_limit = 0
323 self.apps_search_term = ""
324-
325+
326 def _is_custom_list_search(self, search_term):
327- return (search_term and
328+ return (search_term and
329 ',' in search_term)
330-
331+
332 # callbacks
333 def on_cache_ready(self, cache):
334 """ refresh the application list when the cache is re-opened """
335@@ -502,7 +516,7 @@
336 LOG.debug("on_search_terms_changed: %s" % new_text)
337
338 self.state.search_term = new_text
339-
340+
341 # do not hide technical items for a custom list search
342 if self._is_custom_list_search(self.state.search_term):
343 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
344@@ -527,7 +541,7 @@
345 self.display_app_view_page)
346 return False
347
348- elif (self.state.category and
349+ elif (self.state.category and
350 self.state.category.subcategories and not new_text):
351 vm.display_page(self,
352 AvailablePane.Pages.SUBCATEGORY,
353@@ -632,13 +646,12 @@
354 SoftwarePane.display_details_page(self, page, view_state)
355 self.cat_view.stop_carousels()
356 return True
357-
358+
359 def display_purchase(self, page, view_state):
360 self.notebook.set_current_page(AvailablePane.Pages.PURCHASE)
361 self.action_bar.clear()
362 self.cat_view.stop_carousels()
363- return
364-
365+
366 def display_previous_purchases(self, page, view_state):
367 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
368 self.app_view.set_header_labels(_("Previous Purchases"), None)
369@@ -648,7 +661,6 @@
370 self.refresh_apps(query=self.previous_purchases_query)
371 self.action_bar.clear()
372 self.cat_view.stop_carousels()
373- return
374
375 def on_subcategory_activated(self, subcat_view, category):
376 LOG.debug("on_subcategory_activated: %s %s" % (
377@@ -713,13 +725,14 @@
378 """ Return True if we are in the category page or if we display a
379 sub-category page
380 """
381- return (self.notebook.get_current_page() == AvailablePane.Pages.LOBBY or \
382- self.notebook.get_current_page() == AvailablePane.Pages.SUBCATEGORY)
383+ current_page = self.notebook.get_current_page()
384+ return (current_page == AvailablePane.Pages.LOBBY or
385+ current_page == AvailablePane.Pages.SUBCATEGORY)
386
387 def is_applist_view_showing(self):
388 """Return True if we are in the applist view """
389 return self.notebook.get_current_page() == AvailablePane.Pages.LIST
390-
391+
392 def is_app_details_view_showing(self):
393 """Return True if we are in the app_details view """
394 return self.notebook.get_current_page() == AvailablePane.Pages.DETAILS
395@@ -739,12 +752,14 @@
396 if not self.state.filter:
397 self.state.filter = AppFilter(self.db, self.cache)
398
399- if category and category.flags and 'available-only' in category.flags:
400+ if (category and category.flags and
401+ 'available-only' in category.flags):
402 self.state.filter.set_available_only(True)
403 else:
404 self.state.filter.set_available_only(False)
405
406- if category and category.flags and 'not-installed-only' in category.flags:
407+ if (category and category.flags and
408+ 'not-installed-only' in category.flags):
409 self.state.filter.set_not_installed_only(True)
410 else:
411 self.state.filter.set_not_installed_only(False)
412@@ -769,7 +784,7 @@
413 )
414 # needed because available pane will try to get it
415 vm = get_test_gtk3_viewmanager()
416- vm # make pyflakes happy
417+ vm # make pyflakes happy
418 db = get_test_db()
419 cache = get_test_pkg_info()
420 datadir = get_test_datadir()
421@@ -780,17 +795,20 @@
422 from softwarecenter.ui.gtk3.session.appmanager import ApplicationManager
423 ApplicationManager(db, backend, icons)
424
425- navhistory_back_action = Gtk.Action("navhistory_back_action", "Back", "Back", None)
426- navhistory_forward_action = Gtk.Action("navhistory_forward_action", "Forward", "Forward", None)
427+ navhistory_back_action = Gtk.Action("navhistory_back_action", "Back",
428+ "Back", None)
429+ navhistory_forward_action = Gtk.Action("navhistory_forward_action",
430+ "Forward", "Forward", None)
431
432- w = AvailablePane(cache, db, 'Ubuntu', icons, datadir, navhistory_back_action, navhistory_forward_action)
433+ w = AvailablePane(cache, db, 'Ubuntu', icons, datadir,
434+ navhistory_back_action, navhistory_forward_action)
435 w.init_view()
436 w.show()
437
438 win = Gtk.Window()
439 win.connect("destroy", Gtk.main_quit)
440 win.add(w)
441- win.set_size_request(800,600)
442+ win.set_size_request(800, 600)
443 win.show_all()
444
445 # this is used later in tests
446@@ -801,4 +819,3 @@
447 if __name__ == "__main__":
448 win = get_test_window()
449 Gtk.main()
450-
451
452=== modified file 'softwarecenter/ui/gtk3/panes/basepane.py'
453--- softwarecenter/ui/gtk3/panes/basepane.py 2011-08-18 17:42:33 +0000
454+++ softwarecenter/ui/gtk3/panes/basepane.py 2012-03-15 01:02:25 +0000
455@@ -18,8 +18,8 @@
456
457
458 class BasePane(object):
459- """ Base for all the View widgets that can be registered in a
460- ViewManager
461+ """ Base for all the View widgets that can be registered in a
462+ ViewManager
463 """
464
465 def __init__(self):
466@@ -31,16 +31,16 @@
467
468 def is_category_view_showing(self):
469 return False
470-
471+
472 def is_applist_view_showing(self):
473 return False
474-
475+
476 def is_app_details_view_showing(self):
477 return False
478
479 def get_current_app(self):
480- return None
481-
482+ pass
483+
484 def init_view(self):
485 """
486 A callback that is made at the time the pane is selected in the
487@@ -50,5 +50,3 @@
488 is to optimize startup time performance.
489 """
490 pass
491-
492-
493
494=== modified file 'softwarecenter/ui/gtk3/panes/globalpane.py'
495--- softwarecenter/ui/gtk3/panes/globalpane.py 2012-02-16 11:23:52 +0000
496+++ softwarecenter/ui/gtk3/panes/globalpane.py 2012-03-15 01:02:25 +0000
497@@ -4,12 +4,12 @@
498 from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager
499 from softwarecenter.ui.gtk3.panes.viewswitcher import ViewSwitcher
500
501+
502 def _widget_set_margins(widget, top=0, bottom=0, left=0, right=0):
503 widget.set_margin_top(top)
504 widget.set_margin_bottom(bottom)
505 widget.set_margin_left(left)
506 widget.set_margin_right(right)
507- return
508
509
510 class GlobalPane(Gtk.Toolbar):
511@@ -20,10 +20,12 @@
512 context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
513
514 # add nav history back/forward buttons...
515- # note: this is hacky, would be much nicer to make the custom self/right
516- # buttons in BackForwardButton to be Gtk.Activatable/Gtk.Widgets, then wire in the
517- # actions using e.g. self.navhistory_back_action.connect_proxy(self.back_forward.left),
518- # but couldn't seem to get this to work..so just wire things up directly
519+ # note: this is hacky, would be much nicer to make the custom
520+ # self/right buttons in BackForwardButton to be
521+ # Gtk.Activatable/Gtk.Widgets, then wire in the actions using e.g.
522+ # self.navhistory_back_action.connect_proxy(self.back_forward.left),
523+ # but couldn't seem to get this to work..so just wire things up
524+ # directly
525 vm = get_viewmanager()
526 self.back_forward = vm.get_global_backforward()
527 self.back_forward.set_vexpand(False)
528@@ -31,14 +33,17 @@
529
530 if self.get_direction() != Gtk.TextDirection.RTL:
531 _widget_set_margins(self.back_forward,
532- left=StockEms.MEDIUM, right=StockEms.MEDIUM+2)
533+ left=StockEms.MEDIUM,
534+ right=StockEms.MEDIUM + 2)
535 else:
536 _widget_set_margins(self.back_forward,
537- right=StockEms.MEDIUM, left=StockEms.MEDIUM+2)
538+ right=StockEms.MEDIUM,
539+ left=StockEms.MEDIUM + 2)
540 self._insert_as_tool_item(self.back_forward, 0)
541
542 # this is what actually draws the All Software, Installed etc buttons
543- self.view_switcher = ViewSwitcher(view_manager, datadir, db, cache, icons)
544+ self.view_switcher = ViewSwitcher(view_manager, datadir, db, cache,
545+ icons)
546 self._insert_as_tool_item(self.view_switcher, 1)
547
548 item = Gtk.ToolItem()
549@@ -58,7 +63,6 @@
550 _widget_set_margins(self.searchentry, right=StockEms.MEDIUM)
551 else:
552 _widget_set_margins(self.searchentry, left=StockEms.MEDIUM)
553- return
554
555 def _insert_as_tool_item(self, widget, pos):
556 item = Gtk.ToolItem()
557@@ -84,7 +88,7 @@
558 p = GlobalPane(vm, datadir, db, cache, icons)
559
560 win = Gtk.Window()
561- win.set_size_request(400,200)
562+ win.set_size_request(400, 200)
563 win.set_data("pane", p)
564 win.connect("destroy", Gtk.main_quit)
565 win.add(p)
566@@ -94,5 +98,5 @@
567 if __name__ == "__main__":
568
569 win = get_test_window()
570-
571+
572 Gtk.main()
573
574=== modified file 'softwarecenter/ui/gtk3/panes/historypane.py'
575--- softwarecenter/ui/gtk3/panes/historypane.py 2012-03-01 11:32:37 +0000
576+++ softwarecenter/ui/gtk3/panes/historypane.py 2012-03-15 01:02:25 +0000
577@@ -31,16 +31,17 @@
578 from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager
579 from softwarepane import DisplayState
580
581+
582 class HistoryPane(Gtk.VBox, BasePane):
583
584 __gsignals__ = {
585- "app-list-changed" : (GObject.SignalFlags.RUN_LAST,
586- None,
587- (int, ),
588- ),
589- "history-pane-created" : (GObject.SignalFlags.RUN_FIRST,
590- None,
591- ()),
592+ "app-list-changed": (GObject.SignalFlags.RUN_LAST,
593+ None,
594+ (int, ),
595+ ),
596+ "history-pane-created": (GObject.SignalFlags.RUN_FIRST,
597+ None,
598+ ()),
599 }
600
601 (COL_WHEN, COL_ACTION, COL_PKG) = range(3)
602@@ -50,7 +51,7 @@
603
604 ICON_SIZE = 32
605 PADDING = 6
606-
607+
608 # pages for the spinner notebook
609 (PAGE_HISTORY_VIEW,
610 PAGE_SPINNER) = range(2)
611@@ -84,12 +85,14 @@
612 self.toolbar.set_style(Gtk.ToolbarStyle.TEXT)
613 self.pack_start(self.toolbar, False, True, 0)
614
615- all_action = Gtk.RadioAction('filter_all', _('All Changes'), None, None, self.ALL)
616+ all_action = Gtk.RadioAction('filter_all', _('All Changes'), None,
617+ None, self.ALL)
618 all_action.connect('changed', self.change_filter)
619 all_button = all_action.create_tool_item()
620 self.toolbar.insert(all_button, 0)
621
622- installs_action = Gtk.RadioAction('filter_installs', _('Installations'), None, None, self.INSTALLED)
623+ installs_action = Gtk.RadioAction('filter_installs',
624+ _('Installations'), None, None, self.INSTALLED)
625 installs_action.join_group(all_action)
626 installs_button = installs_action.create_tool_item()
627 self.toolbar.insert(installs_button, 1)
628@@ -118,11 +121,11 @@
629 Gtk.PolicyType.AUTOMATIC)
630 self.history_view.show()
631 self.history_view.add(self.view)
632-
633+
634 # make a spinner to display while history is loading
635 self.spinner_notebook = SpinnerNotebook(
636 self.history_view, _('Loading history'))
637-
638+
639 self.pack_start(self.spinner_notebook, True, True, 0)
640
641 self.store = Gtk.TreeStore(*self.COL_TYPES)
642@@ -132,7 +135,7 @@
643 self.view.set_model(self.store_filter)
644 all_action.set_active(True)
645 self.last = None
646-
647+
648 # to save (a lot of) time at startup we load history later, only when
649 # it is selected to be viewed
650 self.history = None
651@@ -145,14 +148,14 @@
652 self.cell_text = Gtk.CellRendererText()
653 self.column.pack_start(self.cell_text, True)
654 self.column.set_cell_data_func(self.cell_text, self.render_cell_text)
655-
656+
657 # busy cursor
658 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
659
660 def init_view(self):
661 if self.history == None:
662- # if the history is not yet initialized we have to load and parse it
663- # show a spinner while we do that
664+ # if the history is not yet initialized we have to load and parse
665+ # it show a spinner while we do that
666 self.realize()
667 window = self.get_window()
668 window.set_cursor(self.busy_cursor)
669@@ -171,9 +174,8 @@
670 cr.set_source_rgba(color.red, color.green, color.blue, 0.5)
671 cr.set_line_width(1)
672 cr.move_to(0.5, a.height - 0.5)
673- cr.rel_line_to(a.width-1, 0)
674+ cr.rel_line_to(a.width - 1, 0)
675 cr.stroke()
676- return
677
678 def _get_emblems(self, icons):
679 from softwarecenter.enums import USE_PACKAGEKIT_BACKEND
680@@ -189,7 +191,6 @@
681 for i, emblem in enumerate(emblem_names):
682 pb = icons.load_icon(emblem, self.ICON_SIZE, 0)
683 self._emblems[i + 1] = pb
684- return
685
686 def _set_actions_sensitive(self, sensitive):
687 for action in self._actions_list:
688@@ -198,11 +199,12 @@
689 def _reset_icon_cache(self, theme=None):
690 self._app_icon_cache.clear()
691 try:
692- missing = self.icons.load_icon(Icons.MISSING_APP, self.ICON_SIZE, 0)
693+ missing = self.icons.load_icon(Icons.MISSING_APP, self.ICON_SIZE,
694+ 0)
695 except GObject.GError:
696 missing = None
697 self._app_icon_cache[Icons.MISSING_APP] = missing
698-
699+
700 def load_and_parse_history(self):
701 from softwarecenter.db.history import get_pkg_history
702 self.history = get_pkg_history()
703@@ -234,7 +236,7 @@
704 date = when.date()
705 day = self.store.append(None, (date, self.ALL, None))
706 last_row = None
707- actions = {self.INSTALLED: trans.install,
708+ actions = {self.INSTALLED: trans.install,
709 self.REMOVED: trans.remove,
710 self.UPGRADED: trans.upgrade,
711 }
712@@ -247,11 +249,11 @@
713
714 def get_current_page(self):
715 # single page views can return None here
716- return None
717+ pass
718
719 def get_callback_for_page(self, page, state):
720 # single page views can return None here
721- return None
722+ pass
723
724 def on_search_terms_changed(self, entry, terms):
725 self.update_view()
726@@ -277,20 +279,20 @@
727
728 # Compute the number of visible changes
729 # don't do this atm - the spec doesn't mention that the history pane
730- # should have a status text and it gives us a noticable performance gain
731- # if we don't calculate this
732+ # should have a status text and it gives us a noticable performance
733+ # gain if we don't calculate this
734 # self.visible_changes = 0
735 # day = self.store_filter.get_iter_first()
736 # while day is not None:
737 # self.visible_changes += self.store_filter.iter_n_children(day)
738 # day = self.store_filter.iter_next(day)
739-
740+
741 # Expand the most recent day
742 day = self.store.get_iter_first()
743 if day is not None:
744- path = self.store.get_path(day)
745- self.view.expand_row(path, False)
746- self.view.scroll_to_cell(path)
747+ path = self.store.get_path(day)
748+ self.view.expand_row(path, False)
749+ self.view.scroll_to_cell(path)
750
751 # self.emit('app-list-changed', self.visible_changes)
752
753@@ -327,7 +329,6 @@
754 action = store.get_value(iter, self.COL_ACTION)
755 cell.set_property('pixbuf', self._emblems[action])
756
757-
758 #~ icon_name = Icons.MISSING_APP
759 #~ for m in self.db.xapiandb.postlist("AP" + pkg):
760 #~ doc = self.db.xapiandb.get_document(m.docid)
761@@ -339,11 +340,11 @@
762 #~ icon = self._app_icon_cache[icon_name]
763 #~ else:
764 #~ try:
765- #~ icon = self.icons.load_icon(icon_name, self.ICON_SIZE, 0)
766+ #~ icon = self.icons.load_icon(icon_name, self.ICON_SIZE,
767+ #~ 0)
768 #~ except GObject.GError:
769 #~ icon = self._app_icon_cache[Icons.MISSING_APP]
770 #~ self._app_icon_cache[icon_name] = icon
771-
772
773 def render_cell_text(self, column, cell, store, iter, user_data):
774 when = store.get_value(iter, self.COL_WHEN)
775@@ -352,15 +353,20 @@
776 pkg = store.get_value(iter, self.COL_PKG)
777 subs = {'pkgname': pkg,
778 'color': '#8A8A8A',
779- # Translators : time displayed in history, display hours (0-12), minutes and AM/PM. %H should be used instead of %I to display hours 0-24
780+ # Translators : time displayed in history, display hours
781+ # (0-12), minutes and AM/PM. %H should be used instead
782+ # of %I to display hours 0-24
783 'time': when.time().strftime(_('%I:%M %p')),
784 }
785 if action == self.INSTALLED:
786- text = _('%(pkgname)s <span color="%(color)s">installed %(time)s</span>') % subs
787+ text = _('%(pkgname)s <span color="%(color)s">'
788+ 'installed %(time)s</span>') % subs
789 elif action == self.REMOVED:
790- text = _('%(pkgname)s <span color="%(color)s">removed %(time)s</span>') % subs
791+ text = _('%(pkgname)s <span color="%(color)s">'
792+ 'removed %(time)s</span>') % subs
793 elif action == self.UPGRADED:
794- text = _('%(pkgname)s <span color="%(color)s">updated %(time)s</span>') % subs
795+ text = _('%(pkgname)s <span color="%(color)s">'
796+ 'updated %(time)s</span>') % subs
797 elif isinstance(when, datetime.date):
798 today = datetime.date.today()
799 monday = today - datetime.timedelta(days=today.weekday())
800@@ -388,7 +394,7 @@
801 )
802 # needed because available pane will try to get it
803 vm = get_test_gtk3_viewmanager()
804- vm # make pyflakes happy
805+ vm # make pyflakes happy
806 db = get_test_db()
807 cache = get_test_pkg_info()
808 icons = get_test_gtk3_icon_cache()
809@@ -409,4 +415,3 @@
810 if __name__ == '__main__':
811 win = get_test_window()
812 Gtk.main()
813-
814
815=== modified file 'softwarecenter/ui/gtk3/panes/installedpane.py'
816--- softwarecenter/ui/gtk3/panes/installedpane.py 2012-03-08 14:08:27 +0000
817+++ softwarecenter/ui/gtk3/panes/installedpane.py 2012-03-15 01:02:25 +0000
818@@ -45,7 +45,8 @@
819 from softwarecenter.db.appfilter import AppFilter
820 from softwarecenter.paths import APP_INSTALL_PATH
821
822-LOG=logging.getLogger(__name__)
823+LOG = logging.getLogger(__name__)
824+
825
826 def interrupt_build_and_wait(f):
827 """ decorator that ensures that a build of the categorised installed apps
828@@ -79,19 +80,20 @@
829 DETAILS) = range(2)
830 # the default page
831 HOME = LIST
832-
833+
834 # pages for the installed view spinner notebook
835 (PAGE_SPINNER,
836 PAGE_INSTALLED) = range(2)
837
838- __gsignals__ = {'installed-pane-created':(GObject.SignalFlags.RUN_FIRST,
839- None,
840- ())}
841+ __gsignals__ = {'installed-pane-created': (GObject.SignalFlags.RUN_FIRST,
842+ None,
843+ ())}
844
845 def __init__(self, cache, db, distro, icons, datadir):
846
847 # parent
848- SoftwarePane.__init__(self, cache, db, distro, icons, datadir, show_ratings=False)
849+ SoftwarePane.__init__(self, cache, db, distro, icons, datadir,
850+ show_ratings=False)
851 CategoriesParser.__init__(self, db)
852
853 self.current_appview_selection = None
854@@ -111,36 +113,42 @@
855 self._halt_build = False
856
857 self.nonapps_visible = NonAppVisibility.NEVER_VISIBLE
858-
859+
860 self.visible_docids = None
861 self.visible_cats = {}
862-
863+
864 self.installed_spinner_notebook = None
865
866 def init_view(self):
867- if self.view_initialized:
868+ if self.view_initialized:
869 return
870
871 SoftwarePane.init_view(self)
872-
873- # show a busy cursor and display the main spinner while we build the view
874+
875+ # show a busy cursor and display the main spinner while we build the
876+ # view
877 window = self.get_window()
878 if window:
879 window.set_cursor(self.busy_cursor)
880 self.show_appview_spinner()
881-
882+
883 self.oneconf_viewpickler = OneConfViews(self.icons)
884- self.oneconf_viewpickler.register_computer(None, _("This computer (%s)") % platform.node())
885+ self.oneconf_viewpickler.register_computer(None,
886+ _("This computer (%s)") % platform.node())
887 self.oneconf_viewpickler.select_first()
888- self.oneconf_viewpickler.connect('computer-changed', self._selected_computer_changed)
889- self.oneconf_viewpickler.connect('current-inventory-refreshed', self._current_inventory_need_refresh)
890-
891+ self.oneconf_viewpickler.connect('computer-changed',
892+ self._selected_computer_changed)
893+ self.oneconf_viewpickler.connect('current-inventory-refreshed',
894+ self._current_inventory_need_refresh)
895+
896 # Start OneConf
897 self.oneconf_handler = get_oneconf_handler(self.oneconf_viewpickler)
898 if self.oneconf_handler:
899- self.oneconf_handler.connect('show-oneconf-changed', self._show_oneconf_changed)
900- self.oneconf_handler.connect('last-time-sync-changed', self._last_time_sync_oneconf_changed)
901-
902+ self.oneconf_handler.connect('show-oneconf-changed',
903+ self._show_oneconf_changed)
904+ self.oneconf_handler.connect('last-time-sync-changed',
905+ self._last_time_sync_oneconf_changed)
906+
907 # OneConf pane
908 self.computerpane = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
909 self.oneconfcontrol = Gtk.Box()
910@@ -154,14 +162,18 @@
911 scroll.set_shadow_type(Gtk.ShadowType.IN)
912 scroll.add(self.oneconf_viewpickler)
913 self.oneconfcontrol.pack_start(scroll, True, True, 0)
914-
915+
916 oneconftoolbar = Gtk.Box()
917 oneconftoolbar.set_orientation(Gtk.Orientation.HORIZONTAL)
918 oneconfpropertymenu = Gtk.Menu()
919- self.oneconfproperty = MenuButton(oneconfpropertymenu, Gtk.Image.new_from_stock(Gtk.STOCK_PROPERTIES, Gtk.IconSize.BUTTON))
920+ self.oneconfproperty = MenuButton(oneconfpropertymenu,
921+ Gtk.Image.new_from_stock(Gtk.STOCK_PROPERTIES,
922+ Gtk.IconSize.BUTTON))
923 self.stopsync_label = _(u"Stop Syncing “%s”")
924- stop_oneconf_share_menuitem = Gtk.MenuItem(label=self.stopsync_label % platform.node())
925- stop_oneconf_share_menuitem.connect("activate", self._on_stop_oneconf_hostshare_clicked)
926+ stop_oneconf_share_menuitem = Gtk.MenuItem(
927+ label=self.stopsync_label % platform.node())
928+ stop_oneconf_share_menuitem.connect("activate",
929+ self._on_stop_oneconf_hostshare_clicked)
930 stop_oneconf_share_menuitem.show()
931 oneconfpropertymenu.append(stop_oneconf_share_menuitem)
932 self.oneconfcontrol.pack_start(oneconftoolbar, False, False, 1)
933@@ -173,7 +185,8 @@
934 self.notebook.append_page(self.box_app_list, Gtk.Label(label="list"))
935
936 # details
937- self.notebook.append_page(self.scroll_details, Gtk.Label(label="details"))
938+ self.notebook.append_page(self.scroll_details,
939+ Gtk.Label(label="details"))
940 # initial refresh
941 self.state.search_term = ""
942
943@@ -184,25 +197,26 @@
944 self.treefilter.set_visible_func(self._row_visibility_func,
945 AppTreeStore.COL_ROW_DATA)
946 self.app_view.set_model(self.treefilter)
947- self.app_view.tree_view.connect("row-collapsed", self._on_row_collapsed)
948+ self.app_view.tree_view.connect("row-collapsed",
949+ self._on_row_collapsed)
950
951 self._all_cats = self.parse_applications_menu(APP_INSTALL_PATH)
952 self._all_cats = categories_sorted_by_name(self._all_cats)
953-
954+
955 # we do not support the search aid feature in the installedview
956 self.box_app_list.remove(self.search_aid)
957
958 # remove here
959- self.box_app_list.remove(self.app_view)
960+ self.box_app_list.remove(self.app_view)
961
962 # create a local spinner notebook for the installed view
963 self.installed_spinner_notebook = SpinnerNotebook(self.app_view)
964-
965+
966 self.computerpane.pack2(self.installed_spinner_notebook, True, True)
967 self.show_installed_view_spinner()
968-
969+
970 self.show_all()
971-
972+
973 # initialize view to hide the oneconf computer selector
974 self.oneconf_viewpickler.select_first()
975 self.oneconfcontrol.hide()
976@@ -214,15 +228,15 @@
977
978 # now we are initialized
979 self.emit("installed-pane-created")
980-
981+
982 self.view_initialized = True
983 return False
984-
985+
986 def show_installed_view_spinner(self):
987 """ display the local spinner for the installed view panel """
988 if self.installed_spinner_notebook:
989 self.installed_spinner_notebook.show_spinner()
990-
991+
992 def hide_installed_view_spinner(self):
993 """ hide the local spinner for the installed view panel """
994 if self.installed_spinner_notebook:
995@@ -236,15 +250,17 @@
996 self.current_hostname = hostname
997 menuitem = self.oneconfproperty.get_menu().get_children()[0]
998 if self.current_hostid:
999- (self.oneconf_additional_pkg, self.oneconf_missing_pkg) = self.oneconf_handler.oneconf.diff(self.current_hostid, '')
1000+ diff = self.oneconf_handler.oneconf.diff(self.current_hostid, '')
1001+ self.oneconf_additional_pkg, self.oneconf_missing_pkg = diff
1002 stopsync_hostname = self.current_hostname
1003 # FIXME for P: oneconf views don't support search
1004- if self.state.search_term:
1005+ if self.state.search_term:
1006 self._search()
1007 else:
1008 stopsync_hostname = platform.node()
1009 self.searchentry.show()
1010- menuitem.set_label(self.stopsync_label % stopsync_hostname.encode('utf-8'))
1011+ menuitem.set_label(self.stopsync_label %
1012+ stopsync_hostname.encode('utf-8'))
1013 self.refresh_apps()
1014
1015 def _last_time_sync_oneconf_changed(self, oneconf_handler, msg):
1016@@ -266,14 +282,15 @@
1017 if self.current_hostid:
1018 self.oneconf_viewpickler.remove_computer(self.current_hostid)
1019 self.oneconf_viewpickler.select_first()
1020-
1021+
1022 def _current_inventory_need_refresh(self, oneconfviews):
1023 if self.current_hostid:
1024- (self.oneconf_additional_pkg, self.oneconf_missing_pkg) = self.oneconf_handler.oneconf.diff(self.current_hostid, '')
1025+ diff = self.oneconf_handler.oneconf.diff(self.current_hostid, '')
1026+ self.oneconf_additional_pkg, self.oneconf_missing_pkg = diff
1027 self.refresh_apps()
1028
1029 def _on_row_collapsed(self, view, it, path):
1030- return
1031+ pass
1032
1033 def _row_visibility_func(self, model, it, col):
1034 row = model.get_value(it, col)
1035@@ -285,16 +302,18 @@
1036 elif isinstance(row, CategoryRowReference):
1037 return row.untranslated_name in self.visible_cats.keys()
1038
1039- elif row is None: return False
1040+ elif row is None:
1041+ return False
1042
1043 return row.get_docid() in self.visible_docids
1044
1045 def _use_category(self, cat):
1046 # System cat is large and slow to search, filter it in default mode
1047
1048- if ('carousel-only' in cat.flags or
1049+ if ('carousel-only' in cat.flags or
1050 ((self.nonapps_visible == NonAppVisibility.NEVER_VISIBLE)
1051- and cat.untranslated_name == 'System')): return False
1052+ and cat.untranslated_name == 'System')):
1053+ return False
1054
1055 return True
1056
1057@@ -306,14 +325,14 @@
1058 #~ @interrupt_build_and_wait
1059 def _build_categorised_installedview(self):
1060 LOG.debug('Rebuilding categorised installedview...')
1061-
1062+
1063 # display the busy cursor and a local spinner while we build the view
1064 window = self.get_window()
1065 if window:
1066 window.set_cursor(self.busy_cursor)
1067 self.show_installed_view_spinner()
1068-
1069- model = self.base_model # base model not treefilter
1070+
1071+ model = self.base_model # base model not treefilter
1072 model.clear()
1073
1074 def profiled_rebuild_categorised_view():
1075@@ -323,28 +342,30 @@
1076 def rebuild_categorised_view():
1077 self.cat_docid_map = {}
1078 enq = self.enquirer
1079-
1080+
1081 i = 0
1082-
1083+
1084 while Gtk.events_pending():
1085 Gtk.main_iteration()
1086
1087 xfilter = AppFilter(self.db, self.cache)
1088 xfilter.set_installed_only(True)
1089-
1090+
1091 for cat in self._all_cats:
1092 # for each category do category query and append as a new
1093 # node to tree_view
1094- if not self._use_category(cat): continue
1095+ if not self._use_category(cat):
1096+ continue
1097 query = self.get_query_for_cat(cat)
1098- LOG.debug("xfilter.installed_only: %s" % xfilter.installed_only)
1099+ LOG.debug("xfilter.installed_only: %s" %
1100+ xfilter.installed_only)
1101 enq.set_query(query,
1102 sortmode=SortMethods.BY_ALPHABET,
1103 nonapps_visible=self.nonapps_visible,
1104 filter=xfilter,
1105 nonblocking_load=False,
1106- persistent_duplicate_filter=(i>0))
1107-
1108+ persistent_duplicate_filter=(i > 0))
1109+
1110 L = len(enq.matches)
1111 if L:
1112 i += L
1113@@ -352,13 +373,13 @@
1114 self.cat_docid_map[cat.untranslated_name] = \
1115 set([doc.get_docid() for doc in docs])
1116 model.set_category_documents(cat, docs)
1117-
1118+
1119 while Gtk.events_pending():
1120 Gtk.main_iteration()
1121
1122 # check for uncategorised pkgs
1123 if self.state.channel:
1124- self._run_channel_enquirer(persistent_duplicate_filter=(i>0))
1125+ self._run_channel_enquirer(persistent_duplicate_filter=(i > 0))
1126 L = len(enq.matches)
1127 if L:
1128 # some foo for channels
1129@@ -369,7 +390,8 @@
1130 channel_name = self.state.channel.display_name
1131 docs = enq.get_documents()
1132 tag = channel_name or 'Uncategorized'
1133- self.cat_docid_map[tag] = set([doc.get_docid() for doc in docs])
1134+ self.cat_docid_map[tag] = set(
1135+ [doc.get_docid() for doc in docs])
1136 model.set_nocategory_documents(docs, untranslated_name=tag,
1137 display_name=channel_name)
1138 i += L
1139@@ -382,14 +404,15 @@
1140
1141 # cache the installed app count
1142 self.installed_count = i
1143- self.app_view._append_appcount(self.installed_count, mode=AppView.INSTALLED_MODE)
1144-
1145+ self.app_view._append_appcount(self.installed_count,
1146+ mode=AppView.INSTALLED_MODE)
1147+
1148 # hide the local spinner
1149 self.hide_installed_view_spinner()
1150-
1151+
1152 if window:
1153 window.set_cursor(None)
1154-
1155+
1156 # reapply search if needed
1157 if self.state.search_term:
1158 self._do_search(self.state.search_term)
1159@@ -398,18 +421,17 @@
1160 return
1161
1162 GObject.idle_add(profiled_rebuild_categorised_view)
1163- return
1164-
1165+
1166 def _build_oneconfview(self):
1167 LOG.debug('Rebuilding oneconfview for %s...' % self.current_hostid)
1168-
1169+
1170 # display the busy cursor and the local spinner while we build the view
1171 window = self.get_window()
1172 if window:
1173 window.set_cursor(self.busy_cursor)
1174 self.show_installed_view_spinner()
1175-
1176- model = self.base_model # base model not treefilter
1177+
1178+ model = self.base_model # base model not treefilter
1179 model.clear()
1180
1181 def profiled_rebuild_oneconfview():
1182@@ -417,10 +439,10 @@
1183 rebuild_oneconfview()
1184
1185 def rebuild_oneconfview():
1186-
1187+
1188 # FIXME for P: hide the search entry
1189 self.searchentry.hide()
1190-
1191+
1192 self.cat_docid_map = {}
1193 enq = self.enquirer
1194 query = xapian.Query("")
1195@@ -430,30 +452,33 @@
1196 self.state.channel.query)
1197
1198 i = 0
1199-
1200+
1201 # First search: missing apps only
1202 xfilter = AppFilter(self.db, self.cache)
1203 xfilter.set_restricted_list(self.oneconf_additional_pkg)
1204 xfilter.set_not_installed_only(True)
1205-
1206+
1207 enq.set_query(query,
1208 sortmode=SortMethods.BY_ALPHABET,
1209 nonapps_visible=self.nonapps_visible,
1210 filter=xfilter,
1211- nonblocking_load=True, # we don't block this one for better oneconf responsiveness
1212- persistent_duplicate_filter=(i>0))
1213+ nonblocking_load=True, # we don't block this one for
1214+ # better oneconf responsiveness
1215+ persistent_duplicate_filter=(i > 0))
1216
1217 L = len(enq.matches)
1218
1219 if L:
1220- cat_title = utf8(ngettext(u'%(amount)s item on “%(machine)s” not on this computer',
1221- u'%(amount)s items on “%(machine)s” not on this computer',
1222- L)) % { 'amount' : L, 'machine': utf8(self.current_hostname)}
1223+ cat_title = utf8(ngettext(
1224+ u'%(amount)s item on “%(machine)s” not on this computer',
1225+ u'%(amount)s items on “%(machine)s” not on this computer',
1226+ L)) % {'amount': L, 'machine': utf8(self.current_hostname)}
1227 i += L
1228 docs = enq.get_documents()
1229- self.cat_docid_map["missingpkg"] = set([doc.get_docid() for doc in docs])
1230- model.set_nocategory_documents(docs, untranslated_name="additionalpkg",
1231- display_name=cat_title)
1232+ self.cat_docid_map["missingpkg"] = set(
1233+ [doc.get_docid() for doc in docs])
1234+ model.set_nocategory_documents(docs,
1235+ untranslated_name="additionalpkg", display_name=cat_title)
1236
1237 # Second search: additional apps
1238 xfilter.set_restricted_list(self.oneconf_missing_pkg)
1239@@ -464,18 +489,20 @@
1240 nonapps_visible=self.nonapps_visible,
1241 filter=xfilter,
1242 nonblocking_load=False,
1243- persistent_duplicate_filter=(i>0))
1244+ persistent_duplicate_filter=(i > 0))
1245
1246 L = len(enq.matches)
1247 if L:
1248- cat_title = utf8(ngettext(u'%(amount)s item on this computer not on “%(machine)s”',
1249- '%(amount)s items on this computer not on “%(machine)s”',
1250- L)) % { 'amount' : L, 'machine': utf8(self.current_hostname)}
1251+ cat_title = utf8(ngettext(
1252+ u'%(amount)s item on this computer not on “%(machine)s”',
1253+ '%(amount)s items on this computer not on “%(machine)s”',
1254+ L)) % {'amount': L, 'machine': utf8(self.current_hostname)}
1255 i += L
1256 docs = enq.get_documents()
1257- self.cat_docid_map["additionalpkg"] = set([doc.get_docid() for doc in docs])
1258- model.set_nocategory_documents(docs, untranslated_name="additionalpkg",
1259- display_name=cat_title)
1260+ self.cat_docid_map["additionalpkg"] = set(
1261+ [doc.get_docid() for doc in docs])
1262+ model.set_nocategory_documents(docs,
1263+ untranslated_name="additionalpkg", display_name=cat_title)
1264
1265 if i:
1266 self.app_view.tree_view.set_cursor(Gtk.TreePath(),
1267@@ -485,31 +512,30 @@
1268
1269 # cache the installed app count
1270 self.installed_count = i
1271- self.app_view._append_appcount(self.installed_count, mode=AppView.DIFF_MODE)
1272-
1273+ self.app_view._append_appcount(self.installed_count,
1274+ mode=AppView.DIFF_MODE)
1275+
1276 # hide the local spinner
1277 self.hide_installed_view_spinner()
1278-
1279+
1280 if window:
1281 window.set_cursor(None)
1282-
1283+
1284 self.emit("app-list-changed", i)
1285 return
1286
1287 GObject.idle_add(profiled_rebuild_oneconfview)
1288- return
1289
1290 def _check_expand(self):
1291 it = self.treefilter.get_iter_first()
1292 while it:
1293 path = self.treefilter.get_path(it)
1294- if self.state.search_term:# or path in self._user_expanded_paths:
1295+ if self.state.search_term: # or path in self._user_expanded_paths:
1296 self.app_view.tree_view.expand_row(path, False)
1297 else:
1298 self.app_view.tree_view.collapse_row(path)
1299
1300 it = self.treefilter.iter_next(it)
1301- return
1302
1303 def _do_search(self, terms):
1304 self.state.search_term = terms
1305@@ -519,7 +545,7 @@
1306 nonapps_visible=self.nonapps_visible,
1307 filter=xfilter,
1308 nonblocking_load=True)
1309-
1310+
1311 self.visible_docids = self.enquirer.get_docids()
1312 self.visible_cats = self._get_vis_cats(self.visible_docids)
1313 self.treefilter.refilter()
1314@@ -551,7 +577,6 @@
1315 self.emit("app-list-changed", 0)
1316 elif self.state.search_term != terms:
1317 self._do_search(terms)
1318- return
1319
1320 def get_query(self):
1321 # search terms
1322@@ -575,7 +600,6 @@
1323 self._build_oneconfview()
1324 else:
1325 self._build_categorised_installedview()
1326- return
1327
1328 def _clear_search(self):
1329 # remove the details and clear the search
1330@@ -589,7 +613,6 @@
1331 self.state.search_term = terms
1332 self.notebook.set_current_page(InstalledPane.Pages.LIST)
1333 self.hide_installed_view_spinner()
1334- return
1335
1336 def _get_vis_cats(self, visids):
1337 vis_cats = {}
1338@@ -626,7 +649,7 @@
1339 def display_overview_page(self, page, view_state):
1340 LOG.debug("view_state: %s" % view_state)
1341 if self.current_hostid:
1342- # FIXME for P: oneconf views don't support search
1343+ # FIXME for P: oneconf views don't support search
1344 # this one ensure that even when switching between pane, we
1345 # don't have the search item
1346 if self.state.search_term:
1347@@ -643,16 +666,16 @@
1348 """return the current active application object applicable
1349 to the context"""
1350 return self.current_appview_selection
1351-
1352+
1353 def is_category_view_showing(self):
1354 # there is no category view in the installed pane
1355 return False
1356-
1357+
1358 def is_applist_view_showing(self):
1359 """Return True if we are in the applist view """
1360 return (self.notebook.get_current_page() ==
1361 InstalledPane.Pages.LIST)
1362-
1363+
1364 def is_app_details_view_showing(self):
1365 """Return True if we are in the app_details view """
1366 return self.notebook.get_current_page() == InstalledPane.Pages.DETAILS
1367@@ -667,7 +690,7 @@
1368 )
1369 # needed because available pane will try to get it
1370 vm = get_test_gtk3_viewmanager()
1371- vm # make pyflakes happy
1372+ vm # make pyflakes happy
1373 db = get_test_db()
1374 cache = get_test_pkg_info()
1375 datadir = get_test_datadir()
1376@@ -696,4 +719,3 @@
1377 if __name__ == "__main__":
1378 win = get_test_window()
1379 Gtk.main()
1380-
1381
1382=== modified file 'test/test_pep8.py'
1383--- test/test_pep8.py 2012-03-15 01:02:25 +0000
1384+++ test/test_pep8.py 2012-03-15 01:02:25 +0000
1385@@ -22,8 +22,7 @@
1386 softwarecenter.ui.gtk3.views,
1387 softwarecenter.ui.gtk3.widgets,
1388 softwarecenter.db.pkginfo_impl]
1389- exclude = ['availablepane.py', 'basepane.py', 'globalpane.py',
1390- 'historypane.py', 'installedpane.py']
1391+ exclude = []
1392
1393 def message(self, text):
1394 self.errors.append(text)