diff --git a/src/Mod/Draft/draftutils/init_draft_statusbar.py b/src/Mod/Draft/draftutils/init_draft_statusbar.py index 5d41b8b6a1..67a700b113 100644 --- a/src/Mod/Draft/draftutils/init_draft_statusbar.py +++ b/src/Mod/Draft/draftutils/init_draft_statusbar.py @@ -97,14 +97,22 @@ def scale_to_label(scale): """ transform a float number into a 1:X or X:1 scale and return it as label """ - f = 1/scale - f = round(f,2) - f = f.as_integer_ratio() - if f[1] == 1 or f[0] == 1: - label = str(f[1]) + ":" + str(f[0]) - return label + f = round(scale, 2) + if f == 1.0: + return "1:1" + elif f > 1.0: + f = f.as_integer_ratio() + if f[1] == 1: + return str(f[0]) + ":1" + else: + return str(scale) else: - return str(scale) + f = round(1/scale, 2) + f = f.as_integer_ratio() + if f[1] == 1: + return "1:" + str(f[0]) + else: + return str(scale) def label_to_scale(label): """