eric7/IconEditor/IconEditorWindow.py

branch
eric7
changeset 8353
799196d0b05d
parent 8322
b422b4e77d19
child 8356
68ec9c3d4de5
diff -r 879dc528461f -r 799196d0b05d eric7/IconEditor/IconEditorWindow.py
--- a/eric7/IconEditor/IconEditorWindow.py	Sat May 22 12:46:57 2021 +0200
+++ b/eric7/IconEditor/IconEditorWindow.py	Sat May 22 12:54:57 2021 +0200
@@ -23,7 +23,7 @@
 from E5Gui.E5MainWindow import E5MainWindow
 from E5Gui.E5ZoomWidget import E5ZoomWidget
 
-from .IconEditorGrid import IconEditorGrid
+from .IconEditorGrid import IconEditorGrid, IconEditorTool
 
 import UI.PixmapCache
 import UI.Config
@@ -555,11 +555,7 @@
         Private method to create the View actions.
         """
         self.esm = QSignalMapper(self)
-        try:
-            self.esm.mappedInt.connect(self.__editor.setTool)
-        except AttributeError:
-            # pre Qt 5.15
-            self.esm.mapped[int].connect(self.__editor.setTool)
+        self.esm.mappedInt.connect(self.__editor.setTool)
         
         self.drawingActGrp = createActionGroup(self)
         self.drawingActGrp.setExclusive(True)
@@ -575,7 +571,7 @@
             """<p>Draws non linear lines.</p>"""
         ))
         self.drawPencilAct.setCheckable(True)
-        self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil)
+        self.esm.setMapping(self.drawPencilAct, IconEditorTool.PENCIL)
         self.drawPencilAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawPencilAct)
         
@@ -592,7 +588,7 @@
         ))
         self.drawColorPickerAct.setCheckable(True)
         self.esm.setMapping(self.drawColorPickerAct,
-                            IconEditorGrid.ColorPicker)
+                            IconEditorTool.COLOR_PICKER)
         self.drawColorPickerAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawColorPickerAct)
         
@@ -607,7 +603,7 @@
             """<p>Draw a rectangle.</p>"""
         ))
         self.drawRectangleAct.setCheckable(True)
-        self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle)
+        self.esm.setMapping(self.drawRectangleAct, IconEditorTool.RECTANGLE)
         self.drawRectangleAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawRectangleAct)
         
@@ -623,7 +619,7 @@
         ))
         self.drawFilledRectangleAct.setCheckable(True)
         self.esm.setMapping(self.drawFilledRectangleAct,
-                            IconEditorGrid.FilledRectangle)
+                            IconEditorTool.FILLED_RECTANGLE)
         self.drawFilledRectangleAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawFilledRectangleAct)
         
@@ -638,7 +634,7 @@
             """<p>Draw a circle.</p>"""
         ))
         self.drawCircleAct.setCheckable(True)
-        self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle)
+        self.esm.setMapping(self.drawCircleAct, IconEditorTool.CIRCLE)
         self.drawCircleAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawCircleAct)
         
@@ -654,7 +650,7 @@
         ))
         self.drawFilledCircleAct.setCheckable(True)
         self.esm.setMapping(self.drawFilledCircleAct,
-                            IconEditorGrid.FilledCircle)
+                            IconEditorTool.FILLED_CIRCLE)
         self.drawFilledCircleAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawFilledCircleAct)
         
@@ -669,7 +665,7 @@
             """<p>Draw an ellipse.</p>"""
         ))
         self.drawEllipseAct.setCheckable(True)
-        self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse)
+        self.esm.setMapping(self.drawEllipseAct, IconEditorTool.ELLIPSE)
         self.drawEllipseAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawEllipseAct)
         
@@ -685,7 +681,7 @@
         ))
         self.drawFilledEllipseAct.setCheckable(True)
         self.esm.setMapping(self.drawFilledEllipseAct,
-                            IconEditorGrid.FilledEllipse)
+                            IconEditorTool.FILLED_ELLIPSE)
         self.drawFilledEllipseAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawFilledEllipseAct)
         
@@ -701,7 +697,7 @@
             """the current color.</p>"""
         ))
         self.drawFloodFillAct.setCheckable(True)
-        self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill)
+        self.esm.setMapping(self.drawFloodFillAct, IconEditorTool.FILL)
         self.drawFloodFillAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawFloodFillAct)
         
@@ -716,7 +712,7 @@
             """<p>Draw a line.</p>"""
         ))
         self.drawLineAct.setCheckable(True)
-        self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line)
+        self.esm.setMapping(self.drawLineAct, IconEditorTool.LINE)
         self.drawLineAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawLineAct)
         
@@ -731,7 +727,7 @@
             """<p>Erase pixels by setting them to transparent.</p>"""
         ))
         self.drawEraserAct.setCheckable(True)
-        self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber)
+        self.esm.setMapping(self.drawEraserAct, IconEditorTool.RUBBER)
         self.drawEraserAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawEraserAct)
         
@@ -748,7 +744,7 @@
         ))
         self.drawRectangleSelectionAct.setCheckable(True)
         self.esm.setMapping(self.drawRectangleSelectionAct,
-                            IconEditorGrid.RectangleSelection)
+                            IconEditorTool.SELECT_RECTANGLE)
         self.drawRectangleSelectionAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawRectangleSelectionAct)
         
@@ -765,11 +761,11 @@
         ))
         self.drawCircleSelectionAct.setCheckable(True)
         self.esm.setMapping(self.drawCircleSelectionAct,
-                            IconEditorGrid.CircleSelection)
+                            IconEditorTool.SELECT_CIRCLE)
         self.drawCircleSelectionAct.triggered.connect(self.esm.map)
         self.__actions.append(self.drawCircleSelectionAct)
         
-        self.drawPencilAct.setChecked(True)
+        self.drawPencilAct.trigger()
     
     def __initHelpActions(self):
         """

eric ide

mercurial