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

Proposed by Anthony Lenton
Status: Merged
Merged at revision: 2854
Proposed branch: lp:~elachuni/software-center/pep8-test-part11
Merge into: lp:software-center
Prerequisite: lp:~elachuni/software-center/pep8-test-part10
Diff against target: 1071 lines (+162/-148)
8 files modified
softwarecenter/ui/gtk3/panes/pendingpane.py (+7/-6)
softwarecenter/ui/gtk3/panes/softwarepane.py (+37/-41)
softwarecenter/ui/gtk3/panes/unused__channelpane.py (+33/-30)
softwarecenter/ui/gtk3/panes/viewswitcher.py (+17/-17)
softwarecenter/ui/gtk3/session/appmanager.py (+25/-18)
softwarecenter/ui/gtk3/session/navhistory.py (+17/-16)
softwarecenter/ui/gtk3/session/viewmanager.py (+20/-19)
test/test_pep8.py (+6/-1)
To merge this branch: bzr merge lp:~elachuni/software-center/pep8-test-part11
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+97547@code.launchpad.net

Description of the change

Made all files from softwarecenter.ui.gtk3.session and a few from 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 :

Thanks, 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/pendingpane.py'
2--- softwarecenter/ui/gtk3/panes/pendingpane.py 2011-10-06 02:53:27 +0000
3+++ softwarecenter/ui/gtk3/panes/pendingpane.py 2012-03-15 00:20:29 +0000
4@@ -30,7 +30,7 @@
5
6
7 class PendingPane(Gtk.ScrolledWindow, BasePane):
8-
9+
10 CANCEL_XPAD = StockEms.MEDIUM
11 CANCEL_YPAD = StockEms.MEDIUM
12
13@@ -64,14 +64,14 @@
14 tp.set_property("xpad", self.CANCEL_XPAD)
15 tp.set_property("ypad", self.CANCEL_YPAD)
16 tp.set_property("text", "")
17- column = Gtk.TreeViewColumn("Progress", tp,
18+ column = Gtk.TreeViewColumn("Progress", tp,
19 value=PendingStore.COL_PROGRESS,
20 pulse=PendingStore.COL_PULSE)
21 column.set_min_width(200)
22 self.tv.append_column(column)
23 # cancel icon
24 tpix = Gtk.CellRendererPixbuf()
25- column = Gtk.TreeViewColumn("Cancel", tpix,
26+ column = Gtk.TreeViewColumn("Cancel", tpix,
27 stock_id=PendingStore.COL_CANCEL)
28 self.tv.append_column(column)
29 # fake columns that eats the extra space at the end
30@@ -81,7 +81,7 @@
31 # add it
32 store = PendingStore(icons)
33 self.tv.set_model(store)
34-
35+
36 def _on_button_pressed(self, widget, event):
37 """button press handler to capture clicks on the cancel button"""
38 #print "_on_clicked: ", event
39@@ -100,7 +100,7 @@
40 # not cancelable (no icon)
41 model = self.tv.get_model()
42 if model[path][PendingStore.COL_CANCEL] == "":
43- return
44+ return
45 # get tid
46 tid = model[path][PendingStore.COL_TID]
47 trans = model._transactions_watcher.get_transaction(tid)
48@@ -125,6 +125,7 @@
49 def get_callback_for_page(self, page_id, view_state):
50 return None
51
52+
53 def get_test_window():
54
55 from softwarecenter.testutils import get_test_gtk3_icon_cache
56@@ -139,7 +140,7 @@
57 win = Gtk.Window()
58 win.add(scroll)
59 view.grab_focus()
60- win.set_size_request(500,200)
61+ win.set_size_request(500, 200)
62 win.show_all()
63 win.connect("destroy", Gtk.main_quit)
64
65
66=== modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py'
67--- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-02-28 13:51:20 +0000
68+++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-03-15 00:20:29 +0000
69@@ -78,15 +78,16 @@
70 self.filter = None
71 self.previous_purchases_query = None
72 self.vadjustment = 0.0
73- return
74
75 def __setattr__(self, name, val):
76 attrs = self._attrs
77 if name not in attrs:
78- raise AttributeError("The attr name \"%s\" is not permitted" % name)
79+ raise AttributeError("The attr name \"%s\" is not permitted" %
80+ name)
81 Gtk.main_quit()
82 if not isinstance(val, attrs[name]):
83- msg = "Attribute %s expects %s, got %s" % (name, attrs[name], type(val))
84+ msg = "Attribute %s expects %s, got %s" % (name, attrs[name],
85+ type(val))
86 raise TypeError(msg)
87 Gtk.main_quit()
88 return object.__setattr__(self, name, val)
89@@ -124,7 +125,7 @@
90 self.limit = 0
91 #~ self.filter = None
92 self.vadjustment = 0.0
93- return
94+
95
96 class SoftwarePane(Gtk.VBox, BasePane):
97 """ Common base class for AvailablePane and InstalledPane"""
98@@ -136,10 +137,10 @@
99 SPINNER = 2
100
101 __gsignals__ = {
102- "app-list-changed" : (GObject.SignalFlags.RUN_LAST,
103- None,
104- (int,),
105- ),
106+ "app-list-changed": (GObject.SignalFlags.RUN_LAST,
107+ None,
108+ (int,),
109+ ),
110 }
111 PADDING = 6
112
113@@ -148,7 +149,7 @@
114 Gtk.VBox.__init__(self)
115 BasePane.__init__(self)
116
117- # other classes we need
118+ # other classes we need
119 self.enquirer = AppEnquire(cache, db)
120 self._query_complete_handler = self.enquirer.connect(
121 "query-complete", self.on_query_complete)
122@@ -189,7 +190,7 @@
123
124 # cursor
125 self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
126-
127+
128 # views to be created in init_view
129 self.app_view = None
130 self.app_details_view = None
131@@ -200,7 +201,7 @@
132 SoftwarePane. Note that this method is intended to be called by
133 the subclass itself at the start of its own init_view() implementation.
134 """
135- # common UI elements (applist and appdetails)
136+ # common UI elements (applist and appdetails)
137 # its the job of the Child class to put it into a good location
138 # list
139 self.box_app_list = Gtk.VBox()
140@@ -211,23 +212,24 @@
141
142 self.app_view = AppView(self.db, self.cache,
143 self.icons, self.show_ratings)
144- self.app_view.connect("sort-method-changed", self.on_app_view_sort_method_changed)
145+ self.app_view.connect("sort-method-changed",
146+ self.on_app_view_sort_method_changed)
147
148 self.init_atk_name(self.app_view, "app_view")
149 self.box_app_list.pack_start(self.app_view, True, True, 0)
150- self.app_view.connect("application-selected",
151+ self.app_view.connect("application-selected",
152 self.on_application_selected)
153- self.app_view.connect("application-activated",
154+ self.app_view.connect("application-activated",
155 self.on_application_activated)
156-
157+
158 # details
159 self.scroll_details = Gtk.ScrolledWindow()
160- self.scroll_details.set_policy(Gtk.PolicyType.AUTOMATIC,
161+ self.scroll_details.set_policy(Gtk.PolicyType.AUTOMATIC,
162 Gtk.PolicyType.AUTOMATIC)
163- self.app_details_view = AppDetailsView(self.db,
164+ self.app_details_view = AppDetailsView(self.db,
165 self.distro,
166- self.icons,
167- self.cache,
168+ self.icons,
169+ self.cache,
170 self.datadir)
171 self.app_details_view.connect(
172 "different-application-selected", self.on_application_activated)
173@@ -246,7 +248,7 @@
174 """ init the atk name for a given gtk widget based on parent-pane
175 and variable name (used for the mago tests)
176 """
177- name = self.__class__.__name__ + "." + name
178+ name = self.__class__.__name__ + "." + name
179 Atk.Object.set_name(widget.get_accessible(), name)
180
181 def on_cache_ready(self, cache):
182@@ -254,7 +256,7 @@
183 LOG.debug("on_cache_ready")
184 # it only makes sense to refresh if there is something to
185 # refresh, otherwise we create a bunch of (not yet needed)
186- # AppStore objects on startup when the cache sends its
187+ # AppStore objects on startup when the cache sends its
188 # initial "cache-ready" signal
189 model = self.app_view.tree_view.get_model()
190 if model is None:
191@@ -270,7 +272,8 @@
192 self.state.application = app
193
194 vm = get_viewmanager()
195- vm.display_page(self, SoftwarePane.Pages.DETAILS, self.state, self.display_details_page)
196+ vm.display_page(self, SoftwarePane.Pages.DETAILS, self.state,
197+ self.display_details_page)
198
199 def show_app(self, app):
200 self.on_application_activated(None, app)
201@@ -288,7 +291,6 @@
202 self.app_view.display_matches(enquirer.matches,
203 self._is_in_search_mode())
204 self.hide_appview_spinner()
205- return
206
207 def on_app_view_sort_method_changed(self, app_view, combo):
208 if app_view.get_sort_mode() == self.enquirer.sortmode:
209@@ -298,7 +300,6 @@
210 app_view.clear_model()
211 query = self.get_query()
212 self._refresh_apps_with_apt_cache(query)
213- return
214
215 def _is_in_search_mode(self):
216 return (self.state.search_term and
217@@ -311,7 +312,7 @@
218 if not self.state.search_term:
219 self.action_bar.clear()
220 self.spinner_notebook.show_spinner()
221-
222+
223 def hide_appview_spinner(self):
224 """ hide the spinner and display the appview in the panel """
225 LOG.debug("hide_appview_spinner")
226@@ -320,11 +321,9 @@
227 def set_section(self, section):
228 self.section = section
229 self.app_details_view.set_section(section)
230- return
231
232 def section_sync(self):
233 self.app_details_view.set_section(self.section)
234- return
235
236 def on_app_list_changed(self, pane, length):
237 """internal helper that keeps the the action bar up-to-date by
238@@ -333,12 +332,10 @@
239
240 self.show_nonapps_if_required(len(self.enquirer.matches))
241 self.search_aid.update_search_help(self.state)
242- return
243
244 def hide_nonapps(self):
245 """ hide non-applications control in the action bar """
246 self.action_bar.unset_label()
247- return
248
249 def show_nonapps_if_required(self, length):
250 """
251@@ -360,7 +357,7 @@
252 return
253
254 LOG.debug("nonapps_visible value=%s (always visible: %s)" % (
255- self.nonapps_visible,
256+ self.nonapps_visible,
257 self.nonapps_visible == NonAppVisibility.ALWAYS_VISIBLE))
258
259 self.action_bar.unset_label()
260@@ -370,13 +367,13 @@
261 # In most/all languages you will want the whole string as a link
262 label = gettext.ngettext("_Hide %(amount)i technical item_",
263 "_Hide %(amount)i technical items_",
264- n_pkgs) % { 'amount': n_pkgs, }
265+ n_pkgs) % {'amount': n_pkgs}
266 self.action_bar.set_label(
267- label, link_result=self._hide_nonapp_pkgs)
268+ label, link_result=self._hide_nonapp_pkgs)
269 else:
270 label = gettext.ngettext("_Show %(amount)i technical item_",
271 "_Show %(amount)i technical items_",
272- n_pkgs) % { 'amount': n_pkgs, }
273+ n_pkgs) % {'amount': n_pkgs}
274 self.action_bar.set_label(
275 label, link_result=self._show_nonapp_pkgs)
276
277@@ -388,7 +385,7 @@
278 self.unset_current_category()
279 self.refresh_apps()
280 elif uri.startswith("search-parent:"):
281- self.apps_subcategory = None;
282+ self.apps_subcategory = None
283 self.refresh_apps()
284 elif uri.startswith("search-unsupported:"):
285 self.apps_filter.set_supported_only(False)
286@@ -424,7 +421,7 @@
287 return channel_query
288 # ... otherwise show all
289 return xapian.Query("")
290-
291+
292 def refresh_apps(self, query=None):
293 """refresh the applist and update the navigation bar """
294 LOG.debug("refresh_apps")
295@@ -461,7 +458,6 @@
296 exact=self.is_custom_list(),
297 nonapps_visible=self.nonapps_visible,
298 filter=self.state.filter)
299- return
300
301 def display_details_page(self, page, view_state):
302 self.app_details_view.show_app(view_state.application)
303@@ -486,11 +482,11 @@
304 def get_sort_mode(self):
305 # if the category sets a custom sort order, that wins, this
306 # is required for top-rated and whats-new
307- if (self.state.category and
308+ if (self.state.category and
309 self.state.category.sortmode != SortMethods.BY_ALPHABET):
310 return self.state.category.sortmode
311 # searches are always by ranking unless the user decided differently
312- if (self._is_in_search_mode() and
313+ if (self._is_in_search_mode() and
314 not self.app_view.user_defined_sort_method):
315 return SortMethods.BY_SEARCH_RANKING
316 # use the appview combo
317@@ -520,15 +516,15 @@
318 def is_category_view_showing(self):
319 " stub implementation "
320 pass
321-
322+
323 def is_applist_view_showing(self):
324 " stub implementation "
325 pass
326-
327+
328 def is_app_details_view_showing(self):
329 " stub implementation "
330 pass
331-
332+
333 def get_current_app(self):
334 " stub implementation "
335 pass
336
337=== modified file 'softwarecenter/ui/gtk3/panes/unused__channelpane.py'
338--- softwarecenter/ui/gtk3/panes/unused__channelpane.py 2011-08-10 07:35:53 +0000
339+++ softwarecenter/ui/gtk3/panes/unused__channelpane.py 2012-03-15 00:20:29 +0000
340@@ -37,6 +37,7 @@
341
342 LOG = logging.getLogger(__name__)
343
344+
345 class ChannelPane(SoftwarePane):
346 """Widget that represents the channel pane for display of
347 individual channels (PPAs, partner repositories, etc.)
348@@ -47,10 +48,10 @@
349 (PAGE_APPLIST,
350 PAGE_APP_DETAILS,
351 PAGE_APP_PURCHASE) = range(3)
352-
353- __gsignals__ = {'channel-pane-created':(GObject.SignalFlags.RUN_FIRST,
354- None,
355- ())}
356+
357+ __gsignals__ = {'channel-pane-created': (GObject.SignalFlags.RUN_FIRST,
358+ None,
359+ ())}
360
361 def __init__(self, cache, db, distro, icons, datadir):
362 # parent
363@@ -66,11 +67,14 @@
364 def init_view(self):
365 if not self.view_initialized:
366 SoftwarePane.init_view(self)
367- self.notebook.append_page(self.box_app_list, Gtk.Label(label="channel"))
368+ self.notebook.append_page(self.box_app_list,
369+ Gtk.Label(label="channel"))
370 # details
371- self.notebook.append_page(self.scroll_details, Gtk.Label(label="details"))
372+ self.notebook.append_page(self.scroll_details,
373+ Gtk.Label(label="details"))
374 # purchase view
375- self.notebook.append_page(self.purchase_view, Gtk.Label(label="purchase"))
376+ self.notebook.append_page(self.purchase_view,
377+ Gtk.Label(label="purchase"))
378 # now we are initialized
379 self.emit("channel-pane-created")
380 self.show_all()
381@@ -82,7 +86,7 @@
382 self.navigation_bar.remove_ids(NavButtons.PURCHASE)
383 self.notebook.set_current_page(self.PAGE_APPLIST)
384 self.searchentry.show()
385-
386+
387 def _clear_search(self):
388 # remove the details and clear the search
389 self.searchentry.clear()
390@@ -109,7 +113,7 @@
391 dialog.set_title("")
392 dialog.set_markup("<big><b>%s</b></big>" % _("Add channel"))
393 dialog.format_secondary_text(_("The selected channel is not yet "
394- "added. Do you want to add it now?"))
395+ "added. Do you want to add it now?"))
396 dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
397 Gtk.STOCK_ADD, Gtk.ResponseType.YES)
398 res = dialog.run()
399@@ -130,7 +134,7 @@
400 self.apps_filter.set_installed_only(True)
401 # switch to applist, this will clear searches too
402 self.display_list()
403-
404+
405 def on_search_terms_changed(self, searchentry, terms):
406 """callback when the search entry widget changes"""
407 LOG.debug("on_search_terms_changed: '%s'" % terms)
408@@ -139,7 +143,7 @@
409 self._clear_search()
410 self.refresh_apps()
411 self.notebook.set_current_page(self.PAGE_APPLIST)
412-
413+
414 def on_db_reopen(self, db):
415 LOG.debug("got db-reopen signal")
416 self.refresh_apps()
417@@ -154,7 +158,7 @@
418 if not button.get_active():
419 return
420 self.display_list()
421-
422+
423 def display_list(self):
424 self._clear_search()
425 self._show_channel_overview()
426@@ -168,7 +172,7 @@
427 if not button.get_active():
428 return
429 self.display_details()
430-
431+
432 def display_details(self):
433 self.navigation_bar.remove_ids(NavButtons.PURCHASE)
434 self.notebook.set_current_page(self.PAGE_APP_DETAILS)
435@@ -176,20 +180,21 @@
436 self.action_bar.clear()
437 # we want to re-enable the buy button if this is an app for purchase
438 # FIXME: hacky, find a better approach
439- if self.app_details_view.pkg_statusbar.button.get_label() == _(u'Buy\u2026'):
440- self.app_details_view.pkg_statusbar.button.set_sensitive(True)
441-
442+ button = self.app_details_view.pkg_statusbar.button
443+ if button.get_label() == _(u'Buy\u2026'):
444+ button.set_sensitive(True)
445+
446 def on_navigation_purchase(self, button, part):
447 """callback when the navigation button with id 'purchase' is clicked"""
448 if not button.get_active():
449 return
450 self.display_purchase()
451-
452+
453 def display_purchase(self):
454 self.notebook.set_current_page(self.PAGE_APP_PURCHASE)
455 self.searchentry.hide()
456 self.action_bar.clear()
457-
458+
459 def on_application_selected(self, appview, app):
460 """callback when an app is selected"""
461 LOG.debug("on_application_selected: '%s'" % app)
462@@ -204,7 +209,7 @@
463 length = len(self.app_view.get_model())
464 self.emit("app-list-changed", length)
465 self.searchentry.show()
466-
467+
468 def get_status_text(self):
469 """return user readable status text suitable for a status bar"""
470 # no status text in the details page
471@@ -219,34 +224,34 @@
472 if len(self.searchentry.get_text()) > 0:
473 return gettext.ngettext("%(amount)s matching item",
474 "%(amount)s matching items",
475- length) % { 'amount' : length, }
476+ length) % {'amount': length}
477 else:
478 return gettext.ngettext("%(amount)s item installed",
479 "%(amount)s items installed",
480- length) % { 'amount' : length, }
481+ length) % {'amount': length}
482 else:
483 if len(self.searchentry.get_text()) > 0:
484 return gettext.ngettext("%(amount)s matching item",
485 "%(amount)s matching items",
486- length) % { 'amount' : length, }
487+ length) % {'amount': length}
488 else:
489 return gettext.ngettext("%(amount)s item available",
490 "%(amount)s items available",
491- length) % { 'amount' : length, }
492-
493+ length) % {'amount': length}
494+
495 def get_current_app(self):
496 """return the current active application object applicable
497 to the context"""
498 return self.current_appview_selection
499-
500+
501 def is_category_view_showing(self):
502 # there is no category view in the channel pane
503 return False
504-
505+
506 def is_applist_view_showing(self):
507 """Return True if we are in the applist view """
508 return self.notebook.get_current_page() == self.PAGE_APPLIST
509-
510+
511 def is_app_details_view_showing(self):
512 """Return True if we are in the app_details view """
513 return self.notebook.get_current_page() == self.PAGE_APP_DETAILS
514@@ -288,14 +293,13 @@
515 db.open()
516 except xapian.DatabaseCorruptError as e:
517 logging.exception("xapian open failed")
518- dialogs.error(None,
519+ dialogs.error(None,
520 _("Sorry, can not open the software database"),
521 _("Please re-install the 'software-center' "
522 "package."))
523 # FIXME: force rebuild by providing a dbus service for this
524 sys.exit(1)
525
526-
527 import softwarecenter.distro
528 distro = softwarecenter.distro.get_distro()
529
530@@ -310,4 +314,3 @@
531 win.connect("destroy", Gtk.main_quit)
532
533 Gtk.main()
534-
535
536=== modified file 'softwarecenter/ui/gtk3/panes/viewswitcher.py'
537--- softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-02-20 15:59:17 +0000
538+++ softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-03-15 00:20:29 +0000
539@@ -38,6 +38,8 @@
540
541
542 _last_button = None
543+
544+
545 class ViewSwitcher(Gtk.Box):
546
547 ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
548@@ -45,6 +47,7 @@
549 def __init__(self, view_manager, datadir, db, cache, icons):
550 # boring stuff
551 self.view_manager = view_manager
552+
553 def on_view_changed(widget, view_id):
554 self.view_buttons[view_id].set_active(True)
555 self.view_manager.connect('view-changed', on_view_changed)
556@@ -70,7 +73,6 @@
557 self._prev_item = None # track the previous active menu-item
558 self._handlers = []
559
560-
561 # order is important here!
562 # first, the availablepane items
563 icon = SymbolicIcon("available")
564@@ -112,13 +114,14 @@
565 else:
566 self.stop_icon_animation()
567 pending_btn = self.view_buttons[ViewPages.PENDING]
568- from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager
569+ from softwarecenter.ui.gtk3.session.viewmanager import (
570+ get_viewmanager,
571+ )
572 vm = get_viewmanager()
573 if vm.get_active_view() == 'view-page-pending':
574 vm.nav_back()
575 vm.clear_forward_history()
576 pending_btn.set_visible(False)
577- return
578
579 def start_icon_animation(self):
580 # the pending button ProgressImage is special, see:
581@@ -135,9 +138,8 @@
582 image.set_transaction_count(count)
583
584 def on_transaction_finished(self, backend, result):
585- if result.success:
586+ if result.success:
587 self.on_channels_changed()
588- return
589
590 def on_section_sel_clicked(self, button, event, view_id):
591 # mvo: this check causes bug LP: #828675
592@@ -166,7 +168,6 @@
593
594 self._prev_view = view_id
595 GObject.idle_add(config_view)
596- return
597
598 def on_get_available_channels(self, popup):
599 return self.build_channel_list(popup, ViewPages.AVAILABLE)
600@@ -179,7 +180,6 @@
601 # setting popup to None will cause a rebuild of the popup
602 # menu the next time the selector is clicked
603 sel.popup = None
604- return
605
606 def append_section(self, view_id, label, icon):
607 btn = SectionSelector(label, icon, self.ICON_SIZE)
608@@ -196,7 +196,8 @@
609 # to the group, toggled & clicked gets emitted... causing
610 # all panes to fully initialise on USC startup, which is
611 # undesirable!
612- btn.connect("button-release-event", self.on_section_sel_clicked, view_id)
613+ btn.connect("button-release-event", self.on_section_sel_clicked,
614+ view_id)
615 return btn
616
617 def append_channel_selector(self, section_btn, view_id, build_func):
618@@ -206,7 +207,8 @@
619 self.pack_start(sel, False, False, 0)
620 return sel
621
622- def append_section_with_channel_sel(self, view_id, label, icon, build_func):
623+ def append_section_with_channel_sel(self, view_id, label, icon,
624+ build_func):
625 btn = self.append_section(view_id, label, icon)
626 btn.draw_hint_has_channel_selector = True
627 sel = self.append_channel_selector(btn, view_id, build_func)
628@@ -227,15 +229,16 @@
629 for i, channel in enumerate(channels):
630 # only calling it with a explicit new() makes it a really
631 # empty one, otherwise the following error is raised:
632- # """Attempting to add a widget with type GtkBox to a
633+ # """Attempting to add a widget with type GtkBox to a
634 # GtkCheckMenuItem, but as a GtkBin subclass a
635- # GtkCheckMenuItem can only contain one widget at a time;
636+ # GtkCheckMenuItem can only contain one widget at a time;
637 # it already contains a widget of type GtkAccelLabel """
638
639 item = Gtk.MenuItem.new()
640
641 label = Gtk.Label.new(channel.display_name)
642- image = Gtk.Image.new_from_icon_name(channel.icon, Gtk.IconSize.MENU)
643+ image = Gtk.Image.new_from_icon_name(channel.icon,
644+ Gtk.IconSize.MENU)
645
646 box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, StockEms.SMALL)
647 box.pack_start(image, False, False, 0)
648@@ -252,8 +255,7 @@
649 view_id
650 )
651 )
652- popup.attach(item, 0, 1, i, i+1)
653- return
654+ popup.attach(item, 0, 1, i, i + 1)
655
656 def on_channel_selected(self, item, event, channel, view_id):
657 vm = self.view_manager
658@@ -279,7 +281,6 @@
659 return False
660
661 GObject.idle_add(config_view)
662- return
663
664
665 def get_test_window_viewswitcher():
666@@ -305,7 +306,7 @@
667 scroll.add_with_viewport(view)
668
669 win.add(box)
670- win.set_size_request(400,200)
671+ win.set_size_request(400, 200)
672 win.connect("destroy", Gtk.main_quit)
673 win.show_all()
674 return win
675@@ -317,5 +318,4 @@
676 softwarecenter.paths.datadir = "./data"
677 win = get_test_window_viewswitcher()
678
679-
680 Gtk.main()
681
682=== modified file 'softwarecenter/ui/gtk3/session/appmanager.py'
683--- softwarecenter/ui/gtk3/session/appmanager.py 2012-02-07 16:56:40 +0000
684+++ softwarecenter/ui/gtk3/session/appmanager.py 2012-03-15 00:20:29 +0000
685@@ -31,10 +31,14 @@
686 from softwarecenter.distro import get_current_arch, get_distro
687 from softwarecenter.i18n import get_language
688 from softwarecenter.ui.gtk3.dialogs import dependency_dialogs
689-from softwarecenter.backend.transactionswatcher import TransactionFinishedResult
690+from softwarecenter.backend.transactionswatcher import (
691+ TransactionFinishedResult,
692+)
693 import softwarecenter.paths
694
695 _appmanager = None # the global AppManager instance
696+
697+
698 def get_appmanager():
699 """ get a existing appmanager instance (or None if none is created yet) """
700 return _appmanager
701@@ -43,10 +47,10 @@
702 class ApplicationManager(GObject.GObject):
703
704 __gsignals__ = {
705- "purchase-requested" : (GObject.SignalFlags.RUN_LAST,
706- None,
707- (GObject.TYPE_PYOBJECT, str, str,)
708- ),
709+ "purchase-requested": (GObject.SignalFlags.RUN_LAST,
710+ None,
711+ (GObject.TYPE_PYOBJECT, str, str,)
712+ ),
713 }
714
715 def __init__(self, db, backend, icons):
716@@ -72,25 +76,26 @@
717 if action is "remove", must check if other dependencies have to be
718 removed as well and show a dialog in that case
719 """
720- #~ LOG.debug("on_application_action_requested: '%s' %s" % (app, action))
721+ #~ LOG.debug("on_application_action_requested: '%s' %s"
722+ #~ % (app, action))
723 appdetails = app.get_details(self.db)
724 if action == AppActions.REMOVE:
725 if not dependency_dialogs.confirm_remove(
726 None, self.datadir, app, self.db, self.icons):
727- # craft an instance of TransactionFinishedResult to send with the
728- # transaction-stopped signal
729+ # craft an instance of TransactionFinishedResult to send
730+ # with the transaction-stopped signal
731 result = TransactionFinishedResult(None, False)
732 result.pkgname = app.pkgname
733 self.backend.emit("transaction-stopped", result)
734 return
735 elif action == AppActions.INSTALL:
736- # If we are installing a package, check for dependencies that will
737+ # If we are installing a package, check for dependencies that will
738 # also be removed and show a dialog for confirmation
739 # generic removal text (fixing LP bug #554319)
740 if not dependency_dialogs.confirm_install(
741 None, self.datadir, app, self.db, self.icons):
742- # craft an instance of TransactionFinishedResult to send with the
743- # transaction-stopped signal
744+ # craft an instance of TransactionFinishedResult to send
745+ # with the transaction-stopped signal
746 result = TransactionFinishedResult(None, False)
747 result.pkgname = app.pkgname
748 self.backend.emit("transaction-stopped", result)
749@@ -100,8 +105,9 @@
750 if (action == AppActions.UPGRADE and app.request and
751 isinstance(app, DebFileApplication)):
752 action = AppActions.INSTALL
753-
754- # action_func is one of: "install", "remove", "upgrade", "apply_changes"
755+
756+ # action_func is one of:
757+ # "install", "remove", "upgrade", "apply_changes"
758 action_func = getattr(self.backend, action)
759 if action == AppActions.INSTALL:
760 # the package.deb path name is in the request
761@@ -117,7 +123,8 @@
762 addons_install=addons_install,
763 addons_remove=addons_remove)
764 #~ else:
765- #~ LOG.error("Not a valid action in AptdaemonBackend: '%s'" % action)
766+ #~ LOG.error("Not a valid action in AptdaemonBackend: '%s'" %
767+ #~ action)
768
769 # public interface
770 def reload(self):
771@@ -149,10 +156,10 @@
772 lang = get_language()
773 appdetails = app.get_details(self.db)
774 url = self.distro.PURCHASE_APP_URL % (
775- lang, self.distro.get_codename(), urlencode(
776- {'archive_id' : appdetails.ppaname,
777- 'arch' : get_current_arch(),}
778- )
779+ lang, self.distro.get_codename(), urlencode({
780+ 'archive_id': appdetails.ppaname,
781+ 'arch': get_current_arch()
782+ })
783 )
784 self.emit("purchase-requested", app, appdetails.icon, url)
785
786
787=== modified file 'softwarecenter/ui/gtk3/session/navhistory.py'
788--- softwarecenter/ui/gtk3/session/navhistory.py 2011-10-22 00:13:32 +0000
789+++ softwarecenter/ui/gtk3/session/navhistory.py 2012-03-15 00:20:29 +0000
790@@ -20,7 +20,8 @@
791
792 import logging
793
794-LOG=logging.getLogger(__name__)
795+LOG = logging.getLogger(__name__)
796+
797
798 class NavigationHistory(object):
799 """
800@@ -34,7 +35,6 @@
801 self.in_replay_history_mode = False
802 self._nav_back_set_sensitive(False)
803 self._nav_forward_set_sensitive(False)
804- return
805
806 def append(self, nav_item):
807 """
808@@ -81,7 +81,7 @@
809 if self.back_forward.left.has_focus():
810 self.back_forward.right.grab_focus()
811 self._nav_back_set_sensitive(False)
812-
813+
814 def clear_forward_history(self):
815 """
816 clear the forward history and set the corresponding forward
817@@ -100,7 +100,7 @@
818 self.stack.reset()
819 self._nav_back_set_sensitive(False)
820 self._nav_forward_set_sensitive(False)
821-
822+
823 def _nav_back_set_sensitive(self, is_sensitive):
824 self.back_forward.left.set_sensitive(is_sensitive)
825 #~ self.navhistory_back_action.set_sensitive(is_sensitive)
826@@ -121,7 +121,6 @@
827 self.page = page
828 self.view_state = view_state
829 self.callback = callback
830- return
831
832 def __str__(self):
833 facet = self.pane.pane_name.replace(' ', '')[:6]
834@@ -154,7 +153,7 @@
835 self.stack = []
836 self.cursor = 0
837
838- if not options or not options.display_navlog:
839+ if not options or not options.display_navlog:
840 return
841
842 import softwarecenter.ui.gtk3.widgets.navlog as navlog
843@@ -186,7 +185,8 @@
844 last = self[-1]
845 last_vs = last.view_state
846 item_vs = item.view_state
847- # FIXME: This is getting messy, this stuff should be cleaned up somehow...
848+ # FIXME: This is getting messy, this stuff should be cleaned up
849+ # somehow...
850 # hacky: special case, check for subsequent searches
851 # if subsequent search, update previous item_vs.search_term
852 # to current.
853@@ -212,11 +212,12 @@
854 if len(self) == 1:
855 self.history._nav_back_set_sensitive(False)
856 self.history._nav_forward_set_sensitive(False)
857- LOG.debug("also remove 'spurious' list navigation item (Bug #854047)")
858+ LOG.debug("also remove 'spurious' list navigation item "
859+ "(Bug #854047)")
860 return False
861
862 elif (item.page != AvailablePane.Pages.LIST and
863- last.page == AvailablePane.Pages.LIST and
864+ last.page == AvailablePane.Pages.LIST and
865 not item_vs.search_term and last_vs.search_term):
866 LOG.debug("search has been cleared. ignoring history item")
867 if len(self) > 1:
868@@ -224,7 +225,8 @@
869 if len(self) == 1:
870 self.history._nav_back_set_sensitive(False)
871 self.history._nav_forward_set_sensitive(False)
872- LOG.debug("also remove 'spurious' list navigation item (Bug #854047)")
873+ LOG.debug("also remove 'spurious' list navigation item "
874+ "(Bug #854047)")
875 return False
876
877 if item.__str__() == last.__str__():
878@@ -234,19 +236,18 @@
879
880 def append(self, item):
881 if not self._isok(item):
882- self.cursor = len(self.stack)-1
883+ self.cursor = len(self.stack) - 1
884 LOG.debug('A:%s' % repr(self))
885 #~ print ('A:%s' % repr(self))
886 return
887 if len(self.stack) + 1 > self.max_length:
888 self.stack.pop(1)
889 self.stack.append(item)
890- self.cursor = len(self.stack)-1
891+ self.cursor = len(self.stack) - 1
892 LOG.debug('A:%s' % repr(self))
893 #~ print ('A:%s' % repr(self))
894 if hasattr(self, "navlog"):
895 self.navlog.log.notify_append(item)
896- return
897
898 def step_back(self):
899 did_step = False
900@@ -263,11 +264,11 @@
901
902 def step_forward(self):
903 did_step = False
904- if self.cursor < len(self.stack)-1:
905+ if self.cursor < len(self.stack) - 1:
906 self.cursor += 1
907 did_step = True
908 else:
909- self.cursor = len(self.stack)-1
910+ self.cursor = len(self.stack) - 1
911 LOG.debug('B:%s' % repr(self))
912 #~ print ('B:%s' % repr(self))
913 if hasattr(self, "navlog") and did_step:
914@@ -280,7 +281,7 @@
915 self.navlog.log.notify_clear_forward_items()
916
917 def at_end(self):
918- return self.cursor == len(self.stack)-1
919+ return self.cursor == len(self.stack) - 1
920
921 def at_start(self):
922 return self.cursor == 0
923
924=== modified file 'softwarecenter/ui/gtk3/session/viewmanager.py'
925--- softwarecenter/ui/gtk3/session/viewmanager.py 2012-02-16 14:14:01 +0000
926+++ softwarecenter/ui/gtk3/session/viewmanager.py 2012-03-15 00:20:29 +0000
927@@ -22,17 +22,21 @@
928 from softwarecenter.ui.gtk3.widgets.backforward import BackForwardButton
929 from softwarecenter.ui.gtk3.widgets.searchentry import SearchEntry
930
931-_viewmanager = None # the global Viewmanager instance
932+
933+_viewmanager = None # the global Viewmanager instance
934+
935+
936 def get_viewmanager():
937 return _viewmanager
938
939+
940 class ViewManager(GObject.GObject):
941
942 __gsignals__ = {
943- "view-changed" : (GObject.SignalFlags.RUN_LAST,
944- None,
945- (GObject.TYPE_PYOBJECT, ),
946- ),
947+ "view-changed": (GObject.SignalFlags.RUN_LAST,
948+ None,
949+ (GObject.TYPE_PYOBJECT, ),
950+ ),
951 }
952
953 def __init__(self, notebook_view, options=None):
954@@ -69,30 +73,27 @@
955 pane = self.get_current_view_widget()
956 if hasattr(pane, "on_search_terms_changed"):
957 pane.on_search_terms_changed(widget, new_text)
958- return
959
960 def on_nav_back_clicked(self, widget):
961 pane = self.get_current_view_widget()
962 if hasattr(pane, "on_nav_back_clicked"):
963 pane.on_nav_back_clicked(widget)
964- return
965
966 def on_nav_forward_clicked(self, widget):
967 pane = self.get_current_view_widget()
968 if hasattr(pane, "on_nav_forward_clicked"):
969 pane.on_nav_forward_clicked(widget)
970- return
971-
972+
973 def on_search_entry_key_press_event(self, widget, event):
974-
975+
976 pane = self.get_current_view_widget()
977 if hasattr(pane, "on_search_entry_key_press_event"):
978 pane.on_search_entry_key_press_event(event)
979- return
980
981 def register(self, pane, view_id):
982 page_id = self.notebook_view.append_page(
983- pane, Gtk.Label.new("View %s" % view_id)) # label is for debugging only
984+ pane,
985+ Gtk.Label.new("View %s" % view_id)) # label is for debugging only
986 self.all_views[view_id] = page_id
987 self.view_to_pane[view_id] = pane
988
989@@ -115,7 +116,7 @@
990
991 def set_active_view(self, view_id):
992 # no views yet
993- if not self.all_views:
994+ if not self.all_views:
995 return
996 # if the view switches, ensure that the global spinner is hidden
997 self.spinner.hide()
998@@ -135,7 +136,7 @@
999 view_widget.state.search_term):
1000 self.search_entry.set_text_with_no_signal(
1001 view_widget.state.search_term)
1002-
1003+
1004 # callback = view_widget.get_callback_for_page(view_page,
1005 # view_state)
1006
1007@@ -157,7 +158,7 @@
1008
1009 def get_notebook_page_from_view_id(self, view_id):
1010 return self.all_views[view_id]
1011-
1012+
1013 def get_view_widget(self, view_id):
1014 return self.view_to_pane.get(view_id, None)
1015
1016@@ -194,8 +195,9 @@
1017 if self.get_current_view_widget() != pane:
1018 view_id = None
1019 for view_id, widget in self.view_to_pane.items():
1020- if widget == pane: break
1021-
1022+ if widget == pane:
1023+ break
1024+
1025 self.set_active_view(view_id)
1026
1027 if (not pane.searchentry or
1028@@ -209,14 +211,13 @@
1029 else:
1030 self.search_entry.show()
1031 self.spinner.hide()
1032- return
1033
1034 def nav_back(self):
1035 self.navhistory.nav_back()
1036
1037 def nav_forward(self):
1038 self.navhistory.nav_forward()
1039-
1040+
1041 def clear_forward_history(self):
1042 self.navhistory.clear_forward_history()
1043
1044
1045=== modified file 'test/test_pep8.py'
1046--- test/test_pep8.py 2012-03-15 00:20:29 +0000
1047+++ test/test_pep8.py 2012-03-15 00:20:29 +0000
1048@@ -8,6 +8,8 @@
1049
1050 # Only test these two packages for now:
1051 import softwarecenter.db.pkginfo_impl
1052+import softwarecenter.ui.gtk3.panes
1053+import softwarecenter.ui.gtk3.session
1054 import softwarecenter.ui.gtk3.views
1055 import softwarecenter.ui.gtk3.widgets
1056 import softwarecenter.ui.qml
1057@@ -15,10 +17,13 @@
1058 class PackagePep8TestCase(unittest.TestCase):
1059 maxDiff = None
1060 packages = [softwarecenter.ui.qml,
1061+ softwarecenter.ui.gtk3.panes,
1062+ softwarecenter.ui.gtk3.session,
1063 softwarecenter.ui.gtk3.views,
1064 softwarecenter.ui.gtk3.widgets,
1065 softwarecenter.db.pkginfo_impl]
1066- exclude = []
1067+ exclude = ['availablepane.py', 'basepane.py', 'globalpane.py',
1068+ 'historypane.py', 'installedpane.py']
1069
1070 def message(self, text):
1071 self.errors.append(text)