예제 #1
0
파일: pics.py 프로젝트: TheGurke/Progenitus
def _get_path(cardid):
	"""Returns the file path for the card picture"""
	if cardid == "deckmaster":
		return config.DECKMASTER_PATH
	if cards.is_token(cardid):
		return os.path.join(settings.cache_dir, config.TOKEN_PICS_PATH(cardid))
	else:
		return os.path.join(settings.cache_dir, config.CARD_PICS_PATH(cardid))
예제 #2
0
파일: pics.py 프로젝트: TheGurke/Progenitus
def _load(cardid):
	"""Load a card picture from the disk"""
	filename = _get_path(cardid)
	if not os.path.isfile(filename):
		if cards.is_token(cardid):
			logging.error(_("Picture for token %s not found."), cardid)
		else:
			logging.error(_("Picture for card %s not found."), cardid)
	pixbuf = gtk.gdk.pixbuf_new_from_file(filename).add_alpha(False, 0, 0, 0)
	global _map
	if not settings.save_ram:
		_map[cardid] = pixbuf
	return pixbuf