Catch InvalidOperation when rounding inserted number
Closes #12866 (grafted from 1d56c462e03ce4eb93a1cd1e4dad10cd736e1105) --HG-- branch : 7.0
This commit is contained in:
1 parent
ace6906d28
commit
91cd2f8deb
1 file changed
+6
-3
@@ -64,9 +64,12 @@ class NumberEntry(Gtk.Entry, Gtk.Editable):
|
||||
value = Decimal(locale.delocalize(text, self.monetary))
|
||||
except (ValueError, InvalidOperation):
|
||||
return position
|
||||
if (value and self.__digits is not None
|
||||
and (round(value, self.__digits) != value
|
||||
or value.as_tuple().exponent < -self.__digits)):
|
||||
try:
|
||||
if (value and self.__digits is not None
|
||||
and (round(value, self.__digits) != value
|
||||
or value.as_tuple().exponent < -self.__digits)):
|
||||
return position
|
||||
except InvalidOperation:
|
||||
return position
|
||||
buffer_.insert_text(position, new_text, len(new_text))
|
||||
return position + len(new_text)
|
||||
|
||||
Reference in new issue
Block a user