Draft: make default anno style non-global

Additionally:
* Added the DimShowLine preference. Layout of the tab will be updated later.
* Improved handling of DraftAnnotationScale preference: catch division by zero and use it for the default anno style.
This commit is contained in:
Roy-043
2023-11-22 19:55:20 +01:00
committed by Yorik van Havre
parent f683681e92
commit 8944c79ebe
6 changed files with 81 additions and 57 deletions

View File

@@ -97,22 +97,21 @@ def scale_to_label(scale):
"""
transform a float number into a 1:X or X:1 scale and return it as label
"""
f = round(scale, 2)
if f == 1.0:
if scale <= 0:
return "1:1"
elif f > 1.0:
f = round(scale, 2)
if f == 1:
return "1:1"
if f > 1:
f = f.as_integer_ratio()
if f[1] == 1:
return str(f[0]) + ":1"
else:
return str(scale)
else:
f = round(1/scale, 2)
f = f.as_integer_ratio()
if f[1] == 1:
return "1:" + str(f[0])
else:
return str(scale)
return str(scale)
f = round(1/scale, 2)
f = f.as_integer_ratio()
if f[1] == 1:
return "1:" + str(f[0])
return str(scale)
def label_to_scale(label):
"""