7476: letter as custom paper size generated a ValueError

This commit is contained in:
Jérôme Rapinat 2015-06-07 19:19:07 +02:00
parent 47cdc1e54d
commit 1195448f14

View File

@ -279,10 +279,17 @@ class PaperFrame(Gtk.Box):
return paper_margins return paper_margins
def get_custom_paper_size(self): def get_custom_paper_size(self):
"""Get and validate custom paper size values from dialog entries.
Float values returned.
"""
try:
width = float(self.pwidth.get_text().replace(",", ".")) * \ width = float(self.pwidth.get_text().replace(",", ".")) * \
self.paper_unit_multiplier self.paper_unit_multiplier
height = float(self.pheight.get_text().replace(",", ".")) * \ height = float(self.pheight.get_text().replace(",", ".")) * \
self.paper_unit_multiplier self.paper_unit_multiplier
except ValueError:
width = float(21.0)
height = float(29.7)
paper_size = [max(width, 1.0), max(height, 1.0)] paper_size = [max(width, 1.0), max(height, 1.0)]