Mercurial > jouvence
changeset 26:9d08d3bcb4ce
Fix some crashes with the console renderer.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 05 Jan 2017 19:37:21 -0800 |
parents | cd284808d139 |
children | 3cc73f810b39 |
files | jouvence/console.py |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/jouvence/console.py Thu Jan 05 09:27:41 2017 -0800 +++ b/jouvence/console.py Thu Jan 05 19:37:21 2017 -0800 @@ -21,24 +21,23 @@ colorama.init() def write_title_page(self, values, out): - known = ['title', 'credit', 'author', 'source'] - center_values = [values.get(i) for i in known - if i is not None] + known = ['title', 'credit', 'author', 'authors', 'source'] + center_values = [values.get(i) for i in known] print("", file=out) for val in center_values: - for l in val.split('\n'): - print(l.center(self.width), file=out) + if val is not None: + for l in val.split('\n'): + print(l.center(self.width), file=out) print("", file=out) print("", file=out) print("", file=out) - ddate = values.get('date') or values.get('draft date') - contact = values.get('contact') - bottom_lines = [i for i in [ddate, contact] - if i is not None] + known = ['date', 'draft date', 'contact', 'copyright'] + bottom_lines = [values.get(i) for i in known] - _w(out, colorama.Style.DIM, '\n\n'.join(bottom_lines)) + _w(out, colorama.Style.DIM, '\n\n'.join([ + b for b in bottom_lines if b is not None])) print("", file=out) _w(out, colorama.Style.DIM, 80 * '=')