diff --git a/.gitignore b/.gitignore index 89634ac..6eb93ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ venv/ -images/ -logo.png - dist/ assm/__pycache__ diff --git a/assm/__init__.py b/assm/__init__.py index 91a2029..ad9d943 100644 --- a/assm/__init__.py +++ b/assm/__init__.py @@ -1,3 +1,3 @@ """iOS splash screen generator""" -__version__ = "0.1.11" +__version__ = "0.1.1" diff --git a/assm/__main__.py b/assm/__main__.py index efca70d..03a212c 100644 --- a/assm/__main__.py +++ b/assm/__main__.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python3 +"""iOS splash screen generator""" import os -import json from PIL import Image from assm.devices import APPLE_DEVICES -def makeSplashImage(screen_orientation, screen_width, screen_height, logo_path='logo.png'): + +def make_splash_image(screen_orientation, screen_width, screen_height, logo_path): """ Generate splash image """ # swap screen sizes @@ -21,9 +21,12 @@ def makeSplashImage(screen_orientation, screen_width, screen_height, logo_path=' app_logo = logo_image.resize((logo_size, logo_size)) splash_image.paste(app_logo, (logo_w_pos, logo_h_pos), app_logo) - return(splash_image) + return splash_image + def main(output_folder='./images/'): + """Sample main function""" + # check folder exists if not os.path.exists(output_folder): os.mkdir(output_folder) @@ -32,31 +35,34 @@ def main(output_folder='./images/'): print('Generate portrait splash...') for device in APPLE_DEVICES: - w = APPLE_DEVICES[device][0] - h = APPLE_DEVICES[device][1] + device_w = APPLE_DEVICES[device][0] + device_h = APPLE_DEVICES[device][1] - file_name = '{folder}/splash-portrait-{height}x{width}.png'.format( - folder=output_folder, width=w, height=h) - - splash = makeSplashImage('portrait', w, h, 'logo.png') + file_name = '{f}/splash-portrait-{h}x{w}.png'.format( + f=output_folder, w=device_w, h=device_h + ) + + splash = make_splash_image('portrait', device_w, device_h, 'logo.png') splash.save(file_name) - print('..splash for {w}x{h} saved...'.format(w=w, h=h)) + print('..splash for {w}x{h} saved...'.format(w=device_w, h=device_h)) # landscape print('Generate landscape splash...') for device in APPLE_DEVICES: - w = APPLE_DEVICES[device][0] - h = APPLE_DEVICES[device][1] + device_w = APPLE_DEVICES[device][0] + device_h = APPLE_DEVICES[device][1] - file_name = '{folder}/splash-landscape-{height}x{width}.png'.format( - folder=output_folder, width=w, height=h) + file_name = '{f}/splash-landscape-{h}x{w}.png'.format( + f=output_folder, w=device_w, h=device_h + ) - splash = makeSplashImage('landscape', w, h, 'logo.png') + splash = make_splash_image('landscape', device_w, device_h, 'logo.png') splash.save(file_name) - print('...splash for {h}x{w} saved...'.format(w=w, h=h)) + print('...splash for {h}x{w} saved...'.format(w=device_w, h=device_h)) + if __name__ == '__main__': main() diff --git a/assm/devices.py b/assm/devices.py index b698f3d..fa5f598 100644 --- a/assm/devices.py +++ b/assm/devices.py @@ -1,3 +1,5 @@ +"""Default iOS screen sizes""" + APPLE_DEVICES = { 'iPhone SE': [640, 1136], 'iPhone 6/7/8': [750, 1334], @@ -8,5 +10,5 @@ APPLE_DEVICES = { '9.7" iPad': [1536, 2048], '10.5" iPad Pro': [1668, 2224], '11" iPad Pro': [1668, 2388], - '12.9" iPad Pro': [2048, 2732] + '12.9" iPad Pro': [2048, 2732], } diff --git a/dev_requirements.txt b/dev_requirements.txt new file mode 100644 index 0000000..b67b704 --- /dev/null +++ b/dev_requirements.txt @@ -0,0 +1,3 @@ +black==20.8b1 +flit==3.0.0 +pylint==2.7.1 diff --git a/preview.png b/preview.png deleted file mode 100644 index 880358f..0000000 Binary files a/preview.png and /dev/null differ