Conversation
Lines containing whitespace only are skipped rather than creating a new line with all '0' A message is shown on startup if - duplicate tool numbers have been found in the tool table - orientation is not in range 0...9 - a line is malformed, these are saved to a separate file so they are not silently deleted on save
The tool number for a new tool is preset to one above the highest nummber found in the table instead of '0'
| value = float(self.entry.get_text()) | ||
| if self.integer_only: | ||
| if value != int(value): | ||
| raise ValueError | ||
| value = int(value) |
There was a problem hiding this comment.
You remove the use_localization here. But, if it is set and the value is "1,0" in a locale that uses a comma as separator, then the new construct works differently by failing. That is, of course, unless you can guarantee that the get_text() never returns a localized version of the numeric value.
If you cannot guarantee that, then I think you first need to get the value as a float, like the original conversions did, and then do the comparison if value != int(value) if integer_only is requested.
There was a problem hiding this comment.
@hansu
I put it back in. This is here to maintain compatibility with gscreen.
If it were my choice I would remove all localization but we are unfortunately obliged to drag some legacy code along.
- value validation is done by the widgets the values are entered for - if the calculator is set to 'integer_only' it will reject any value or expression containing '.' or ',' - value editing is handled in the widget regardless whether directly with the keyboard or the calculator - On save the table is checked for duplicate tool numbers
cb81188 to
fcad9fd
Compare
Successor for #4436