IconEditor/IconEditorGrid.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3345
071afe8be2a1
child 3539
0c2dc1446ebf
diff -r 96232974dcdb -r 645c12de6b0c IconEditor/IconEditorGrid.py
--- a/IconEditor/IconEditorGrid.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/IconEditor/IconEditorGrid.py	Thu Apr 03 23:05:31 2014 +0200
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt4.QtCore import pyqtSignal, Qt, QPoint, QRect, QSize
+from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QPoint, QRect, QSize
 from PyQt4.QtGui import QUndoCommand, QImage, QWidget, QColor, QPixmap, \
     QSizePolicy, QUndoStack, qRgba, QPainter, QApplication, QCursor, \
     QBrush, QDialog, qGray, qAlpha
@@ -202,16 +202,16 @@
         for the various drawing tools.
         """
         self.__undoTexts = {
-            self.Pencil: self.trUtf8("Set Pixel"),
-            self.Rubber: self.trUtf8("Erase Pixel"),
-            self.Line: self.trUtf8("Draw Line"),
-            self.Rectangle: self.trUtf8("Draw Rectangle"),
-            self.FilledRectangle: self.trUtf8("Draw Filled Rectangle"),
-            self.Circle: self.trUtf8("Draw Circle"),
-            self.FilledCircle: self.trUtf8("Draw Filled Circle"),
-            self.Ellipse: self.trUtf8("Draw Ellipse"),
-            self.FilledEllipse: self.trUtf8("Draw Filled Ellipse"),
-            self.Fill: self.trUtf8("Fill Region"),
+            self.Pencil: self.tr("Set Pixel"),
+            self.Rubber: self.tr("Erase Pixel"),
+            self.Line: self.tr("Draw Line"),
+            self.Rectangle: self.tr("Draw Rectangle"),
+            self.FilledRectangle: self.tr("Draw Filled Rectangle"),
+            self.Circle: self.tr("Draw Circle"),
+            self.FilledCircle: self.tr("Draw Filled Circle"),
+            self.Ellipse: self.tr("Draw Ellipse"),
+            self.FilledEllipse: self.tr("Draw Filled Ellipse"),
+            self.Fill: self.tr("Fill Region"),
         }
     
     def isDirty(self):
@@ -836,7 +836,7 @@
         @return image of the selection (QImage)
         """
         if cut:
-            cmd = IconEditCommand(self, self.trUtf8("Cut Selection"),
+            cmd = IconEditCommand(self, self.tr("Cut Selection"),
                                   self.__image)
         
         img = QImage(self.__selRect.size(), QImage.Format_ARGB32)
@@ -881,6 +881,7 @@
             img = self.__getSelectionImage(True)
             QApplication.clipboard().setImage(img)
     
+    @pyqtSlot()
     def editPaste(self, pasting=False):
         """
         Public slot to paste an image from the clipboard.
@@ -894,8 +895,8 @@
                     img.height() > self.__image.height():
                 res = E5MessageBox.yesNo(
                     self,
-                    self.trUtf8("Paste"),
-                    self.trUtf8(
+                    self.tr("Paste"),
+                    self.tr(
                         """<p>The clipboard image is larger than the"""
                         """ current image.<br/>Paste as new image?</p>"""))
                 if res:
@@ -905,7 +906,7 @@
                 self.__isPasting = True
                 self.__clipboardSize = img.size()
             else:
-                cmd = IconEditCommand(self, self.trUtf8("Paste Clipboard"),
+                cmd = IconEditCommand(self, self.tr("Paste Clipboard"),
                                       self.__image)
                 self.__markImage.fill(self.NoMarkColor.rgba())
                 painter = QPainter(self.__image)
@@ -925,8 +926,8 @@
         else:
             E5MessageBox.warning(
                 self,
-                self.trUtf8("Pasting Image"),
-                self.trUtf8("""Invalid image data in clipboard."""))
+                self.tr("Pasting Image"),
+                self.tr("""Invalid image data in clipboard."""))
     
     def editPasteAsNew(self):
         """
@@ -935,7 +936,7 @@
         img, ok = self.__clipboardImage()
         if ok:
             cmd = IconEditCommand(
-                self, self.trUtf8("Paste Clipboard as New Image"),
+                self, self.tr("Paste Clipboard as New Image"),
                 self.__image)
             self.setIconImage(img)
             self.setDirty(True)
@@ -963,7 +964,7 @@
         """
         self.__unMark()
         
-        cmd = IconEditCommand(self, self.trUtf8("Clear Image"), self.__image)
+        cmd = IconEditCommand(self, self.tr("Clear Image"), self.__image)
         self.__image.fill(qRgba(0, 0, 0, 0))
         self.update()
         self.setDirty(True)
@@ -981,7 +982,7 @@
             newWidth, newHeight = dlg.getData()
             if newWidth != self.__image.width() or \
                     newHeight != self.__image.height():
-                cmd = IconEditCommand(self, self.trUtf8("Resize Image"),
+                cmd = IconEditCommand(self, self.tr("Resize Image"),
                                       self.__image)
                 img = self.__image.scaled(
                     newWidth, newHeight, Qt.IgnoreAspectRatio,
@@ -1008,7 +1009,7 @@
         """
         Public slot to convert the image to gray preserving transparency.
         """
-        cmd = IconEditCommand(self, self.trUtf8("Convert to Grayscale"),
+        cmd = IconEditCommand(self, self.tr("Convert to Grayscale"),
                               self.__image)
         for x in range(self.__image.width()):
             for y in range(self.__image.height()):

eric ide

mercurial