Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 13, 2024
1 parent 9ad07c7 commit d369cce
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 24 deletions.
13 changes: 9 additions & 4 deletions scripts/update-xcode-imessage-iconset.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from typing import Dict, Tuple
import json
from pathlib import Path
from typing import Dict, Tuple

ROOT_DIR = Path(__file__).parents[1]


def main():
xcode_imessage_iconset: Dict[str, Tuple[int, int]] = {}

with open(ROOT_DIR / "src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json") as f:
with open(
ROOT_DIR
/ "src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json"
) as f:
dict = json.load(f)

for i in dict["images"]:
Expand All @@ -20,8 +24,9 @@ def main():
size_h_scaled = size_h * scale

xcode_imessage_iconset[filename] = (size_w_scaled, size_h_scaled)

print(xcode_imessage_iconset)


if __name__ == "__main__":
main()
main()
4 changes: 2 additions & 2 deletions src/sticker_convert/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def __init__(self) -> None:

def cli(self) -> None:
try:
from sticker_convert.utils.files.json_resources_loader import HELP_JSON, INPUT_JSON, COMPRESSION_JSON, OUTPUT_JSON, EMOJI_JSON
from sticker_convert.utils.files.json_resources_loader import COMPRESSION_JSON, EMOJI_JSON, HELP_JSON, INPUT_JSON, OUTPUT_JSON
except RuntimeError as e:
self.cb.msg(e.__str__())
return

self.help = HELP_JSON
self.input_presets = INPUT_JSON
self.compression_presets = COMPRESSION_JSON
Expand Down
1 change: 1 addition & 0 deletions src/sticker_convert/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"cannot get below limit {} with lowest quality under current settings (Best size: {})"
)


def rounding(value: float) -> Decimal:
return Decimal(value).quantize(0, ROUND_HALF_UP)

Expand Down
4 changes: 2 additions & 2 deletions src/sticker_convert/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ def warn_tkinter_bug(self) -> None:

def load_jsons(self) -> None:
try:
from sticker_convert.utils.files.json_resources_loader import HELP_JSON, INPUT_JSON, COMPRESSION_JSON, OUTPUT_JSON, EMOJI_JSON
from sticker_convert.utils.files.json_resources_loader import COMPRESSION_JSON, EMOJI_JSON, HELP_JSON, INPUT_JSON, OUTPUT_JSON
except RuntimeError as e:
self.cb_msg(e.__str__())
return

self.help = HELP_JSON
self.input_presets = INPUT_JSON
self.compression_presets = COMPRESSION_JSON
Expand Down
27 changes: 14 additions & 13 deletions src/sticker_convert/uploaders/xcode_imessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@
from sticker_convert.utils.media.format_verify import FormatVerify

XCODE_IMESSAGE_ICONSET = {
'App-Store-1024x1024pt.png': (1024, 1024),
'[email protected]': (58, 58),
'[email protected]': (58, 58),
'[email protected]': (87, 87),
'[email protected]': (54, 40),
'[email protected]': (81, 60),
'[email protected]': (64, 48),
'[email protected]': (96, 72),
'Messages-App-Store-1024x768pt.png': (1024, 768),
'[email protected]': (134, 100),
'[email protected]': (148, 110),
'[email protected]': (120, 90),
'[email protected]': (180, 135)
"App-Store-1024x1024pt.png": (1024, 1024),
"[email protected]": (58, 58),
"[email protected]": (58, 58),
"[email protected]": (87, 87),
"[email protected]": (54, 40),
"[email protected]": (81, 60),
"[email protected]": (64, 48),
"[email protected]": (96, 72),
"Messages-App-Store-1024x768pt.png": (1024, 768),
"[email protected]": (134, 100),
"[email protected]": (148, 110),
"[email protected]": (120, 90),
"[email protected]": (180, 135),
}


class XcodeImessage(UploadBase):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super(XcodeImessage, self).__init__(*args, **kwargs)
Expand Down
4 changes: 3 additions & 1 deletion src/sticker_convert/utils/files/json_resources_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from sticker_convert.definitions import ROOT_DIR
from sticker_convert.utils.files.json_manager import JsonManager

HELP_JSON: Dict[str, Dict[str, str]] = JsonManager.load_json(ROOT_DIR / "resources/help.json")
HELP_JSON: Dict[str, Dict[str, str]] = JsonManager.load_json(
ROOT_DIR / "resources/help.json"
)
INPUT_JSON = JsonManager.load_json(ROOT_DIR / "resources/input.json")
COMPRESSION_JSON = JsonManager.load_json(ROOT_DIR / "resources/compression.json")
OUTPUT_JSON = JsonManager.load_json(ROOT_DIR / "resources/output.json")
Expand Down
2 changes: 1 addition & 1 deletion src/sticker_convert/utils/files/metadata_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from sticker_convert.utils.files.json_resources_loader import INPUT_JSON, OUTPUT_JSON
from sticker_convert.utils.media.codec_info import CodecInfo


RELATED_EXTENSIONS = (
".png",
".apng",
Expand Down Expand Up @@ -39,6 +38,7 @@
BLACKLIST_PREFIX = ("cover",)
BLACKLIST_SUFFIX = (".txt", ".m4a", ".wastickers", ".DS_Store", "._.DS_Store")


def check_if_xcodeproj(path: Path) -> bool:
if not path.is_dir():
return False
Expand Down
3 changes: 2 additions & 1 deletion src/sticker_convert/utils/files/sanitize_filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"LPT7",
"LPT8",
"LPT9",
) # Reserved words on Windows
) # Reserved words on Windows


def sanitize_filename(filename: str) -> str:
# Based on https://gitlab.com/jplusplus/sanitize-filename/-/blob/master/sanitize_filename/sanitize_filename.py
Expand Down

0 comments on commit d369cce

Please sign in to comment.