Draft: display coordinates using the current locale's decimal separator - fixes #1741

This commit is contained in:
Yorik van Havre 2014-09-27 16:23:59 -03:00
parent e820a32653
commit 463b5d4a7e

View File

@ -133,6 +133,7 @@ def displayExternal(internValue,decimals=4,dim='Length',showUnit=True):
'''return an internal value (ie mm) Length or Angle converted for display according '''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use.''' to Units Schema in use.'''
from FreeCAD import Units from FreeCAD import Units
if dim == 'Length': if dim == 'Length':
qty = FreeCAD.Units.Quantity(internValue,FreeCAD.Units.Length) qty = FreeCAD.Units.Quantity(internValue,FreeCAD.Units.Length)
pref = qty.getUserPreferred() pref = qty.getUserPreferred()
@ -150,6 +151,7 @@ def displayExternal(internValue,decimals=4,dim='Length',showUnit=True):
uom = "" uom = ""
fmt = "{0:."+ str(decimals) + "f} "+ uom fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion)) displayExt = fmt.format(float(internValue) / float(conversion))
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint())
return displayExt return displayExt
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------