From bdd44b57fd18c00087e3cecb3130a1baeff66552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Sun, 7 Jun 2015 19:17:29 +0200 Subject: [PATCH] 7476: letter as custom paper size generated a ValueError --- gramps/gui/plug/report/_papermenu.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gramps/gui/plug/report/_papermenu.py b/gramps/gui/plug/report/_papermenu.py index 5f20808c1..9db4b5e9c 100644 --- a/gramps/gui/plug/report/_papermenu.py +++ b/gramps/gui/plug/report/_papermenu.py @@ -279,10 +279,17 @@ class PaperFrame(Gtk.Box): return paper_margins def get_custom_paper_size(self): - width = float(self.pwidth.get_text().replace(",", ".")) * \ + """Get and validate custom paper size values from dialog entries. + Float values returned. + """ + try: + width = float(self.pwidth.get_text().replace(",", ".")) * \ self.paper_unit_multiplier - height = float(self.pheight.get_text().replace(",", ".")) * \ + height = float(self.pheight.get_text().replace(",", ".")) * \ self.paper_unit_multiplier + except ValueError: + width = float(21.0) + height = float(29.7) paper_size = [max(width, 1.0), max(height, 1.0)]