File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,9 +147,14 @@ def set_font( self, font ):
147147 def set_value ( self , value ):
148148 val = value
149149 try :
150- val = str ( locale .format_string ( "%f" , float ( val ) ).rstrip ( "0" ) )
151- if val [- 1 ] == locale .localeconv ()["decimal_point" ]:
152- val = val .rstrip ( locale .localeconv ()["decimal_point" ] )
150+ if self .use_localization :
151+ val = str ( locale .format_string ( "%f" , float ( val ) ).rstrip ( "0" ) )
152+ if val [- 1 ] == locale .localeconv ()["decimal_point" ]:
153+ val = val .rstrip ( locale .localeconv ()["decimal_point" ] )
154+ else :
155+ val = str (float ( val )).rstrip ( "0" )
156+ if val [- 1 ] == "." :
157+ val = val .rstrip ("." )
153158 except :
154159 value = "Error"
155160 self .delete ()
@@ -160,11 +165,12 @@ def get_value( self ):
160165 self .compute ()
161166 try :
162167 value = self .entry .get_text ()
163- return locale .atof ( value )
168+ if self .use_localization :
169+ return locale .atof ( value )
170+ else :
171+ return float (value )
164172 except :
165173 return None
166- # print( "value in get value = ", value )
167- # print( "converted value in get value = ", locale.atof( value ) )
168174
169175 def get_preset_value ( self ):
170176 return self .preset_value
You can’t perform that action at this time.
0 commit comments