add check logo exist

This commit is contained in:
Alexander Popov 2021-07-21 23:27:40 +03:00
parent 21500a34e3
commit 3ecc980fb1
4 changed files with 20 additions and 11 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
venv/
dist/
assm/__pycache__
images/
logo.png

View File

@ -1,3 +1,3 @@
"""iOS splash screen generator"""
__version__ = "0.1.1"
__version__ = "0.1.2"

View File

@ -19,7 +19,14 @@ def make_splash_image(screen_orientation, screen_width, screen_height, logo_path
splash_image = Image.new('RGB', (screen_width, screen_height), (255, 255, 255))
logo_image = Image.open(logo_path)
app_logo = logo_image.resize((logo_size, logo_size))
splash_image.paste(app_logo, (logo_w_pos, logo_h_pos), app_logo)
try:
splash_image.paste(app_logo, (logo_w_pos, logo_h_pos), app_logo)
except ValueError as e:
if str(e) == 'bad transparency mask':
print('ERROR: Bad transparency mask.')
quit(-1)
return splash_image
@ -42,10 +49,14 @@ def main(output_folder='./images/'):
f=output_folder, w=device_w, h=device_h
)
splash = make_splash_image('portrait', device_w, device_h, 'logo.png')
try:
splash = make_splash_image('portrait', device_w, device_h, 'logo.png')
except FileNotFoundError as e:
print('ERROR: File logo.png not found.')
quit(1)
splash.save(file_name)
print('..splash for {w}x{h} saved...'.format(w=device_w, h=device_h))
print('...splash for {w}x{h} saved...'.format(w=device_w, h=device_h))
# landscape
print('Generate landscape splash...')

View File

@ -7,24 +7,20 @@ module = "assm"
author = "Alexander Popov"
author-email = "iiiypuk@iiiypuk.me"
home-page = "https://github.com/emilecok/assm"
requires = ["Pillow==8.1.0" ]
requires = ["Pillow==8.3.1" ]
description-file = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3"
]
requires-python = ">=3"
keywords = [
"iOS",
"splashscreen",
"splash-screen"
]
keywords = "iOS,splashscreen,splash-screen"
[tool.flit.metadata.requires-extra]
dev = ["pylint == 2.7.1", "black == 20.8b1"]
[tool.flit.metadata.urls]
Documentation = ""
Documentation = "https://docs/"
[tool.black]
line-length = 99