本文整理汇总了Python中foobnix.helpers.image.ImageBase.get_pixbuf方法的典型用法代码示例。如果您正苦于以下问题:Python ImageBase.get_pixbuf方法的具体用法?Python ImageBase.get_pixbuf怎么用?Python ImageBase.get_pixbuf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foobnix.helpers.image.ImageBase
的用法示例。
在下文中一共展示了ImageBase.get_pixbuf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: append_image
# 需要导入模块: from foobnix.helpers.image import ImageBase [as 别名]
# 或者: from foobnix.helpers.image.ImageBase import get_pixbuf [as 别名]
def append_image(self, url):
if not url:
return None
enditer = self.buffer.get_end_iter()
image = ImageBase(None)
image.set_image_from_url(url)
self.buffer.insert_pixbuf(enditer, image.get_pixbuf())
示例2: InfoPanelWidget
# 需要导入模块: from foobnix.helpers.image import ImageBase [as 别名]
# 或者: from foobnix.helpers.image.ImageBase import get_pixbuf [as 别名]
#.........这里部分代码省略.........
if not os.path.isdir(COVERS_DIR):
os.mkdir(COVERS_DIR)
list_images = os.listdir(COVERS_DIR)
'''remove extra keys'''
for key in dict.keys():
if (key+'.jpg') not in list_images:
del dict[key]
'''remove extra files'''
for file in list_images:
if os.path.splitext(file)[0] not in dict.keys():
os.remove(os.path.join(COVERS_DIR, file))
for list, key in zip(dict.values(), dict.keys()):
if bean.text in list:
bean.image = os.path.join(COVERS_DIR, key + ".jpg")
break
if not bean.image:
'''get image url'''
bean.image = self.controls.lastfm_service.get_album_image_url(bean.artist, bean.title)
self.image.update_info_from(bean)
if not bean.image:
logging.warning("""""Can't get cover image. Check the correctness of the artist's name and track title""""")
'''make .jpg image and store it in cache'''
if bean.image and bean.image.startswith("http://"):
url_basename = os.path.splitext(os.path.basename(bean.image))[0]
if dict.has_key(url_basename):
dict[url_basename].append(bean.text)
else:
dict[url_basename] = [bean.text]
self.image.get_pixbuf().save(os.path.join(COVERS_DIR, url_basename + '.jpg'), "jpeg", {"quality":"90"})
self.controls.trayicon.update_info_from(bean)
self.controls.coverlyrics.set_cover()
def show_similar_lyrics(self):
if self.info_cache.lyric_bean == self.bean:
return None
self.info_cache.lyric_bean = self.bean
"""lyrics"""
if not os.path.isdir(LYRICS_DIR):
os.mkdir(LYRICS_DIR)
lyrics_list = os.listdir(LYRICS_DIR)
lyrics_title = "*** %s - %s *** \n" % (self.bean.artist, self.bean.title)
if lyrics_title in lyrics_list:
text = "".join(open(os.path.join(LYRICS_DIR, lyrics_title), 'r').readlines())
else:
text = get_lyrics(self.bean.artist, self.bean.title)
if text:
open(os.path.join(LYRICS_DIR, lyrics_title), 'w').write(text)
else:
text = "The text not found"
self.lyrics.set_text(text, lyrics_title)
self.controls.coverlyrics.lyrics.set_text(text, lyrics_title)
def show_wiki_info(self):
if not self.bean:
return
if self.info_cache.wiki_artist == self.bean.artist:
return None