From 9425b1e1b58f6adf424be46f1c4b6c8ec3ddb74c Mon Sep 17 00:00:00 2001 From: fossfreedom Date: Wed, 3 Dec 2014 19:32:49 +0000 Subject: [PATCH] pycharm autorefactor --- coverart_album.py | 13 ++-- coverart_artistinfo.py | 123 ++++++++++++++++++----------------- coverart_artistview.py | 32 ++++----- coverart_browser.py | 31 ++++----- coverart_browser_prefs.py | 25 ++++--- coverart_browser_source.py | 70 ++++++++++---------- coverart_controllers.py | 6 +- coverart_coverflowview.py | 6 +- coverart_covericonview.py | 6 +- coverart_entryview.py | 7 +- coverart_export.py | 4 +- coverart_external_plugins.py | 6 +- coverart_listview.py | 2 +- coverart_play_source.py | 20 +++--- coverart_playlists.py | 2 +- coverart_playsourceview.py | 2 +- coverart_queueview.py | 2 +- coverart_rb3compat.py | 4 +- coverart_search.py | 6 +- coverart_toolbar.py | 6 +- coverart_utils.py | 4 +- coverart_widgets.py | 49 +++++++------- coverart_window.py | 5 +- 23 files changed, 217 insertions(+), 214 deletions(-) diff --git a/coverart_album.py b/coverart_album.py index 6110376..1355fdc 100644 --- a/coverart_album.py +++ b/coverart_album.py @@ -50,6 +50,7 @@ import rb + # default chunk of entries to process when loading albums ALBUM_LOAD_CHUNK = 50 @@ -464,7 +465,7 @@ class Album(GObject.Object): print("_track_deleted") self._tracks.remove(track) - #list(map(track.disconnect, self._signals_id[track])) + # list(map(track.disconnect, self._signals_id[track])) for signal_id in self._signals_id[track]: track.disconnect(signal_id) @@ -877,7 +878,7 @@ class AlbumsModel(GObject.Object): :param album_name: `str` name of the album. ''' return album_name in self._iters \ - and album_artist in self._iters[album_name] + and album_artist in self._iters[album_name] def get(self, album_name, album_artist): ''' @@ -1220,7 +1221,7 @@ class AlbumLoader(GObject.Object): elif change.prop is RB.RhythmDBPropType.HIDDEN: # called when an entry gets hidden (e.g.:the sound file is # removed. - print (change) + print(change) if change.new: print("change prop new") track.emit('deleted') @@ -1231,7 +1232,7 @@ class AlbumLoader(GObject.Object): # look at all the changes and update the albums accordingly track = self._tracks[Track(entry).location] - #RB3 has a simple rhythmdbentrychange array to deal with so we + # RB3 has a simple rhythmdbentrychange array to deal with so we #just need to loop each element of the array for change in changes: @@ -1420,7 +1421,7 @@ class CoverManager(GObject.Object): def __init__(self, plugin, manager): super(CoverManager, self).__init__() - #self.cover_db = None to be defined by inherited class + # self.cover_db = None to be defined by inherited class self._manager = manager self._requester = CoverRequester(self.cover_db) @@ -1620,7 +1621,7 @@ class AlbumCoverManager(CoverManager): # create the unknown cover self._shadow = Shadow(self.cover_size, rb.find_plugin_file(plugin, 'img/album-shadow-%s.png' % - self.shadow_image)) + self.shadow_image)) self.unknown_cover = self.create_cover( rb.find_plugin_file(plugin, 'img/rhythmbox-missing-artwork.svg')) diff --git a/coverart_artistinfo.py b/coverart_artistinfo.py index 7b62140..a895ffd 100644 --- a/coverart_artistinfo.py +++ b/coverart_artistinfo.py @@ -74,11 +74,11 @@ class ArtistInfoWebView(WebKit.WebView): self.connect("notify::title", self.view_title_change) def view_title_change(self, webview, param): - print ("view_title_change") + print("view_title_change") title = webview.get_title() if title: - print ("title %s" % title) + print("title %s" % title) args = json.loads(title) artist = args['artist'] @@ -87,13 +87,13 @@ class ArtistInfoWebView(WebKit.WebView): else: self.source.album_manager.model.remove_filter('similar_artist') else: - print ("removing filter") + print("removing filter") self.source.album_manager.model.remove_filter('similar_artist') - print ("end view_title_change") + print("end view_title_change") def navigation_request_cb(self, view, frame, request): # open HTTP URIs externally. this isn't a web browser. - print ("navigation_request_cb") + print("navigation_request_cb") if request.get_uri().startswith('http'): print("opening uri %s" % request.get_uri()) Gtk.show_uri(self.shell.props.window.get_screen(), request.get_uri(), Gdk.CURRENT_TIME) @@ -103,7 +103,7 @@ class ArtistInfoWebView(WebKit.WebView): return 0 # WEBKIT_NAVIGATION_RESPONSE_ACCEPT def do_button_release_event(self, *args): - print ("do_release_button") + print("do_release_button") WebKit.WebView.do_button_release_event(self, *args) return True @@ -125,7 +125,7 @@ class ArtistInfoPane(GObject.GObject): self.ds = {} self.view = {} - #self.buttons = button_box + # self.buttons = button_box self.source = source self.plugin = source.plugin self.shell = source.shell @@ -240,7 +240,7 @@ class ArtistInfoPane(GObject.GObject): self._change_paned_pos(view_name) def _change_paned_pos(self, view_name): - print (self.paned_pos) + print(self.paned_pos) paned_positions = eval(self.paned_pos) found = None @@ -273,7 +273,7 @@ class ArtistInfoPane(GObject.GObject): return child.get_allocated_width() def paned_button_press_callback(self, widget, event): - print ('paned_button_press_callback') + print('paned_button_press_callback') self._from_paned_handle = 1 if event.type == Gdk.EventType._2BUTTON_PRESS: @@ -286,7 +286,7 @@ class ArtistInfoPane(GObject.GObject): if self._from_paned_handle == 0: return False - print ("paned_button_release_callback") + print("paned_button_release_callback") paned_positions = eval(self.paned_pos) @@ -297,15 +297,15 @@ class ArtistInfoPane(GObject.GObject): break if not found: - print ("cannot find") + print("cannot find") return True values = found.split(':') child_width = self.source.page.get_allocated_width() - self.info_paned.get_position() - print (child_width) + print(child_width) open_type = "closed" - print (values) + print(values) if len(values) > 2: open_type = values[2] @@ -314,7 +314,7 @@ class ArtistInfoPane(GObject.GObject): open_type == "closed": # we are dealing with a situation where the pane is already closed # or almost closed - just shut the door - print ("we are closed") + print("we are closed") calc_pos = self.source.page.get_allocated_width() self.info_paned.set_position(calc_pos) return False @@ -362,10 +362,10 @@ class ArtistInfoPane(GObject.GObject): self.paned_pos = repr(paned_positions) self._from_paned_handle = 0 - print ("End artist_info_paned_button_release_callback") + print("End artist_info_paned_button_release_callback") def select_artist(self, widget, artist, album_title): - print ("artist %s title %s" % (artist, album_title)) + print("artist %s title %s" % (artist, album_title)) if self._get_child_width() > self.min_paned_pos: self.view[self.current].reload(artist, album_title) else: @@ -436,10 +436,10 @@ class BaseInfoView(GObject.Object): pass def load_view(self): - print ("load_view") - print (self.file) + print("load_view") + print(self.file) self.webview.load_string(self.file, 'text/html', 'utf-8', self.basepath) - print ("end load_view") + print("end load_view") def blank_view(self): render_file = self.empty_template.render(stylesheet=self.styles) @@ -469,7 +469,7 @@ class ArtistInfoView(BaseInfoView): def loading(self, current_artist, current_album_title): cl = CoverLocale() - #cl.switch_locale(cl.Locale.LOCALE_DOMAIN) + # cl.switch_locale(cl.Locale.LOCALE_DOMAIN) self.link_ds.set_artist(current_artist) self.link_ds.set_album(current_album_title) @@ -498,7 +498,7 @@ class ArtistInfoView(BaseInfoView): def artist_info_ready(self, ds): # Can only be called after the artist-info-ready signal has fired. # If called any other time, the behavior is undefined - #try: + # try: info = ds.get_artist_info() small, med, big = info['images'] or (None, None, None) @@ -541,7 +541,7 @@ class ArtistInfoView(BaseInfoView): self.blank_view() return - #self.stack.set_visible_child_name(self.view_name) + # self.stack.set_visible_child_name(self.view_name) if self.active and ( (not self.artist or self.artist != artist) or (not self.album_title or self.album_title != album_title) ): @@ -590,7 +590,7 @@ class ArtistDataSource(GObject.GObject): } if lang != 'en': - self.artist['info_'+lang] = { + self.artist['info_' + lang] = { 'data': None, 'function': 'getinfo', 'cache': info_cache, @@ -598,7 +598,7 @@ class ArtistDataSource(GObject.GObject): 'parsed': False, 'lang': lang } - self.artist['similar_'+lang] = { + self.artist['similar_' + lang] = { 'data': None, 'function': 'getsimilar', 'cache': info_cache, @@ -627,9 +627,9 @@ class ArtistDataSource(GObject.GObject): print("search") cachekey = "lastfm:artist:%sjson:%s:%s" % (value['function'], artist, value['lang']) url = '%s?method=artist.%s&artist=%s&limit=10&api_key=%s&format=json&lang=%s' % (LastFM.API_URL, - value['function'], artist, - LastFM.API_KEY, - value['lang']) + value['function'], artist, + LastFM.API_KEY, + value['lang']) print("fetching %s" % url) value['cache'].fetch(cachekey, url, self.fetch_artist_data_cb, value) @@ -660,7 +660,7 @@ class ArtistDataSource(GObject.GObject): """ Returns tuple of image url's for small, medium, and large images. """ - print ('get_artist_images') + print('get_artist_images') data = self.artist['info_en']['data'] if data is None: return None @@ -668,7 +668,7 @@ class ArtistDataSource(GObject.GObject): if 'artist' not in data: return None - print (list(data.keys())) + print(list(data.keys())) images = [img['#text'] for img in data['artist'].get('image', ())] return images[:3] @@ -713,9 +713,9 @@ class ArtistDataSource(GObject.GObject): json_artists_data = self.artist['similar_' + lang]['data']['similarartists'] results = [] - print (json_artists_data) + print(json_artists_data) for json_artist in json_artists_data["artist"]: - print (json_artist) + print(json_artist) name = json_artist["name"] image_url = json_artist["image"][1]["#text"] similarity = int(100 * float(json_artist["match"])) @@ -754,6 +754,7 @@ class ArtistDataSource(GObject.GObject): fill_info('en') return fill_info(lang) + class LinksDataSource(GObject.GObject): def __init__(self): GObject.GObject.__init__(self) @@ -836,7 +837,7 @@ class AlbumInfoView(BaseInfoView): def loading(self, current_artist, current_album_title): cl = CoverLocale() - #cl.switch_locale(cl.Locale.LOCALE_DOMAIN) + # cl.switch_locale(cl.Locale.LOCALE_DOMAIN) self.loading_file = self.loading_template.render( artist=current_artist, @@ -848,7 +849,7 @@ class AlbumInfoView(BaseInfoView): def load_tmpl(self): cl = CoverLocale() - #cl.switch_locale(cl.Locale.LOCALE_DOMAIN) + # cl.switch_locale(cl.Locale.LOCALE_DOMAIN) path = rb.find_plugin_file(self.plugin, 'tmpl/album-tmpl.html') empty_path = rb.find_plugin_file(self.plugin, 'tmpl/album_empty-tmpl.html') @@ -859,9 +860,9 @@ class AlbumInfoView(BaseInfoView): self.styles = self.basepath + '/tmpl/artistmain.css' def album_list_ready(self, ds): - print ("album_list_ready") + print("album_list_ready") cl = CoverLocale() - #cl.switch_locale(cl.Locale.LOCALE_DOMAIN) + # cl.switch_locale(cl.Locale.LOCALE_DOMAIN) self.file = self.album_template.render(error=ds.get_error(), albums=ds.get_top_albums(), @@ -871,7 +872,7 @@ class AlbumInfoView(BaseInfoView): self.load_view() def reload(self, artist, album_title): - print ("reload") + print("reload") if not artist: return @@ -956,9 +957,9 @@ class AlbumDataSource(GObject.GObject): return True print(albums) self.albums = [] - print ("max number of albums to process") + print("max number of albums to process") print(len(albums)) - #albums = parsed['topalbums'].get('album', [])[:self.max_albums_fetched] + # albums = parsed['topalbums'].get('album', [])[:self.max_albums_fetched] self.fetching = len(albums) for i, a in enumerate(albums): @@ -975,7 +976,7 @@ class AlbumDataSource(GObject.GObject): return self.albums def fetch_album_info(self, artist, album, index): - print ('start fetch_album_info') + print('start fetch_album_info') cl = CoverLocale() lang = cl.get_locale()[:2] qartist = urllib.parse.quote_plus(artist) @@ -986,35 +987,35 @@ class AlbumDataSource(GObject.GObject): cachekey = "lastfm:album:getinfojson:%s:%s:%s" % (qartist, qalbum, lang) url = "%s?method=album.getinfo&artist=%s&album=%s&api_key=%s&format=json&lang=%s" % ( LastFM.API_URL, qartist, qalbum, LastFM.API_KEY, lang) - print (url) + print(url) self.info_cache.fetch(cachekey, url, self.parse_album_info, album, index, lang) self.album_data = {} fetch_information('en') fetch_information(lang) - print ('end fetch_album_info') + print('end fetch_album_info') def parse_album_info(self, data, album, index, lang): - print ('parse_album_info %s' % lang) + print('parse_album_info %s' % lang) self.fetched = self.fetched - 1 self.album_data[lang] = data if self.fetched > 0: - print ('return %d' % self.fetched) + print('return %d' % self.fetched) return cl = CoverLocale() lang = cl.get_locale()[:2] rv = True try: - print ('decoding') + print('decoding') parsed = json.loads(self.album_data[lang].decode('utf-8')) - print ('decoded') + print('decoded') self.albums[index]['id'] = parsed['album']['id'] for k in ('releasedate', 'summary'): self.albums[index][k] = parsed['album'].get(k) tracklist = [] - print (parsed['album']) + print(parsed['album']) tracks = parsed['album']['tracks'].get('track', []) for i, t in enumerate(tracks): title = t['name'] @@ -1054,7 +1055,7 @@ class EchoArtistInfoView(BaseInfoView): def load_tmpl(self): cl = CoverLocale() - #cl.switch_locale(cl.Locale.LOCALE_DOMAIN) + # cl.switch_locale(cl.Locale.LOCALE_DOMAIN) path = rb.find_plugin_file(self.plugin, 'tmpl/echoartist-tmpl.html') empty_path = rb.find_plugin_file(self.plugin, 'tmpl/artist_empty-tmpl.html') @@ -1071,7 +1072,7 @@ class EchoArtistInfoView(BaseInfoView): def artist_info_ready(self, ds): # Can only be called after the artist-info-ready signal has fired. # If called any other time, the behavior is undefined - #try: + # try: link_album = self.link_ds.get_album() if not link_album: link_album = "" @@ -1080,15 +1081,15 @@ class EchoArtistInfoView(BaseInfoView): if not links: links = {} - print (ds.get_current_artist()) - print (ds.get_error()) - print (self.ds.get_artist_bio()) - print (self.styles) - print (link_album) - print (self.link_ds.get_artist_links()) - print (links) - print (self.link_images) - print (ds.get_attribution()) + print(ds.get_current_artist()) + print(ds.get_error()) + print(self.ds.get_artist_bio()) + print(self.styles) + print(link_album) + print(self.link_ds.get_artist_links()) + print(links) + print(self.link_images) + print(ds.get_attribution()) self.file = self.template.render(artist=ds.get_current_artist(), error=ds.get_error(), bio=self.ds.get_artist_bio(), @@ -1111,7 +1112,7 @@ class EchoArtistInfoView(BaseInfoView): self.blank_view() return - #self.stack.set_visible_child_name(self.view_name) + # self.stack.set_visible_child_name(self.view_name) if self.active and ( (not self.artist or self.artist != artist) or (not self.album_title or self.album_title != album_title) ): @@ -1193,10 +1194,10 @@ class EchoArtistDataSource(GObject.GObject): return self.error def get_attribution(self): - print ('get_attribution') + print('get_attribution') data = self.artist['info']['data'] if data is None: - print ('nothing here') + print('nothing here') return None content = "" @@ -1216,7 +1217,7 @@ class EchoArtistDataSource(GObject.GObject): """ data = self.artist['info']['data'] if data is None: - print ('nothing here') + print('nothing here') return None if not self.artist['info']['parsed']: diff --git a/coverart_artistview.py b/coverart_artistview.py index a0d2f47..5b5f87a 100644 --- a/coverart_artistview.py +++ b/coverart_artistview.py @@ -89,7 +89,7 @@ class Artist(GObject.Object): @cover.setter def cover(self, new_cover): - #if self._cover: + # if self._cover: # self._cover.disconnect(self._cover_resized_id) self._cover = new_cover @@ -151,7 +151,7 @@ class ArtistsModel(GObject.Object): self._filtered_store.set_visible_column(ArtistsModel.columns['show']) self._tree_sort = Gtk.TreeModelSort(model=self._filtered_store) - #self._tree_sort.set_default_sort_func(lambda *unused: 0) + # self._tree_sort.set_default_sort_func(lambda *unused: 0) self._tree_sort.set_sort_func(0, self._compare, None) self._connect_signals() @@ -187,7 +187,7 @@ class ArtistsModel(GObject.Object): @property def store(self): - #return self._filtered_store + # return self._filtered_store return self._tree_sort def add(self, artist): @@ -442,7 +442,7 @@ class ArtistsModel(GObject.Object): while next_iter != None: albums.append(self._tree_store[next_iter][self.columns['artist_album']]) next_iter = self._tree_store.iter_next(next_iter) - #if 'album' in self._iters[artist_name]: + # if 'album' in self._iters[artist_name]: # for album_iter in self._iters[artist_name]['album']: # path = self._tree_store.get_path(album_iter) # if path: @@ -566,8 +566,8 @@ class ArtistCellRenderer(Gtk.CellRendererPixbuf): background_area, cell_area, flags): - newpix = self.props.pixbuf #.copy() - #newpix = newpix.scale_simple(48,48,GdkPixbuf.InterpType.BILINEAR) + newpix = self.props.pixbuf # .copy() + # newpix = newpix.scale_simple(48,48,GdkPixbuf.InterpType.BILINEAR) Gdk.cairo_set_source_pixbuf(cr, newpix, 0, 0) cr.paint() @@ -596,7 +596,7 @@ class ArtistLoader(GObject.Object): self.model = artist_manager.model def load_artists(self): - print ("load_artists") + print("load_artists") albums = self._album_manager.model.get_all() model = list(set(album.artist for album in albums)) @@ -645,14 +645,14 @@ class ArtistLoader(GObject.Object): def finish(data): self._album_manager.progress = 1 self.emit('model-load-finished') - print ("finished") - #return False + print("finished") + # return False return ARTIST_LOAD_CHUNK, process, after, error, finish def _connect_signals(self): # connect signals for updating the albums - #self.entry_changed_id = self._album_manager.db.connect('entry-changed', + # self.entry_changed_id = self._album_manager.db.connect('entry-changed', # self._entry_changed_callback) pass @@ -905,7 +905,7 @@ class ArtistView(Gtk.TreeView, AbstractView): treepath, treecolumn, cellx, celly = self.get_path_at_pos(winx, winy) active_object = self.artist_manager.model.get_from_path(treepath) - #active_object=self.artist_manager.model.store[treepath][self.artist_manager.model.columns['artist_album']] + # active_object=self.artist_manager.model.store[treepath][self.artist_manager.model.columns['artist_album']] if isinstance(active_object, Artist) and \ treecolumn.get_title() == _('Covers') and \ @@ -946,7 +946,7 @@ class ArtistView(Gtk.TreeView, AbstractView): if isinstance(active_object, Artist): self.artist_manager.model.emit('update-path', treepath) else: - #we need to play this album + # we need to play this album self.source.play_selected_album(self.source.favourites) def pre_popup_menu_callback(self, *args): @@ -958,7 +958,7 @@ class ArtistView(Gtk.TreeView, AbstractView): if not state: sensitive = False - #self.popup_menu.get_menu_object('add_to_playing_menu_item') + # self.popup_menu.get_menu_object('add_to_playing_menu_item') self.artist_popup_menu.set_sensitive('add_to_playing_menu_item', sensitive) self.source.playlist_menu_item_callback() @@ -967,7 +967,7 @@ class ArtistView(Gtk.TreeView, AbstractView): ''' event called when clicking on a row ''' - print ('_row_click') + print('_row_click') try: treepath, treecolumn, cellx, celly = self.get_path_at_pos(event.x, event.y) @@ -996,7 +996,7 @@ class ArtistView(Gtk.TreeView, AbstractView): self.artist_popup_menu.popup(self.source, 'popup_menu', 3, Gtk.get_current_event_time()) - print ('_row click artist exit') + print('_row click artist exit') return if event.button == 1: @@ -1021,7 +1021,7 @@ class ArtistView(Gtk.TreeView, AbstractView): self._last_row_was_artist = False - print ('_row_click album exit') + print('_row_click album exit') return def get_view_icon_name(self): diff --git a/coverart_browser.py b/coverart_browser.py index 99198e4..c56416e 100644 --- a/coverart_browser.py +++ b/coverart_browser.py @@ -32,9 +32,9 @@ from coverart_browser_prefs import Preferences from coverart_browser_source import CoverArtBrowserSource from coverart_listview import ListView from coverart_queueview import QueueView -from coverart_playsourceview import PlaySourceView from coverart_toolbar import TopToolbar + class CoverArtBrowserEntryType(RB.RhythmDBEntryType): ''' Entry type for our source. @@ -46,6 +46,7 @@ class CoverArtBrowserEntryType(RB.RhythmDBEntryType): ''' RB.RhythmDBEntryType.__init__(self, name='CoverArtBrowserEntryType') + class CoverArtBrowserPlugin(GObject.Object, Peas.Activatable): ''' Main class of the plugin. Manages the activation and deactivation of the @@ -143,7 +144,7 @@ class CoverArtBrowserPlugin(GObject.Object, Peas.Activatable): plugin = _('CoverArt Browser') desc = _('Browse and play your albums through their covers') - #. TRANSLATORS: This is the icon-grid view that the user sees + # . TRANSLATORS: This is the icon-grid view that the user sees tile = _('Tiles') #. TRANSLATORS: This is the cover-flow view the user sees - they can swipe album covers from side-to-side @@ -247,8 +248,8 @@ class ExternalPluginMenu(GObject.Object): self.action.set_state(self._views.get_action_name(ListView.name)) elif page == self.shell.props.queue_source: self.action.set_state(self._views.get_action_name(QueueView.name)) - #elif page == self.source.playlist_source: - # self.action.set_state(self._views.get_action_name(PlaySourceView.name)) + # elif page == self.source.playlist_source: + # self.action.set_state(self._views.get_action_name(PlaySourceView.name)) def view_change_cb(self, action, current): @@ -259,8 +260,8 @@ class ExternalPluginMenu(GObject.Object): action.set_state(current) view_name = self._views.get_view_name_for_action(current) if view_name != ListView.name and \ - view_name != QueueView.name:# and \ - #view_name != PlaySourceView.name: + view_name != QueueView.name: # and \ + # view_name != PlaySourceView.name: gs = GSetting() setting = gs.get_setting(gs.Path.PLUGIN) setting[gs.PluginKey.VIEW_NAME] = view_name @@ -272,14 +273,14 @@ class ExternalPluginMenu(GObject.Object): elif view_name == QueueView.name: GLib.idle_add(self.shell.props.display_page_tree.select, self.shell.props.queue_source) - #elif view_name == PlaySourceView.name: - # if not hasattr(self.source, 'playlist_source'): - # return + # elif view_name == PlaySourceView.name: + # if not hasattr(self.source, 'playlist_source'): + # return - # print ("test selectable") - # path = self.shell.props.display_page_tree.props.model - # #self.source.activate() - # overlay = self.source.get_children()[0] + # print ("test selectable") + # path = self.shell.props.display_page_tree.props.model + # #self.source.activate() + # overlay = self.source.get_children()[0] - # GLib.idle_add(self.shell.props.display_page_tree.select, - # self.source.playlist_source) + # GLib.idle_add(self.shell.props.display_page_tree.select, + # self.source.playlist_source) diff --git a/coverart_browser_prefs.py b/coverart_browser_prefs.py index fd8eee1..23757a7 100644 --- a/coverart_browser_prefs.py +++ b/coverart_browser_prefs.py @@ -257,7 +257,7 @@ class Preferences(GObject.Object, PeasGtk.Configurable): return self._create_display_contents(self) def display_preferences_dialog(self, plugin): - print ("DEBUG - display_preferences_dialog") + print("DEBUG - display_preferences_dialog") if self._first_run: self._first_run = False @@ -275,19 +275,19 @@ class Preferences(GObject.Object, PeasGtk.Configurable): self._dialog.show_all() - print ("shown") + print("shown") while True: response = self._dialog.run() - print ("and run") + print("and run") if response != Gtk.ResponseType.HELP: break self._dialog.hide() - print ("DEBUG - display_preferences_dialog end") + print("DEBUG - display_preferences_dialog end") def _display_help(self, *args): peas = Peas.Engine.get_default() @@ -296,7 +296,7 @@ class Preferences(GObject.Object, PeasGtk.Configurable): webbrowser.open(uri) def _create_display_contents(self, plugin): - print ("DEBUG - create_display_contents") + print("DEBUG - create_display_contents") # create the ui self._first_run = True cl = CoverLocale() @@ -310,7 +310,7 @@ class Preferences(GObject.Object, PeasGtk.Configurable): builder.connect_signals(self) - #. TRANSLATORS: Do not translate this string. + # . TRANSLATORS: Do not translate this string. translators = _('translator-credits') if translators != "translator-credits": @@ -328,7 +328,6 @@ class Preferences(GObject.Object, PeasGtk.Configurable): self.settings.bind(gs.PluginKey.DISPLAY_TEXT, toggle_text, 'active', Gio.SettingsBindFlags.DEFAULT) - box_text = builder.get_object('display_text_box') self.settings.bind(gs.PluginKey.DISPLAY_TEXT, box_text, 'sensitive', Gio.SettingsBindFlags.GET) @@ -541,18 +540,18 @@ class Preferences(GObject.Object, PeasGtk.Configurable): # return the dialog self._first_run = False - print ("end create dialog contents") + print("end create dialog contents") return builder.get_object('main_notebook') def on_cover_size_scale_changed(self, scale): self._cover_size = scale.get_value() def delay(*args): - print ('delay') - print (self._cover_size_delay) + print('delay') + print(self._cover_size_delay) self._cover_size_delay = self._cover_size_delay + 1 - if self._cover_size_delay >=8: + if self._cover_size_delay >= 8: gs = GSetting() self.settings[gs.PluginKey.COVER_SIZE] = self._cover_size self._cover_size_delay = 0 @@ -614,7 +613,7 @@ class Preferences(GObject.Object, PeasGtk.Configurable): def on_add_shadow_checkbox_toggled(self, button): if button.get_active(): - #gs = GSetting() + # gs = GSetting() #self.settings[gs.PluginKey.DISPLAY_TEXT_POS] = True self.display_text_under_radiobutton.set_active(True) @@ -745,7 +744,7 @@ class Preferences(GObject.Object, PeasGtk.Configurable): try: test = self._iters[(entry_value, self.GENRE_LIST)] if RB.search_fold(self.current_genre) == RB.search_fold(entry_value): - #if the current entry is the same then could save + # if the current entry is the same then could save enable = True except: # reach here if this is a brand new entry diff --git a/coverart_browser_source.py b/coverart_browser_source.py index 16d1bc3..825370f 100644 --- a/coverart_browser_source.py +++ b/coverart_browser_source.py @@ -45,7 +45,6 @@ from coverart_coverflowview import CoverFlowView from coverart_artistview import ArtistView from coverart_listview import ListView from coverart_queueview import QueueView -from coverart_playsourceview import PlaySourceView from coverart_toolbar import ToolbarManager from coverart_artistinfo import ArtistInfoPane from coverart_external_plugins import CreateExternalPluginMenu @@ -111,7 +110,6 @@ class CoverArtBrowserSource(RB.Source): ''' if not self.task_progress: - self.task_progress = RB.TaskProgressSimple.new() try: @@ -176,11 +174,11 @@ class CoverArtBrowserSource(RB.Source): # define the associated playsource so we can interact with this query model self.playlist_source = GObject.new( - CoverArtPlaySource, - name=_("CoverArt Playlist"), - shell=self.shell, - plugin=self.plugin, - entry_type=self.plugin.entry_type) + CoverArtPlaySource, + name=_("CoverArt Playlist"), + shell=self.shell, + plugin=self.plugin, + entry_type=self.plugin.entry_type) self.playlist_source.initialise(self.plugin, self.shell, self) self.shell.append_display_page(self.playlist_source, self.plugin.source) @@ -277,7 +275,7 @@ class CoverArtBrowserSource(RB.Source): self.paned.set_name('horizontal_paned') self.entry_view_grid = ui.get_object('bottom_grid') - #setup Track Pane + # setup Track Pane setting = self.gs.get_setting(self.gs.Path.PLUGIN) setting.bind(self.gs.PluginKey.PANED_POSITION, self.paned, 'collapsible-y', Gio.SettingsBindFlags.DEFAULT) @@ -418,11 +416,10 @@ class CoverArtBrowserSource(RB.Source): if not state: sensitive = False - #self.popup_menu.get_menu_object('add_to_playing_menu_item') + # self.popup_menu.get_menu_object('add_to_playing_menu_item') self.popup_menu.set_sensitive('add_to_playing_menu_item', sensitive) self.popup_menu.set_sensitive('play_next_menu_item', sensitive) - if not self._external_plugins: # initialise external plugin menu support self._external_plugins = \ @@ -465,9 +462,9 @@ class CoverArtBrowserSource(RB.Source): if self._from_paned_handle == 0: return False - print ("artist_paned_button_release_callback") + print("artist_paned_button_release_callback") - print (self.artist_paned.get_position()) + print(self.artist_paned.get_position()) child_width = self.artist_paned.get_position() if child_width == 0 and self._from_paned_handle == 1: @@ -482,12 +479,12 @@ class CoverArtBrowserSource(RB.Source): break if not found: - print ("not found %s" % self.viewmgr.view_name) + print("not found %s" % self.viewmgr.view_name) return True - print ("current paned_positions %s" % paned_positions) + print("current paned_positions %s" % paned_positions) paned_positions.remove(found) - print ("Child Width %d" % child_width) + print("Child Width %d" % child_width) open_type = "closed" if self._from_paned_handle == 2: @@ -507,30 +504,30 @@ class CoverArtBrowserSource(RB.Source): self.artist_paned.set_position(new_width) if child_width <= self.min_paned_pos and self._from_paned_handle == 1: - print (found) - print (found.split(':')[1]) + print(found) + print(found.split(':')[1]) if int(found.split(':')[1]) == 0: child_width = self.min_paned_pos + 1 open_type = "opened" else: child_width = 0 - print ("smaller") + print("smaller") self.artist_paned.set_position(child_width) if self._from_paned_handle == 1 and child_width != 0: open_type = "opened" - print ("Child Width2 %d" % child_width) + print("Child Width2 %d" % child_width) - paned_positions.append(self.viewmgr.view_name + \ + paned_positions.append(self.viewmgr.view_name + \ ":" + \ str(child_width) + \ ":" + \ - open_type ) + open_type) - print ("after paned positions %s" % paned_positions) + print("after paned positions %s" % paned_positions) self.artist_paned_pos = repr(paned_positions) - print ("artist_paned_pos %s" % self.artist_paned_pos) + print("artist_paned_pos %s" % self.artist_paned_pos) self._from_paned_handle = 0 @@ -538,7 +535,7 @@ class CoverArtBrowserSource(RB.Source): self._change_artist_paned_pos(view_name) def _change_artist_paned_pos(self, view_name): - print ("change artist paned") + print("change artist paned") paned_positions = eval(self.artist_paned_pos) print(paned_positions) found = None @@ -548,7 +545,7 @@ class CoverArtBrowserSource(RB.Source): break print(found) if not found: - print ("not found %s" % view_name) + print("not found %s" % view_name) return values = found.split(":") @@ -583,7 +580,7 @@ class CoverArtBrowserSource(RB.Source): cl = CoverLocale() cl.switch_locale(cl.Locale.RB) - #. TRANSLATORS - "All" is used in the context of "All artist names" + # . TRANSLATORS - "All" is used in the context of "All artist names" if artist == _('All'): self.album_manager.model.remove_filter('quick_artist') else: @@ -615,7 +612,7 @@ class CoverArtBrowserSource(RB.Source): ''' print("CoverArtBrowser DEBUG - load_finished_callback") - #if not self.request_status_box.get_visible(): + # if not self.request_status_box.get_visible(): # it should only be enabled if no cover request is going on #self.source_menu_search_all_item.set_sensitive(True) @@ -782,7 +779,7 @@ class CoverArtBrowserSource(RB.Source): index = index + 1 if entry: album = self.album_manager.model.get_from_dbentry(entry) - print (entry.get_string(RB.RhythmDBPropType.TITLE)) + print(entry.get_string(RB.RhythmDBPropType.TITLE)) if album == current_album: final_index = index @@ -871,7 +868,7 @@ class CoverArtBrowserSource(RB.Source): num_albums = len(self.album_manager.model.store) - #random_list = [] + # random_list = [] selected_albums = [] gs = GSetting() @@ -1003,7 +1000,7 @@ class CoverArtBrowserSource(RB.Source): then if necessary scroll the view to the last selected album params is "album" or a tuple of "album" and "force_expand" boolean ''' - print ('show_hide_pane') + print('show_hide_pane') if isinstance(params, tuple): album, force = params else: @@ -1023,7 +1020,7 @@ class CoverArtBrowserSource(RB.Source): # clear the click count self.click_count = 0 - print ('show_hide_pane end') + print('show_hide_pane end') def update_with_selection(self): self.last_selected_album, self.click_count = \ @@ -1033,7 +1030,7 @@ class CoverArtBrowserSource(RB.Source): self.statusbar.emit('display-status', self.viewmgr.current_view) def propertiesbutton_callback(self, choice): - print ("properties chosen: %s" % choice) + print("properties chosen: %s" % choice) if choice == 'download': self.request_status_box.show_all() @@ -1150,11 +1147,11 @@ class Statusbar(GObject.Object): # now lets build up a status label containing some # 'interesting stuff' about the album if len(albums) == 1: - #. TRANSLATORS - for example "abba's greatest hits by ABBA" + # . TRANSLATORS - for example "abba's greatest hits by ABBA" self.status = rb3compat.unicodedecode(_('%s by %s') % (album.name, album.artist), 'UTF-8') else: - #. TRANSLATORS - the number of albums that have been selected/highlighted + # . TRANSLATORS - the number of albums that have been selected/highlighted self.status = rb3compat.unicodedecode(_('%d selected albums') % (len(albums)), 'UTF-8') @@ -1228,7 +1225,6 @@ class Views: from coverart_artistview import ArtistView from coverart_listview import ListView from coverart_queueview import QueueView - from coverart_playsourceview import PlaySourceView from coverart_browser_prefs import webkit_support library_name = shell.props.library_source.props.name @@ -1250,7 +1246,7 @@ class Views: GLib.Variant.new_string('coverart-browser-list')] self._values[QueueView.name] = [queue_name, GLib.Variant.new_string('coverart-browser-queue')] - #self._values[PlaySourceView.name] = [_('CoverArt Playlist'), + # self._values[PlaySourceView.name] = [_('CoverArt Playlist'), # GLib.Variant.new_string('coverart-browser-playsource')] cl.switch_locale(cl.Locale.RB) print(self._values) @@ -1312,7 +1308,7 @@ class ViewManager(GObject.Object): self._views[CoverFlowView.name] = CoverFlowView() self._views[ListView.name] = ListView() self._views[QueueView.name] = QueueView() - #self._views[PlaySourceView.name] = PlaySourceView() + # self._views[PlaySourceView.name] = PlaySourceView() ui.add_from_file(rb.find_plugin_file(source.plugin, 'ui/coverart_artistview.ui')) self._views[ArtistView.name] = ui.get_object('artist_view') diff --git a/coverart_controllers.py b/coverart_controllers.py index 85ee638..e1aeaa0 100644 --- a/coverart_controllers.py +++ b/coverart_controllers.py @@ -581,7 +581,7 @@ class DecadePopupController(OptionsController): self.values = OrderedDict() self.values[_('All Decades')] = [-1, 'All Decades'] - #'20s' as in the decade 2010 + # '20s' as in the decade 2010 self.values[_('20s')] = [2020, '20s'] #'10s' as in the decade 2010 self.values[_('10s')] = [2010, '10s'] @@ -743,7 +743,7 @@ class AlbumSearchEntryController(OptionsController): return self._typing def _change_filter(self, search_text, force): - #self.search_text = search_text + # self.search_text = search_text self._current_search_text = search_text if search_text: @@ -764,7 +764,7 @@ class AlbumSearchEntryController(OptionsController): self._album_model.remove_filter(self._filter_type) ''' - #self.search_text = search_text + # self.search_text = search_text if force: self._typing_counter = 99 self._typing = False diff --git a/coverart_coverflowview.py b/coverart_coverflowview.py index db8240d..80e4ad3 100644 --- a/coverart_coverflowview.py +++ b/coverart_coverflowview.py @@ -61,7 +61,7 @@ class CoverFlowView(AbstractView): name = 'coverflowview' - #properties + # properties flow_background = GObject.property(type=str, default='W') flow_automatic = GObject.property(type=bool, default=False) flow_scale = GObject.property(type=int, default=100) @@ -413,7 +413,7 @@ class FlowControl(object): cover = row[album_col].cover.original cover = cover.replace( 'rhythmbox-missing-artwork.svg', - 'rhythmbox-missing-artwork.png') ## need a white vs black when we change the background colour + 'rhythmbox-missing-artwork.png') # # need a white vs black when we change the background colour self.album_identifier[index] = row[album_col] items += html_elements( @@ -428,7 +428,7 @@ class FlowControl(object): break if index != 0: - #self.callback_view.last_album = self.album_identifier[0] + # self.callback_view.last_album = self.album_identifier[0] pass else: self.callback_view.last_album = None diff --git a/coverart_covericonview.py b/coverart_covericonview.py index ffc6522..bb35a37 100644 --- a/coverart_covericonview.py +++ b/coverart_covericonview.py @@ -34,13 +34,13 @@ from coverart_browser_prefs import CoverLocale from coverart_album import AlbumsModel from coverart_widgets import AbstractView from coverart_widgets import PanedCollapsible - import rb PLAY_SIZE_X = 30 PLAY_SIZE_Y = 30 + class CellRendererThumb(Gtk.CellRendererPixbuf): markup = GObject.property(type=str, default="") @@ -111,7 +111,7 @@ class CellRendererThumb(Gtk.CellRendererPixbuf): rect_height - 1) cr.fill() - #DRAW FONT + # DRAW FONT cr.set_source_rgba(1.0, 1.0, 1.0, 1.0) cr.move_to(x_offset, y_offset @@ -315,7 +315,7 @@ class CoverIconView(EnhancedIconView, AbstractView): self.connect("drag-data-get", self.on_drag_data_get) # set the model to the view - #self.set_pixbuf_column(AlbumsModel.columns['pixbuf']) + # self.set_pixbuf_column(AlbumsModel.columns['pixbuf']) self.set_model(self.album_manager.model.store) # setup view to monitor mouse movements diff --git a/coverart_entryview.py b/coverart_entryview.py index 27f8ada..e2cba91 100644 --- a/coverart_entryview.py +++ b/coverart_entryview.py @@ -18,6 +18,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. from collections import OrderedDict +from os.path import expanduser from gi.repository import RB from gi.repository import Gtk @@ -40,10 +41,10 @@ from stars import ReactiveStar from coverart_search import CoverSearchPane from coverart_widgets import PixbufButton from coverart_window import CoverWindow -from os.path import expanduser MIN_IMAGE_SIZE = 100 + class EntryViewPane(object): ''' encapulates all of the Track Pane objects @@ -360,7 +361,7 @@ class ResultsGrid(Gtk.Grid): self.connect('whats-playing', self.display_whats_playing) # lets fix the situation where some-themes background colour is incorrectly defined - #in these cases the background colour is black + # in these cases the background colour is black context = self.get_style_context() bg_colour = context.get_background_color(Gtk.StateFlags.NORMAL) if bg_colour == Gdk.RGBA(0, 0, 0, 0): @@ -711,7 +712,7 @@ class BaseView(RB.EntryView): self.source.props.query_model = self.source_query_model # library_view = self.shell.props.library_source.get_entry_view() - #library_view.set_sorting_order('track-number', Gtk.SortType.ASCENDING) + # library_view.set_sorting_order('track-number', Gtk.SortType.ASCENDING) #self.set_sorting_order('track-number', Gtk.SortType.ASCENDING) # Start the music diff --git a/coverart_export.py b/coverart_export.py index 23312b4..348dd85 100644 --- a/coverart_export.py +++ b/coverart_export.py @@ -102,7 +102,7 @@ class CoverArtExport(GObject.Object): embeddialog.destroy() return - #ok pressed - now fetch values from the dialog + # ok pressed - now fetch values from the dialog final_folder_store = folderchooserbutton.get_current_folder() use_album_name = use_album_name_checkbutton.get_active() open_filemanager = open_filemanager_checkbutton.get_active() @@ -230,7 +230,7 @@ class CoverArtExport(GObject.Object): convert = pipeline.get_by_name('convert') decode.link(convert) - #we are going to mimic the following + # we are going to mimic the following # gst-launch-1.0 filesrc location="02 - ABBA - Knowing Me, Knowing You.ogg" ! # decodebin ! audioconvert ! audioresample ! lamemp3enc target=bitrate bitrate=128 ! # xingmux ! id3v2mux ! filesink location="mytrack.mp3" diff --git a/coverart_external_plugins.py b/coverart_external_plugins.py index d5120d4..3f0d40c 100644 --- a/coverart_external_plugins.py +++ b/coverart_external_plugins.py @@ -106,7 +106,7 @@ class ExternalPlugin(GObject.Object): self.attributes['label'] = self.attributes['new_menu_name'] else: self.attributes['label'] = action.label - #self.attributes['sensitive']=action.get_sensitive() + # self.attributes['sensitive']=action.get_sensitive() else: print("action not found") print(self.attributes) @@ -143,8 +143,8 @@ class ExternalPlugin(GObject.Object): ''' action = ApplicationShell(shell).lookup_action(self.attributes['action_group_name'], - self.attributes['action_name'], - self.attributes['action_type']) + self.attributes['action_name'], + self.attributes['action_type']) if action: action.activate() diff --git a/coverart_listview.py b/coverart_listview.py index 994a291..b76234e 100644 --- a/coverart_listview.py +++ b/coverart_listview.py @@ -62,7 +62,7 @@ class ListView(AbstractView): self.view_name = "list_view" super(ListView, self).initialise(source) - #self.album_manager = source.album_manager + # self.album_manager = source.album_manager self.shell = source.shell def switch_to_view(self, source, album): diff --git a/coverart_play_source.py b/coverart_play_source.py index ed080fd..2798da4 100644 --- a/coverart_play_source.py +++ b/coverart_play_source.py @@ -21,6 +21,7 @@ from gi.repository import Gtk from gi.repository import RB from gi.repository import GObject + from coverart_rb3compat import Menu from coverart_external_plugins import CreateExternalPluginMenu from coverart_entryview import CoverArtEntryView @@ -29,6 +30,7 @@ from coverart_rb3compat import ApplicationShell from coverart_browser_prefs import CoverLocale import rb + class CoverArtPlayEntryView(CoverArtEntryView): __hash__ = GObject.__hash__ @@ -44,7 +46,7 @@ class CoverArtPlayEntryView(CoverArtEntryView): 'ui/coverart_play_pop_rb3.ui') signals = { 'remove_from_playlist_menu_item': self.remove_from_playlist_menu_item_callback - } + } popup.connect_signals(signals) popup.connect('pre-popup', self.pre_popup_menu_callback) @@ -61,10 +63,10 @@ class CoverArtPlayEntryView(CoverArtEntryView): self.external_plugins.create_menu('play_popup_menu') def remove_from_playlist_menu_item_callback(self, *args): - print ("remove_from_playlist_menu_item_callback") + print("remove_from_playlist_menu_item_callback") entries = self.get_selected_entries() for entry in entries: - print (entry) + print(entry) self.source.source_query_model.remove_entry(entry) def do_show_popup(self, over_entry): @@ -132,7 +134,7 @@ class CoverArtPlaySource(RB.Source): It creates all the source ui and connects the necessary signals for it correct behavior. ''' - print ('do_impl_activate') + print('do_impl_activate') self.hasActivated = True self.entryview = CoverArtPlayEntryView(self.shell, self.source) @@ -144,7 +146,7 @@ class CoverArtPlaySource(RB.Source): self.entryview.set_model(self.source.source_query_model) # enable sorting on the entryview - #entryview.set_columns_clickable(True) + # entryview.set_columns_clickable(True) self.shell.props.library_source.get_entry_view().set_columns_clickable( True) @@ -166,11 +168,11 @@ class CoverArtPlaySource(RB.Source): appshell = ApplicationShell(self.shell) action_group = ActionGroup(self.shell, 'PlaySourceActions') action_group.add_action(func=self.clear_playsource, - action_name='playsource-clear', action_state=ActionGroup.STANDARD, - action_type='app') + action_name='playsource-clear', action_state=ActionGroup.STANDARD, + action_type='app') action_group.add_action(func=self.shuffle_playsource, - action_name='playsource-shuffle', action_state=ActionGroup.STANDARD, - action_type='app') + action_name='playsource-shuffle', action_state=ActionGroup.STANDARD, + action_type='app') appshell.insert_action_group(action_group) def clear_playsource(self, *args): diff --git a/coverart_playlists.py b/coverart_playlists.py index f873283..aff6cfd 100644 --- a/coverart_playlists.py +++ b/coverart_playlists.py @@ -41,7 +41,7 @@ class WebPlaylist(object): def __init__(self, shell, source, playlist_name): self.shell = shell - #lets fill up the queue with artists + # lets fill up the queue with artists self.candidate_artist = {} self.shell.props.shell_player.connect('playing-song-changed', self.playing_song_changed) self.source = source diff --git a/coverart_playsourceview.py b/coverart_playsourceview.py index 5a9a519..360692f 100644 --- a/coverart_playsourceview.py +++ b/coverart_playsourceview.py @@ -62,7 +62,7 @@ class PlaySourceView(AbstractView): self.view_name = "playsource_view" super(PlaySourceView, self).initialise(source) - #self.album_manager = source.album_manager + # self.album_manager = source.album_manager self.shell = source.shell def switch_to_view(self, source, album): diff --git a/coverart_queueview.py b/coverart_queueview.py index 3e0b633..35f054b 100644 --- a/coverart_queueview.py +++ b/coverart_queueview.py @@ -62,7 +62,7 @@ class QueueView(AbstractView): self.view_name = "queue_view" super(QueueView, self).initialise(source) - #self.album_manager = source.album_manager + # self.album_manager = source.album_manager self.shell = source.shell def switch_to_view(self, source, album): diff --git a/coverart_rb3compat.py b/coverart_rb3compat.py index 26d7f2a..f0ee30c 100644 --- a/coverart_rb3compat.py +++ b/coverart_rb3compat.py @@ -90,14 +90,14 @@ def responses(): def unicodestr(param, charset): if PYVER >= 3: - return param #str(param, charset) + return param # str(param, charset) else: return unicode(param, charset) def unicodeencode(param, charset): if PYVER >= 3: - return param #str(param).encode(charset) + return param # str(param).encode(charset) else: return unicode(param).encode(charset) diff --git a/coverart_search.py b/coverart_search.py index 4e58402..dda6a92 100644 --- a/coverart_search.py +++ b/coverart_search.py @@ -57,7 +57,7 @@ class CoverSearchPane(Gtk.Box): ''' Loads the templates and stylesheets to be used by the pane. ''' - # input_encoding='utf-8', + # input_encoding='utf-8', path = rb.find_plugin_file(plugin, 'tmpl/albumartsearch-tmpl.html') @@ -83,7 +83,7 @@ class CoverSearchPane(Gtk.Box): ''' Initializes the pane ui. ''' - #---- set up webkit pane -----# + # ---- set up webkit pane -----# from gi.repository import WebKit self.webview = WebKit.WebView() @@ -183,6 +183,6 @@ class CoverSearchPane(Gtk.Box): print(title) if title: - #self.album_manager.cover_man.update_cover(self.current_searchobject, + # self.album_manager.cover_man.update_cover(self.current_searchobject, # uri=title) self.callback(self.current_searchobject, uri=title) diff --git a/coverart_toolbar.py b/coverart_toolbar.py index 0ddeb4e..5876a52 100644 --- a/coverart_toolbar.py +++ b/coverart_toolbar.py @@ -61,7 +61,7 @@ class Toolbar(GObject.Object): builder.get_object(button).controller = controller if not webkit_support(): - #button = builder.get_object('flowview_button') + # button = builder.get_object('flowview_button') #button.set_visible(False) separator = builder.get_object('properties_separator') if separator: @@ -85,7 +85,7 @@ class Toolbar(GObject.Object): self.builder = builder.get_object('toolbar') - #now theme the toolbar including child objects such as the button popups + # now theme the toolbar including child objects such as the button popups style_context = self.builder.get_style_context() style_context.add_class(Gtk.STYLE_CLASS_TOOLBAR) @@ -141,7 +141,7 @@ class RightToolbar(Toolbar): class ToolbarObject(object): - #properties + # properties PROPERTIES = 'properties_button' SORT_BY = 'sort_by' diff --git a/coverart_utils.py b/coverart_utils.py index 2ae42f6..445a005 100644 --- a/coverart_utils.py +++ b/coverart_utils.py @@ -534,7 +534,7 @@ class ConfiguredSpriteSheet(object): base = 'theme/theme[@folder_name="' + Theme(plugin).current \ + '"]/spritesheet[@name="' + sprite_name + '"]/' image = rb.find_plugin_file(plugin, 'img/' + Theme(plugin).current \ - + '/' + root.xpath(base + 'image')[0].text) + + '/' + root.xpath(base + 'image')[0].text) icon_width = int(root.xpath(base + 'icon')[0].attrib['width']) icon_height = int(root.xpath(base + 'icon')[0].attrib['height']) x_spacing = int(root.xpath(base + 'spacing')[0].attrib['x']) @@ -624,7 +624,7 @@ class GenreConfiguredSpriteSheet(ConfiguredSpriteSheet): self._parse_popups(plugin, root, self.GENRE_SYSTEM) try: - #self._user_popups = RB.find_user_data_file('plugins/coverart_browser/img/usericons/popups.xml') + # self._user_popups = RB.find_user_data_file('plugins/coverart_browser/img/usericons/popups.xml') self._user_popups = RB.user_cache_dir() + "/coverart_browser/usericons/popups.xml" root = ET.parse(open(self._user_popups)).getroot() self._parse_popups(plugin, root, self.GENRE_USER) diff --git a/coverart_widgets.py b/coverart_widgets.py index 5f600cb..96d2ce5 100644 --- a/coverart_widgets.py +++ b/coverart_widgets.py @@ -293,7 +293,7 @@ class PopupButton(PixbufButton, OptionsPopupWidget): PixbufButton.__init__(self, *args, **kwargs) OptionsPopupWidget.__init__(self, *args, **kwargs) - self._popup_menu.attach_to_widget(self, None) #critical to ensure theming works + self._popup_menu.attach_to_widget(self, None) # critical to ensure theming works self._popup_menu.connect('deactivate', self.popup_deactivate) # initialise some variables @@ -338,7 +338,7 @@ class TextPopupButton(EnhancedButton, OptionsPopupWidget): EnhancedButton.__init__(self, *args, **kwargs) OptionsPopupWidget.__init__(self, *args, **kwargs) - self._popup_menu.attach_to_widget(self, None) #critical to ensure theming works + self._popup_menu.attach_to_widget(self, None) # critical to ensure theming works self._popup_menu.connect('deactivate', self.popup_deactivate) # initialise some variables @@ -372,7 +372,7 @@ class MenuButton(PixbufButton, OptionsPopupWidget): PixbufButton.__init__(self, *args, **kwargs) OptionsPopupWidget.__init__(self, *args, **kwargs) - self._popup_menu.attach_to_widget(self, None) #critical to ensure theming works + self._popup_menu.attach_to_widget(self, None) # critical to ensure theming works self._popup_menu.connect('deactivate', self.popup_deactivate) self._states = {} @@ -434,7 +434,7 @@ class MenuButton(PixbufButton, OptionsPopupWidget): def update_current_key(self): # select the item if it isn't already - #item = self.get_menuitems()[self._controller.get_current_key_index()] + # item = self.get_menuitems()[self._controller.get_current_key_index()] # update the current image and tooltip self.set_image(self._controller.get_current_image()) @@ -511,7 +511,7 @@ class ImageRadioButton(Gtk.RadioButton, OptionsWidget): self.image_display = False self.initialised = False - #ensure button appearance rather than standard radio toggle + # ensure button appearance rather than standard radio toggle self.set_mode(False) #label colours @@ -520,7 +520,7 @@ class ImageRadioButton(Gtk.RadioButton, OptionsWidget): def update_image(self): super(ImageRadioButton, self).update_image() - #self.set_image(self._controller.get_current_image(Gtk.Buildable.get_name(self))) + # self.set_image(self._controller.get_current_image(Gtk.Buildable.get_name(self))) def do_toggled(self): if self.get_active(): @@ -545,7 +545,7 @@ class ImageRadioButton(Gtk.RadioButton, OptionsWidget): def update_current_key(self): # update the current image and tooltip - #self.set_image(self._controller.get_current_image(Gtk.Buildable.get_name(self))) + # self.set_image(self._controller.get_current_image(Gtk.Buildable.get_name(self))) self.set_tooltip_text("") #self._controller.get_current_description()) if self.controller.current_key == Gtk.Buildable.get_name(self): @@ -588,7 +588,7 @@ class SearchEntry(RB.SearchEntry, OptionsPopupWidget): def __init__(self, *args, **kwargs): RB.SearchEntry.__init__(self, *args, **kwargs) OptionsPopupWidget.__init__(self) - #self.props.explicit_mode = True + # self.props.explicit_mode = True @OptionsPopupWidget.controller.setter def controller(self, controller): @@ -1030,6 +1030,7 @@ class EnhancedIconView(Gtk.IconView): self.set_cursor(path, None, False) self.scroll_to_path(path, True, 0.5, 0.5) + class HiddenExpander(Gtk.Bin): __gtype_name__ = "HiddenExpander" @@ -1037,7 +1038,7 @@ class HiddenExpander(Gtk.Bin): label = GObject.property(type=str, default='') def __init__(self, label='', visible=False): - super(HiddenExpander, self).__init__() #*args, **kwargs) + super(HiddenExpander, self).__init__() # *args, **kwargs) self.label = label self.set_visible(visible) @@ -1138,7 +1139,7 @@ class PanedCollapsible(Gtk.Paned): # use half the space current_pos = self.get_allocated_height() - \ - self.get_handle_window().get_height() + self.get_handle_window().get_height() if ((current_pos - self.collapsible_y) < self.Min_Paned_Size): self.collapsible_y = self.get_allocated_height() / 2 @@ -1152,7 +1153,7 @@ class PanedCollapsible(Gtk.Paned): This callback allows or denies the paned handle to move depending on the expanded expander ''' - #if not self._expander or self._expander.get_expanded(): + # if not self._expander or self._expander.get_expanded(): self._from_paned_handle = 1 if event.type == Gdk.EventType._2BUTTON_PRESS: @@ -1168,12 +1169,12 @@ class PanedCollapsible(Gtk.Paned): Gtk.Paned.do_button_release_event(self, *args) if (not self._expander or self._expander.get_expanded()) and self._from_paned_handle == 1: - print ("in an expanded situation") + print("in an expanded situation") self.collapsible_y = self.get_position() # if the current paned handle pos is less than the minimum the force a collapse current_pos = self.get_allocated_height() - \ - self.get_handle_window().get_height() + self.get_handle_window().get_height() if ((current_pos - self.collapsible_y) < self.Min_Paned_Size): self.expand(PanedCollapsible.Paned.COLLAPSE) @@ -1183,14 +1184,14 @@ class PanedCollapsible(Gtk.Paned): if self._expander.get_expanded(): # if we are in an expanded position - lets collapse the pane - print ("collapsing") + print("collapsing") self.expand(PanedCollapsible.Paned.COLLAPSE) else: # the current paned position is closed, so lets open the pane fully self.expand(PanedCollapsible.Paned.EXPAND) - print ("expanding") + print("expanding") self.set_position(0) - print (self.get_position()) + print(self.get_position()) self._from_paned_handle = 0 def do_remove(self, widget): @@ -1256,10 +1257,10 @@ class PanedCollapsible(Gtk.Paned): Gtk.Paned.pack2(self, widget, *args, **kwargs) def _create_expander(self, widget): - #self._expander = Gtk.Expander(label=self.collapsible_label, + # self._expander = Gtk.Expander(label=self.collapsible_label, # visible=True) self._expander = HiddenExpander(label=self.collapsible_label, - visible=True) + visible=True) self._expander.add(widget) @@ -1280,8 +1281,8 @@ class PanedCollapsible(Gtk.Paned): def _collapse(self): new_y = self.get_allocated_height() - \ - self.get_handle_window().get_height()# - \ - # self._expander.get_label_widget().get_allocated_height() + self.get_handle_window().get_height() # - \ + # self._expander.get_label_widget().get_allocated_height() self.set_position(new_y) @@ -1372,14 +1373,14 @@ class AbstractView(GObject.Object): n.show() else: self.source.notification_text.set_text(title + " : " + text) - #self.source.notification_infobar.set_visible(True)#reveal_notification.set_reveal_child(True) - self.source.notification_infobar.show()#reveal_notification.set_reveal_child(True) + # self.source.notification_infobar.set_visible(True)#reveal_notification.set_reveal_child(True) + self.source.notification_infobar.show() #reveal_notification.set_reveal_child(True) if self._notification_displayed == 0: Gdk.threads_add_timeout_seconds(GLib.PRIORITY_DEFAULT_IDLE, 1, - hide_notification, None) + hide_notification, None) else: - self._notification_displayed = 1 # reset notification for new label + self._notification_displayed = 1 # reset notification for new label def resize_icon(self, cover_size): diff --git a/coverart_window.py b/coverart_window.py index 3822be0..2902197 100644 --- a/coverart_window.py +++ b/coverart_window.py @@ -19,8 +19,9 @@ from gi.repository import Gtk from gi.repository import GdkPixbuf -from coverart_browser_prefs import CoverLocale from gi.repository import GObject + +from coverart_browser_prefs import CoverLocale import rb @@ -116,7 +117,7 @@ class CoverWindow(GObject.Object): def update_widgets(self): """Updates image, layout, scrolled window, tool bar and status bar""" # if self.cover_window.window: - # self.cover_window.window.freeze_updates() + # self.cover_window.window.freeze_updates() self.apply_zoom() self.layout.set_size(self.image_pixbuf.get_width(), \ self.image_pixbuf.get_height())