pycharm autorefactor

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