From 4dcbee5dc93f5ffb7c5dd70f36c17d9cad9bc004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Wed, 7 Nov 2012 01:38:34 +0100 Subject: [PATCH] sort metadata tags on save --- ponysay-tool.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ponysay-tool.py b/ponysay-tool.py index dfa39b41..9130afcd 100755 --- a/ponysay-tool.py +++ b/ponysay-tool.py @@ -758,7 +758,9 @@ class PonysayTool(): comment = ('\n' + comment + '\n').replace('\n$$$\n', '\n\\$$$\n')[:-1] meta = [] - for key in self.data: + keys = [key for key in data] + keys.sort() + for key in keys: if (key == 'comment') or (len(self.data[key].strip()) == 0): continue values = self.data[key].strip() @@ -767,6 +769,7 @@ class PonysayTool(): meta.append('WIDTH: ' + str(self.ponywidth)) meta.append('HEIGHT: ' + str(self.ponyheight)) + # TODO auto fill in BALLOON {TOP,BOTTOM} meta.append(comment) meta = '\n'.join(meta) ponydata = '$$$\n' + meta + '\n$$$\n' + '\n'.join(self.image) @@ -784,7 +787,7 @@ class PonysayTool(): ''' GNU Emacs alike text area ''' -class TextArea: +class TextArea: # TODO support small screens ''' Constructor