Improve Atlas error and status messages

This commit is contained in:
Charles Merriam 2015-01-27 14:31:43 -08:00
parent a075a24f1f
commit e1c0445370
1 changed files with 8 additions and 8 deletions

View File

@ -294,8 +294,8 @@ class Atlas(EventDispatcher):
imh += padding imh += padding
if imw > size_w or imh > size_h: if imw > size_w or imh > size_h:
Logger.error( Logger.error(
'Atlas: image %s is larger than the atlas size!' % 'Atlas: image %s (%d by %d) is larger than the atlas size!'
imageinfo[0]) % (imageinfo[0], imw, imh))
return return
inserted = False inserted = False
@ -392,8 +392,8 @@ if __name__ == '__main__':
import sys import sys
argv = sys.argv[1:] argv = sys.argv[1:]
if len(argv) < 3: if len(argv) < 3:
print('Usage: python -m kivy.atlas [--use-path] ' print('Usage: python -m kivy.atlas [-- [--use-path] '
'[--padding=2] <outname> ' '[--padding=2]] <outname> '
'<size|512x256> <img1.png> [<img2.png>, ...]') '<size|512x256> <img1.png> [<img2.png>, ...]')
sys.exit(1) sys.exit(1)
@ -405,7 +405,7 @@ if __name__ == '__main__':
elif option.startswith('--padding='): elif option.startswith('--padding='):
options['padding'] = int(option.split('=', 1)[-1]) options['padding'] = int(option.split('=', 1)[-1])
elif option[:2] == '--': elif option[:2] == '--':
print('Unknow option {}'.format(option)) print('Unknown option {}'.format(option))
sys.exit(1) sys.exit(1)
else: else:
break break
@ -418,7 +418,7 @@ if __name__ == '__main__':
else: else:
size = int(argv[1]) size = int(argv[1])
except ValueError: except ValueError:
print('Error: size must be an integer') print('Error: size must be an integer or <integer>x<integer>')
sys.exit(1) sys.exit(1)
filenames = argv[2:] filenames = argv[2:]
@ -429,5 +429,5 @@ if __name__ == '__main__':
fn, meta = ret fn, meta = ret
print('Atlas created at', fn) print('Atlas created at', fn)
print('%d image%s have been created' % (len(meta), print('%d image%s been created' % (len(meta),
's' if len(meta) > 1 else '')) 's have' if len(meta) > 1 else ' has'))