many pylint fixes
This commit is contained in:
parent
4ce860a6ed
commit
15837b7c3c
@ -3,11 +3,12 @@
|
|||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint # pylint: disable=unused-import
|
||||||
import pygame
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pygame
|
||||||
|
|
||||||
# The guide in tiles/guide.png is quite helpful.
|
# The guide in tiles/guide.png is quite helpful.
|
||||||
|
|
||||||
# TODO: sort the stuff in free/ and noncommercial/
|
# TODO: sort the stuff in free/ and noncommercial/
|
||||||
@ -92,7 +93,7 @@ def unglob(list_of_globs):
|
|||||||
result = []
|
result = []
|
||||||
for file in list_of_globs:
|
for file in list_of_globs:
|
||||||
globbed_files = glob.glob(file)
|
globbed_files = glob.glob(file)
|
||||||
assert len(globbed_files) > 0, 'glob for %s should be non-empty' % file
|
assert globbed_files, 'glob for %s should be non-empty' % file
|
||||||
result.extend(globbed_files)
|
result.extend(globbed_files)
|
||||||
result.sort()
|
result.sort()
|
||||||
return result
|
return result
|
||||||
@ -104,7 +105,7 @@ def input_wh(prompt):
|
|||||||
try:
|
try:
|
||||||
cols, rows = [int(x) for x in geometry.split(' ')]
|
cols, rows = [int(x) for x in geometry.split(' ')]
|
||||||
return cols, rows
|
return cols, rows
|
||||||
except:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -240,15 +241,15 @@ def edit_sprite_metadata(filename, metadata=None):
|
|||||||
|
|
||||||
def annotate_sprites(all_metadata, sprite_files):
|
def annotate_sprites(all_metadata, sprite_files):
|
||||||
pygame.init()
|
pygame.init()
|
||||||
surface = pygame.display.set_mode((1200, 900), pygame.RESIZABLE)
|
pygame.display.set_mode((1200, 900), pygame.RESIZABLE)
|
||||||
|
|
||||||
for filename in sprite_files:
|
for filename in sprite_files:
|
||||||
sprite_metadata, quit = edit_sprite_metadata(
|
sprite_metadata, should_quit = edit_sprite_metadata(
|
||||||
filename, all_metadata.get(filename))
|
filename, all_metadata.get(filename))
|
||||||
all_metadata[filename] = sprite_metadata
|
all_metadata[filename] = sprite_metadata
|
||||||
with open('sprites.json', 'w') as f:
|
with open('sprites.json', 'w') as f:
|
||||||
json.dump(all_metadata, f, sort_keys=True, indent=2)
|
json.dump(all_metadata, f, sort_keys=True, indent=2)
|
||||||
if quit:
|
if should_quit:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -284,7 +285,8 @@ def stitch_sprites(metadata, filename_base):
|
|||||||
print('\n# named sprites:', len(sprites))
|
print('\n# named sprites:', len(sprites))
|
||||||
print('result will be %dx%d' % (total_width, max_height))
|
print('result will be %dx%d' % (total_width, max_height))
|
||||||
|
|
||||||
output = pygame.Surface((total_width, max_height), pygame.SRCALPHA)
|
output = pygame.surface.Surface(
|
||||||
|
(total_width, max_height), flags=pygame.SRCALPHA)
|
||||||
output_json = {}
|
output_json = {}
|
||||||
xpos = 0
|
xpos = 0
|
||||||
for sprite_name, sprite in sprites.items():
|
for sprite_name, sprite in sprites.items():
|
||||||
@ -309,7 +311,6 @@ def stitch_sprites(metadata, filename_base):
|
|||||||
json.dump(output_json, json_file, sort_keys=True, indent=2)
|
json.dump(output_json, json_file, sort_keys=True, indent=2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
os.chdir(os.path.expanduser('~/time_fantasy'))
|
os.chdir(os.path.expanduser('~/time_fantasy'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user