diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-07-14 16:12:42 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-07-14 16:12:42 +0100 |
commit | 95c26349d6b2f34214e6b069cb6328705b87133c (patch) | |
tree | ae0b6a301c343e9c58695ee68155bbd5647dc9f1 | |
parent | c4f784d3227eb6c4344a18bc9be347799203ac7f (diff) | |
download | sspreview-95c26349d6b2f34214e6b069cb6328705b87133c.tar.gz sspreview-95c26349d6b2f34214e6b069cb6328705b87133c.zip |
CLI for frame width and height
-rwxr-xr-x | sspreview | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -32,7 +32,7 @@ DEF_S = 10 class Preview(object): - def __init__(self, spritesheet, error_fn): + def __init__(self, spritesheet, frame_w, frame_h, error_fn): self.spritesheet = spritesheet self.error = error_fn self.frames = [] @@ -52,10 +52,10 @@ class Preview(object): self.img.grid(column=0, row=0, columnspan=2, sticky=N, padx=10) self.frame_w = StringVar() - self.frame_w.set(DEF_W) + self.frame_w.set(frame_w) self.frame_h = StringVar() - self.frame_h.set(DEF_W) + self.frame_h.set(frame_h) self.frame_list = StringVar() self.frame_list.set(DEF_F) @@ -177,9 +177,13 @@ if __name__ == "__main__": parser.add_argument( "--version", action="version", version="%(prog)s " + __version__ ) + parser.add_argument("--width", dest="w", default=DEF_W, type=int, + help="frame width (default: %s)" % DEF_W) + parser.add_argument("--height", dest="h", default=DEF_H, type=int, + help="frame height (default: %s)" % DEF_H) parser.add_argument("image", help="spritesheet to ipreview") args = parser.parse_args() - Preview(args.image, parser.error).run() + Preview(args.image, args.w, args.h, parser.error).run() |