Sat, 23 Jan 2016 17:37:26 +0100
Fixed the locale handling in the snapshot tool.
(grafted from 957339210f406963089fc684bd335bd0df2e0c5b)
--- a/Snapshot/SnapWidget.py Sun Jan 10 13:55:21 2016 +0100 +++ b/Snapshot/SnapWidget.py Sat Jan 23 17:37:26 2016 +0100 @@ -16,7 +16,7 @@ import os from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, QTimer, QPoint, \ - QMimeData, Qt, QEvent, QRegExp, qVersion, PYQT_VERSION_STR + QMimeData, Qt, QEvent, QRegExp, QLocale, qVersion, PYQT_VERSION_STR from PyQt5.QtGui import QImageWriter, QPixmap, QCursor, QDrag, QKeySequence from PyQt5.QtWidgets import QWidget, QApplication, QShortcut @@ -92,6 +92,7 @@ self.__snapshot = QPixmap() self.__savedPosition = QPoint() self.__modified = False + self.__locale = QLocale() self.__grabberWidget = QWidget(None, Qt.X11BypassWindowManagerHint) self.__grabberWidget.move(-10000, -10000) @@ -449,8 +450,10 @@ Private slot to update the preview picture. """ self.preview.setToolTip(self.tr( - "Preview of the snapshot image ({0:n} x {1:n})").format( - self.__snapshot.width(), self.__snapshot.height())) + "Preview of the snapshot image ({0} x {1})").format( + self.__locale.toString(self.__snapshot.width()), + self.__locale.toString(self.__snapshot.height())) + ) self.preview.setPreview(self.__snapshot) self.preview.adjustSize()
--- a/Snapshot/SnapshotFreehandGrabber.py Sun Jan 10 13:55:21 2016 +0100 +++ b/Snapshot/SnapshotFreehandGrabber.py Sat Jan 23 17:37:26 2016 +0100 @@ -9,7 +9,8 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion +from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale, \ + qVersion from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ QPolygon, QPen, QBrush, QPaintEngine from PyQt5.QtWidgets import QWidget, QApplication, QToolTip @@ -64,6 +65,7 @@ self.__grabbing = False self.__dragStartPoint = QPoint() self.__selectionBeforeDrag = QPolygon() + self.__locale = QLocale() self.__helpTextRect = QRect() self.__helpText = self.tr( @@ -162,9 +164,12 @@ # rectangles (border included). This means that there is no 0px # selection, since a 0px wide rectangle will always be drawn as a line. boundingRect = self.__selection.boundingRect() - txt = "{0:n}, {1:n} ({2:n} x {3:n})".format( - boundingRect.x(), boundingRect.y(), - boundingRect.width(), boundingRect.height()) + txt = "{0}, {1} ({2} x {3})".format( + self.__locale.toString(boundingRect.x()), + self.__locale.toString(boundingRect.y()), + self.__locale.toString(boundingRect.width()), + self.__locale.toString(boundingRect.height()) + ) textRect = painter.boundingRect(self.rect(), Qt.AlignLeft, txt) boundingRect = textRect.adjusted(-4, 0, 0, 0)
--- a/Snapshot/SnapshotRegionGrabber.py Sun Jan 10 13:55:21 2016 +0100 +++ b/Snapshot/SnapshotRegionGrabber.py Sat Jan 23 17:37:26 2016 +0100 @@ -9,7 +9,8 @@ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion +from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale, \ + qVersion from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ QPaintEngine, QPen, QBrush from PyQt5.QtWidgets import QWidget, QApplication, QToolTip @@ -78,6 +79,7 @@ self.__grabbing = False self.__dragStartPoint = QPoint() self.__selectionBeforeDrag = QRect() + self.__locale = QLocale() # naming conventions for handles # T top, B bottom, R Right, L left @@ -184,9 +186,12 @@ # The grabbed region is everything which is covered by the drawn # rectangles (border included). This means that there is no 0px # selection, since a 0px wide rectangle will always be drawn as a line. - txt = "{0:n}, {1:n} ({2:n} x {3:n})".format( - self.__selection.x(), self.__selection.y(), - self.__selection.width(), self.__selection.height()) + txt = "{0}, {1} ({2} x {3})".format( + self.__locale.toString(self.__selection.x()), + self.__locale.toString(self.__selection.y()), + self.__locale.toString(self.__selection.width()), + self.__locale.toString(self.__selection.height()) + ) textRect = painter.boundingRect(self.rect(), Qt.AlignLeft, txt) boundingRect = textRect.adjusted(-4, 0, 0, 0)