From 75db9b7024c8350b7dabf2176ec50597232b2bc5 Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Fri, 9 Oct 2026 08:55:46 +0200 Subject: [PATCH] Drei alte Fehler behoben - create_picture: und Dateiausgabe erst nach allen Zeilen (vorher pro Zeile, kaputtes SVG bei mehreren Zeilen) - yalign=bottom: word_height wird jetzt berechnet (vorher NameError) - CompleteEnding: ValueError statt undefiniertem Csv2CouchError Co-Authored-By: Claude Opus 5.5 --- libs/piccreate.py | 15 ++++++++------- libs/utils.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libs/piccreate.py b/libs/piccreate.py index a8806f1..c8b7be6 100644 --- a/libs/piccreate.py +++ b/libs/piccreate.py @@ -108,6 +108,7 @@ def write_font_line( content, font, params ): word_height = w.calc_height() y = ystart * scale_faktor + (pic_height - word_height * scale_faktor)/2.0 elif params['yalign'] == 'bottom': + word_height = w.calc_height() y = ystart * scale_faktor + pic_height - word_height * scale_faktor else: y = ystart @@ -301,14 +302,14 @@ def create_picture(config, fontinfos, data, pic_path): randstr = write_random_font_line( content, font, lineparams) if randstr: svgstr = svgstr + randstr - svgstr = svgstr + picend + svgstr = svgstr + picend - if options.dry: - print(svgstr) - else: - f = open(pic_path, 'w', encoding='utf-8') - f.write( svgstr ) - f.close() + if options.dry: + print(svgstr) + else: + f = open(pic_path, 'w', encoding='utf-8') + f.write( svgstr ) + f.close() def main( config ): diff --git a/libs/utils.py b/libs/utils.py index c58f3ab..35d0f83 100644 --- a/libs/utils.py +++ b/libs/utils.py @@ -88,7 +88,7 @@ def get_translation(cfg_path, sec_name): def CompleteEnding(path, newext): ''' Fügt die gegebene File Extension an den Filename/Pfad ''' - if not path: raise Csv2CouchError('no path given') + if not path: raise ValueError('no path given') path, ext = os.path.splitext(path) if not re.match(newext, ext): path = path +'.'+newext