Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Force Qt validator to use C locale. #6241
Conversation
mdboom
added the
needs_review
label
Mar 29, 2016
QuLogic
added the
GUI/Qt
label
Mar 29, 2016
|
Should we do this for ints as well? Also, are there issues for dates? There, I think ISO dates is probably the only thing that's internationally understood. |
|
There isn't anywhere in the UI right now where an int is required as input (AFAICT) but I guess that if there was then something bad could happen with the use of "," as thousands separator in English. |
tacaswell
added this to the
2.1 (next point release)
milestone
Mar 30, 2016
tacaswell
merged commit 3174f25
into matplotlib:master
Mar 30, 2016
tacaswell
removed the
needs_review
label
Mar 30, 2016
anntzer
deleted the
anntzer:qt5-validator-locale branch
Mar 30, 2016
|
Any chance this can be backported to 1.5.x? It's a pretty annoying issue... |
anntzer
referenced
this pull request
Apr 17, 2016
Closed
Cannot interactively edit axes limits using Qt5 backend #6082
tacaswell
added a commit
that referenced
this pull request
Apr 18, 2016
|
|
tacaswell |
c1cd4f2
|
|
backported to v1.5.x as c1cd4f2 |
QuLogic
modified the milestone: 1.5.2 (Critical bug fix release), 2.1 (next point release)
Apr 18, 2016
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
May 22, 2016
|
|
tacaswell |
6a1f3a5
|
anntzer commentedMar 29, 2016
PR for #6082: Cannot interactively edit axes limits using Qt5 backend
I found that this was a locale issue: I am on a French locale, where the decimal separator is ",".
On Qt4 (http://doc.qt.io/qt-4.8/qdoublevalidator.html),
On Qt5 (http://doc.qt.io/qt-5/qdoublevalidator.html), the second provision has been removed.
Thus, on the French locale, "1.23" is considered an invalid input and rejected by QDoubleValidator. In fact, I can input instead "1,23", but this causes an exception later when Python tries to convert this to a float. (To reproduce this, set the locale appropriately and edit the axes parameters of a default plot.)
Given that matplotlib is not really localized anyways (except for
axes.formatter.use_locale), this patch sets the validator's locale to C in all cases. Note that despite what the Qt docs indicate, this does not seem to prevent input of localized ("1,23") values, which still lead to an exception.