mirror of https://github.com/zulip/zulip.git
emoji: Refactor `generate_sprite_css_files()` to take emojiset in args.
This commit is contained in:
parent
67bbbbb007
commit
36b977c382
|
@ -102,7 +102,9 @@ def get_success_stamp() -> str:
|
|||
sha1_hexdigest = generate_sha1sum_emoji(ZULIP_PATH)
|
||||
return os.path.join(EMOJI_CACHE_PATH, sha1_hexdigest, 'emoji', '.success-stamp')
|
||||
|
||||
def generate_sprite_css_files(cache_path: str, emoji_data: List[Dict[str, Any]]) -> None:
|
||||
def generate_sprite_css_files(cache_path: str,
|
||||
emoji_data: List[Dict[str, Any]],
|
||||
emojiset: str) -> None:
|
||||
# Spritesheet CSS generation code.
|
||||
emoji_positions = ""
|
||||
for emoji in emoji_data:
|
||||
|
@ -118,13 +120,12 @@ def generate_sprite_css_files(cache_path: str, emoji_data: List[Dict[str, Any]])
|
|||
'pos_y': (emoji["sheet_y"] * 100) / 51,
|
||||
}
|
||||
|
||||
for emojiset in EMOJISETS:
|
||||
SPRITE_CSS_PATH = os.path.join(cache_path, '%s_sprite.css' % (emojiset,))
|
||||
sprite_css_file = open(SPRITE_CSS_PATH, 'w')
|
||||
sprite_css_file.write(SPRITE_CSS_FILE_TEMPLATE % {'emojiset': emojiset,
|
||||
'emoji_positions': emoji_positions,
|
||||
})
|
||||
sprite_css_file.close()
|
||||
SPRITE_CSS_PATH = os.path.join(cache_path, '%s_sprite.css' % (emojiset,))
|
||||
sprite_css_file = open(SPRITE_CSS_PATH, 'w')
|
||||
sprite_css_file.write(SPRITE_CSS_FILE_TEMPLATE % {'emojiset': emojiset,
|
||||
'emoji_positions': emoji_positions,
|
||||
})
|
||||
sprite_css_file.close()
|
||||
|
||||
def setup_emoji_farm(cache_path: str, emoji_data: List[Dict[str, Any]]) -> None:
|
||||
def ensure_emoji_image(emoji_dict: Dict[str, Any]) -> None:
|
||||
|
@ -169,7 +170,7 @@ def setup_emoji_farm(cache_path: str, emoji_data: List[Dict[str, Any]]) -> None:
|
|||
output_img_file = os.path.join(cache_path, 'images-' + emojiset + '-64', '1f419.png')
|
||||
run(['cp', input_img_file, output_img_file])
|
||||
|
||||
generate_sprite_css_files(cache_path, emoji_data)
|
||||
generate_sprite_css_files(cache_path, emoji_data, emojiset)
|
||||
|
||||
def setup_old_emoji_farm(cache_path: str,
|
||||
emoji_map: Dict[str, str],
|
||||
|
|
Loading…
Reference in New Issue