IconEditor/IconEditorWindow.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3036
30c81c9e88b8
child 3145
a9de05d4a22f
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
191 self.trUtf8('&New'), 191 self.trUtf8('&New'),
192 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), 192 QKeySequence(self.trUtf8("Ctrl+N", "File|New")),
193 0, self, 'iconEditor_file_new') 193 0, self, 'iconEditor_file_new')
194 self.newAct.setStatusTip(self.trUtf8('Create a new icon')) 194 self.newAct.setStatusTip(self.trUtf8('Create a new icon'))
195 self.newAct.setWhatsThis(self.trUtf8( 195 self.newAct.setWhatsThis(self.trUtf8(
196 """<b>New</b>""" 196 """<b>New</b>"""
197 """<p>This creates a new icon.</p>""" 197 """<p>This creates a new icon.</p>"""
198 )) 198 ))
199 self.newAct.triggered[()].connect(self.__newIcon) 199 self.newAct.triggered[()].connect(self.__newIcon)
200 self.__actions.append(self.newAct) 200 self.__actions.append(self.newAct)
201 201
202 self.newWindowAct = E5Action( 202 self.newWindowAct = E5Action(
205 self.trUtf8('New &Window'), 205 self.trUtf8('New &Window'),
206 0, 0, self, 'iconEditor_file_new_window') 206 0, 0, self, 'iconEditor_file_new_window')
207 self.newWindowAct.setStatusTip(self.trUtf8( 207 self.newWindowAct.setStatusTip(self.trUtf8(
208 'Open a new icon editor window')) 208 'Open a new icon editor window'))
209 self.newWindowAct.setWhatsThis(self.trUtf8( 209 self.newWindowAct.setWhatsThis(self.trUtf8(
210 """<b>New Window</b>""" 210 """<b>New Window</b>"""
211 """<p>This opens a new icon editor window.</p>""" 211 """<p>This opens a new icon editor window.</p>"""
212 )) 212 ))
213 self.newWindowAct.triggered[()].connect(self.__newWindow) 213 self.newWindowAct.triggered[()].connect(self.__newWindow)
214 self.__actions.append(self.newWindowAct) 214 self.__actions.append(self.newWindowAct)
215 215
216 self.openAct = E5Action( 216 self.openAct = E5Action(
219 self.trUtf8('&Open...'), 219 self.trUtf8('&Open...'),
220 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), 220 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")),
221 0, self, 'iconEditor_file_open') 221 0, self, 'iconEditor_file_open')
222 self.openAct.setStatusTip(self.trUtf8('Open an icon file for editing')) 222 self.openAct.setStatusTip(self.trUtf8('Open an icon file for editing'))
223 self.openAct.setWhatsThis(self.trUtf8( 223 self.openAct.setWhatsThis(self.trUtf8(
224 """<b>Open File</b>""" 224 """<b>Open File</b>"""
225 """<p>This opens a new icon file for editing.""" 225 """<p>This opens a new icon file for editing."""
226 """ It pops up a file selection dialog.</p>""" 226 """ It pops up a file selection dialog.</p>"""
227 )) 227 ))
228 self.openAct.triggered[()].connect(self.__openIcon) 228 self.openAct.triggered[()].connect(self.__openIcon)
229 self.__actions.append(self.openAct) 229 self.__actions.append(self.openAct)
230 230
231 self.saveAct = E5Action( 231 self.saveAct = E5Action(
249 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 249 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")),
250 0, self, 'iconEditor_file_save_as') 250 0, self, 'iconEditor_file_save_as')
251 self.saveAsAct.setStatusTip( 251 self.saveAsAct.setStatusTip(
252 self.trUtf8('Save the current icon to a new file')) 252 self.trUtf8('Save the current icon to a new file'))
253 self.saveAsAct.setWhatsThis(self.trUtf8( 253 self.saveAsAct.setWhatsThis(self.trUtf8(
254 """<b>Save As...</b>""" 254 """<b>Save As...</b>"""
255 """<p>Saves the current icon to a new file.</p>""" 255 """<p>Saves the current icon to a new file.</p>"""
256 )) 256 ))
257 self.saveAsAct.triggered[()].connect(self.__saveIconAs) 257 self.saveAsAct.triggered[()].connect(self.__saveIconAs)
258 self.__actions.append(self.saveAsAct) 258 self.__actions.append(self.saveAsAct)
259 259
260 self.closeAct = E5Action( 260 self.closeAct = E5Action(
264 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), 264 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")),
265 0, self, 'iconEditor_file_close') 265 0, self, 'iconEditor_file_close')
266 self.closeAct.setStatusTip(self.trUtf8( 266 self.closeAct.setStatusTip(self.trUtf8(
267 'Close the current icon editor window')) 267 'Close the current icon editor window'))
268 self.closeAct.setWhatsThis(self.trUtf8( 268 self.closeAct.setWhatsThis(self.trUtf8(
269 """<b>Close</b>""" 269 """<b>Close</b>"""
270 """<p>Closes the current icon editor window.</p>""" 270 """<p>Closes the current icon editor window.</p>"""
271 )) 271 ))
272 self.closeAct.triggered[()].connect(self.close) 272 self.closeAct.triggered[()].connect(self.close)
273 self.__actions.append(self.closeAct) 273 self.__actions.append(self.closeAct)
274 274
275 self.closeAllAct = E5Action( 275 self.closeAllAct = E5Action(
291 self.trUtf8('&Quit'), 291 self.trUtf8('&Quit'),
292 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), 292 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")),
293 0, self, 'iconEditor_file_quit') 293 0, self, 'iconEditor_file_quit')
294 self.exitAct.setStatusTip(self.trUtf8('Quit the icon editor')) 294 self.exitAct.setStatusTip(self.trUtf8('Quit the icon editor'))
295 self.exitAct.setWhatsThis(self.trUtf8( 295 self.exitAct.setWhatsThis(self.trUtf8(
296 """<b>Quit</b>""" 296 """<b>Quit</b>"""
297 """<p>Quit the icon editor.</p>""" 297 """<p>Quit the icon editor.</p>"""
298 )) 298 ))
299 if not self.fromEric: 299 if not self.fromEric:
300 self.exitAct.triggered[()].connect(self.__closeAll) 300 self.exitAct.triggered[()].connect(self.__closeAll)
301 self.__actions.append(self.exitAct) 301 self.__actions.append(self.exitAct)
302 302
479 self.trUtf8('Zoom &in'), 479 self.trUtf8('Zoom &in'),
480 QKeySequence(self.trUtf8("Ctrl++", "View|Zoom in")), 480 QKeySequence(self.trUtf8("Ctrl++", "View|Zoom in")),
481 0, self, 'iconEditor_view_zoom_in') 481 0, self, 'iconEditor_view_zoom_in')
482 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon')) 482 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon'))
483 self.zoomInAct.setWhatsThis(self.trUtf8( 483 self.zoomInAct.setWhatsThis(self.trUtf8(
484 """<b>Zoom in</b>""" 484 """<b>Zoom in</b>"""
485 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" 485 """<p>Zoom in on the icon. This makes the grid bigger.</p>"""
486 )) 486 ))
487 self.zoomInAct.triggered[()].connect(self.__zoomIn) 487 self.zoomInAct.triggered[()].connect(self.__zoomIn)
488 self.__actions.append(self.zoomInAct) 488 self.__actions.append(self.zoomInAct)
489 489
490 self.zoomOutAct = E5Action( 490 self.zoomOutAct = E5Action(
493 self.trUtf8('Zoom &out'), 493 self.trUtf8('Zoom &out'),
494 QKeySequence(self.trUtf8("Ctrl+-", "View|Zoom out")), 494 QKeySequence(self.trUtf8("Ctrl+-", "View|Zoom out")),
495 0, self, 'iconEditor_view_zoom_out') 495 0, self, 'iconEditor_view_zoom_out')
496 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon')) 496 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon'))
497 self.zoomOutAct.setWhatsThis(self.trUtf8( 497 self.zoomOutAct.setWhatsThis(self.trUtf8(
498 """<b>Zoom out</b>""" 498 """<b>Zoom out</b>"""
499 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" 499 """<p>Zoom out on the icon. This makes the grid smaller.</p>"""
500 )) 500 ))
501 self.zoomOutAct.triggered[()].connect(self.__zoomOut) 501 self.zoomOutAct.triggered[()].connect(self.__zoomOut)
502 self.__actions.append(self.zoomOutAct) 502 self.__actions.append(self.zoomOutAct)
503 503
504 self.zoomResetAct = E5Action( 504 self.zoomResetAct = E5Action(
508 QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")), 508 QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")),
509 0, self, 'iconEditor_view_zoom_reset') 509 0, self, 'iconEditor_view_zoom_reset')
510 self.zoomResetAct.setStatusTip(self.trUtf8( 510 self.zoomResetAct.setStatusTip(self.trUtf8(
511 'Reset the zoom of the icon')) 511 'Reset the zoom of the icon'))
512 self.zoomResetAct.setWhatsThis(self.trUtf8( 512 self.zoomResetAct.setWhatsThis(self.trUtf8(
513 """<b>Zoom reset</b>""" 513 """<b>Zoom reset</b>"""
514 """<p>Reset the zoom of the icon. """ 514 """<p>Reset the zoom of the icon. """
515 """This sets the zoom factor to 100%.</p>""" 515 """This sets the zoom factor to 100%.</p>"""
516 )) 516 ))
517 self.zoomResetAct.triggered[()].connect(self.__zoomReset) 517 self.zoomResetAct.triggered[()].connect(self.__zoomReset)
518 self.__actions.append(self.zoomResetAct) 518 self.__actions.append(self.zoomResetAct)
519 519
520 self.showGridAct = E5Action( 520 self.showGridAct = E5Action(
524 0, 0, 524 0, 0,
525 self, 'iconEditor_view_show_grid') 525 self, 'iconEditor_view_show_grid')
526 self.showGridAct.setStatusTip(self.trUtf8( 526 self.showGridAct.setStatusTip(self.trUtf8(
527 'Toggle the display of the grid')) 527 'Toggle the display of the grid'))
528 self.showGridAct.setWhatsThis(self.trUtf8( 528 self.showGridAct.setWhatsThis(self.trUtf8(
529 """<b>Show Grid</b>""" 529 """<b>Show Grid</b>"""
530 """<p>Toggle the display of the grid.</p>""" 530 """<p>Toggle the display of the grid.</p>"""
531 )) 531 ))
532 self.showGridAct.triggered[bool].connect(self.__editor.setGridEnabled) 532 self.showGridAct.triggered[bool].connect(self.__editor.setGridEnabled)
533 self.__actions.append(self.showGridAct) 533 self.__actions.append(self.showGridAct)
534 self.showGridAct.setCheckable(True) 534 self.showGridAct.setCheckable(True)
535 self.showGridAct.setChecked(self.__editor.isGridEnabled()) 535 self.showGridAct.setChecked(self.__editor.isGridEnabled())
536 536
549 UI.PixmapCache.getIcon("drawBrush.png"), 549 UI.PixmapCache.getIcon("drawBrush.png"),
550 self.trUtf8('&Freehand'), 550 self.trUtf8('&Freehand'),
551 0, 0, 551 0, 0,
552 self.drawingActGrp, 'iconEditor_tools_pencil') 552 self.drawingActGrp, 'iconEditor_tools_pencil')
553 self.drawPencilAct.setWhatsThis(self.trUtf8( 553 self.drawPencilAct.setWhatsThis(self.trUtf8(
554 """<b>Free hand</b>""" 554 """<b>Free hand</b>"""
555 """<p>Draws non linear lines.</p>""" 555 """<p>Draws non linear lines.</p>"""
556 )) 556 ))
557 self.drawPencilAct.setCheckable(True) 557 self.drawPencilAct.setCheckable(True)
558 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) 558 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil)
559 self.drawPencilAct.triggered[()].connect(self.esm.map) 559 self.drawPencilAct.triggered[()].connect(self.esm.map)
560 self.__actions.append(self.drawPencilAct) 560 self.__actions.append(self.drawPencilAct)
564 UI.PixmapCache.getIcon("colorPicker.png"), 564 UI.PixmapCache.getIcon("colorPicker.png"),
565 self.trUtf8('&Color Picker'), 565 self.trUtf8('&Color Picker'),
566 0, 0, 566 0, 0,
567 self.drawingActGrp, 'iconEditor_tools_color_picker') 567 self.drawingActGrp, 'iconEditor_tools_color_picker')
568 self.drawColorPickerAct.setWhatsThis(self.trUtf8( 568 self.drawColorPickerAct.setWhatsThis(self.trUtf8(
569 """<b>Color Picker</b>""" 569 """<b>Color Picker</b>"""
570 """<p>The color of the pixel clicked on will become """ 570 """<p>The color of the pixel clicked on will become """
571 """the current draw color.</p>""" 571 """the current draw color.</p>"""
572 )) 572 ))
573 self.drawColorPickerAct.setCheckable(True) 573 self.drawColorPickerAct.setCheckable(True)
574 self.esm.setMapping(self.drawColorPickerAct, 574 self.esm.setMapping(self.drawColorPickerAct,
575 IconEditorGrid.ColorPicker) 575 IconEditorGrid.ColorPicker)
576 self.drawColorPickerAct.triggered[()].connect(self.esm.map) 576 self.drawColorPickerAct.triggered[()].connect(self.esm.map)
581 UI.PixmapCache.getIcon("drawRectangle.png"), 581 UI.PixmapCache.getIcon("drawRectangle.png"),
582 self.trUtf8('&Rectangle'), 582 self.trUtf8('&Rectangle'),
583 0, 0, 583 0, 0,
584 self.drawingActGrp, 'iconEditor_tools_rectangle') 584 self.drawingActGrp, 'iconEditor_tools_rectangle')
585 self.drawRectangleAct.setWhatsThis(self.trUtf8( 585 self.drawRectangleAct.setWhatsThis(self.trUtf8(
586 """<b>Rectangle</b>""" 586 """<b>Rectangle</b>"""
587 """<p>Draw a rectangle.</p>""" 587 """<p>Draw a rectangle.</p>"""
588 )) 588 ))
589 self.drawRectangleAct.setCheckable(True) 589 self.drawRectangleAct.setCheckable(True)
590 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) 590 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle)
591 self.drawRectangleAct.triggered[()].connect(self.esm.map) 591 self.drawRectangleAct.triggered[()].connect(self.esm.map)
592 self.__actions.append(self.drawRectangleAct) 592 self.__actions.append(self.drawRectangleAct)
596 UI.PixmapCache.getIcon("drawRectangleFilled.png"), 596 UI.PixmapCache.getIcon("drawRectangleFilled.png"),
597 self.trUtf8('F&illed Rectangle'), 597 self.trUtf8('F&illed Rectangle'),
598 0, 0, 598 0, 0,
599 self.drawingActGrp, 'iconEditor_tools_filled_rectangle') 599 self.drawingActGrp, 'iconEditor_tools_filled_rectangle')
600 self.drawFilledRectangleAct.setWhatsThis(self.trUtf8( 600 self.drawFilledRectangleAct.setWhatsThis(self.trUtf8(
601 """<b>Filled Rectangle</b>""" 601 """<b>Filled Rectangle</b>"""
602 """<p>Draw a filled rectangle.</p>""" 602 """<p>Draw a filled rectangle.</p>"""
603 )) 603 ))
604 self.drawFilledRectangleAct.setCheckable(True) 604 self.drawFilledRectangleAct.setCheckable(True)
605 self.esm.setMapping(self.drawFilledRectangleAct, 605 self.esm.setMapping(self.drawFilledRectangleAct,
606 IconEditorGrid.FilledRectangle) 606 IconEditorGrid.FilledRectangle)
607 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) 607 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map)
612 UI.PixmapCache.getIcon("drawCircle.png"), 612 UI.PixmapCache.getIcon("drawCircle.png"),
613 self.trUtf8('Circle'), 613 self.trUtf8('Circle'),
614 0, 0, 614 0, 0,
615 self.drawingActGrp, 'iconEditor_tools_circle') 615 self.drawingActGrp, 'iconEditor_tools_circle')
616 self.drawCircleAct.setWhatsThis(self.trUtf8( 616 self.drawCircleAct.setWhatsThis(self.trUtf8(
617 """<b>Circle</b>""" 617 """<b>Circle</b>"""
618 """<p>Draw a circle.</p>""" 618 """<p>Draw a circle.</p>"""
619 )) 619 ))
620 self.drawCircleAct.setCheckable(True) 620 self.drawCircleAct.setCheckable(True)
621 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) 621 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle)
622 self.drawCircleAct.triggered[()].connect(self.esm.map) 622 self.drawCircleAct.triggered[()].connect(self.esm.map)
623 self.__actions.append(self.drawCircleAct) 623 self.__actions.append(self.drawCircleAct)
627 UI.PixmapCache.getIcon("drawCircleFilled.png"), 627 UI.PixmapCache.getIcon("drawCircleFilled.png"),
628 self.trUtf8('Fille&d Circle'), 628 self.trUtf8('Fille&d Circle'),
629 0, 0, 629 0, 0,
630 self.drawingActGrp, 'iconEditor_tools_filled_circle') 630 self.drawingActGrp, 'iconEditor_tools_filled_circle')
631 self.drawFilledCircleAct.setWhatsThis(self.trUtf8( 631 self.drawFilledCircleAct.setWhatsThis(self.trUtf8(
632 """<b>Filled Circle</b>""" 632 """<b>Filled Circle</b>"""
633 """<p>Draw a filled circle.</p>""" 633 """<p>Draw a filled circle.</p>"""
634 )) 634 ))
635 self.drawFilledCircleAct.setCheckable(True) 635 self.drawFilledCircleAct.setCheckable(True)
636 self.esm.setMapping(self.drawFilledCircleAct, 636 self.esm.setMapping(self.drawFilledCircleAct,
637 IconEditorGrid.FilledCircle) 637 IconEditorGrid.FilledCircle)
638 self.drawFilledCircleAct.triggered[()].connect(self.esm.map) 638 self.drawFilledCircleAct.triggered[()].connect(self.esm.map)
643 UI.PixmapCache.getIcon("drawEllipse.png"), 643 UI.PixmapCache.getIcon("drawEllipse.png"),
644 self.trUtf8('&Ellipse'), 644 self.trUtf8('&Ellipse'),
645 0, 0, 645 0, 0,
646 self.drawingActGrp, 'iconEditor_tools_ellipse') 646 self.drawingActGrp, 'iconEditor_tools_ellipse')
647 self.drawEllipseAct.setWhatsThis(self.trUtf8( 647 self.drawEllipseAct.setWhatsThis(self.trUtf8(
648 """<b>Ellipse</b>""" 648 """<b>Ellipse</b>"""
649 """<p>Draw an ellipse.</p>""" 649 """<p>Draw an ellipse.</p>"""
650 )) 650 ))
651 self.drawEllipseAct.setCheckable(True) 651 self.drawEllipseAct.setCheckable(True)
652 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) 652 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse)
653 self.drawEllipseAct.triggered[()].connect(self.esm.map) 653 self.drawEllipseAct.triggered[()].connect(self.esm.map)
654 self.__actions.append(self.drawEllipseAct) 654 self.__actions.append(self.drawEllipseAct)
658 UI.PixmapCache.getIcon("drawEllipseFilled.png"), 658 UI.PixmapCache.getIcon("drawEllipseFilled.png"),
659 self.trUtf8('Fille&d Elli&pse'), 659 self.trUtf8('Fille&d Elli&pse'),
660 0, 0, 660 0, 0,
661 self.drawingActGrp, 'iconEditor_tools_filled_ellipse') 661 self.drawingActGrp, 'iconEditor_tools_filled_ellipse')
662 self.drawFilledEllipseAct.setWhatsThis(self.trUtf8( 662 self.drawFilledEllipseAct.setWhatsThis(self.trUtf8(
663 """<b>Filled Ellipse</b>""" 663 """<b>Filled Ellipse</b>"""
664 """<p>Draw a filled ellipse.</p>""" 664 """<p>Draw a filled ellipse.</p>"""
665 )) 665 ))
666 self.drawFilledEllipseAct.setCheckable(True) 666 self.drawFilledEllipseAct.setCheckable(True)
667 self.esm.setMapping(self.drawFilledEllipseAct, 667 self.esm.setMapping(self.drawFilledEllipseAct,
668 IconEditorGrid.FilledEllipse) 668 IconEditorGrid.FilledEllipse)
669 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) 669 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map)
674 UI.PixmapCache.getIcon("drawFill.png"), 674 UI.PixmapCache.getIcon("drawFill.png"),
675 self.trUtf8('Fl&ood Fill'), 675 self.trUtf8('Fl&ood Fill'),
676 0, 0, 676 0, 0,
677 self.drawingActGrp, 'iconEditor_tools_flood_fill') 677 self.drawingActGrp, 'iconEditor_tools_flood_fill')
678 self.drawFloodFillAct.setWhatsThis(self.trUtf8( 678 self.drawFloodFillAct.setWhatsThis(self.trUtf8(
679 """<b>Flood Fill</b>""" 679 """<b>Flood Fill</b>"""
680 """<p>Fill adjoining pixels with the same color with """ 680 """<p>Fill adjoining pixels with the same color with """
681 """the current color.</p>""" 681 """the current color.</p>"""
682 )) 682 ))
683 self.drawFloodFillAct.setCheckable(True) 683 self.drawFloodFillAct.setCheckable(True)
684 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) 684 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill)
685 self.drawFloodFillAct.triggered[()].connect(self.esm.map) 685 self.drawFloodFillAct.triggered[()].connect(self.esm.map)
686 self.__actions.append(self.drawFloodFillAct) 686 self.__actions.append(self.drawFloodFillAct)
690 UI.PixmapCache.getIcon("drawLine.png"), 690 UI.PixmapCache.getIcon("drawLine.png"),
691 self.trUtf8('&Line'), 691 self.trUtf8('&Line'),
692 0, 0, 692 0, 0,
693 self.drawingActGrp, 'iconEditor_tools_line') 693 self.drawingActGrp, 'iconEditor_tools_line')
694 self.drawLineAct.setWhatsThis(self.trUtf8( 694 self.drawLineAct.setWhatsThis(self.trUtf8(
695 """<b>Line</b>""" 695 """<b>Line</b>"""
696 """<p>Draw a line.</p>""" 696 """<p>Draw a line.</p>"""
697 )) 697 ))
698 self.drawLineAct.setCheckable(True) 698 self.drawLineAct.setCheckable(True)
699 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) 699 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line)
700 self.drawLineAct.triggered[()].connect(self.esm.map) 700 self.drawLineAct.triggered[()].connect(self.esm.map)
701 self.__actions.append(self.drawLineAct) 701 self.__actions.append(self.drawLineAct)
705 UI.PixmapCache.getIcon("drawEraser.png"), 705 UI.PixmapCache.getIcon("drawEraser.png"),
706 self.trUtf8('Eraser (&Transparent)'), 706 self.trUtf8('Eraser (&Transparent)'),
707 0, 0, 707 0, 0,
708 self.drawingActGrp, 'iconEditor_tools_eraser') 708 self.drawingActGrp, 'iconEditor_tools_eraser')
709 self.drawEraserAct.setWhatsThis(self.trUtf8( 709 self.drawEraserAct.setWhatsThis(self.trUtf8(
710 """<b>Eraser (Transparent)</b>""" 710 """<b>Eraser (Transparent)</b>"""
711 """<p>Erase pixels by setting them to transparent.</p>""" 711 """<p>Erase pixels by setting them to transparent.</p>"""
712 )) 712 ))
713 self.drawEraserAct.setCheckable(True) 713 self.drawEraserAct.setCheckable(True)
714 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber) 714 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber)
715 self.drawEraserAct.triggered[()].connect(self.esm.map) 715 self.drawEraserAct.triggered[()].connect(self.esm.map)
716 self.__actions.append(self.drawEraserAct) 716 self.__actions.append(self.drawEraserAct)
1120 file = QFile(fileName) 1120 file = QFile(fileName)
1121 if not file.exists(): 1121 if not file.exists():
1122 E5MessageBox.warning( 1122 E5MessageBox.warning(
1123 self, self.trUtf8("eric5 Icon Editor"), 1123 self, self.trUtf8("eric5 Icon Editor"),
1124 self.trUtf8("The file '{0}' does not exist.") 1124 self.trUtf8("The file '{0}' does not exist.")
1125 .format(fileName)) 1125 .format(fileName))
1126 return 1126 return
1127 1127
1128 if not file.open(QFile.ReadOnly): 1128 if not file.open(QFile.ReadOnly):
1129 E5MessageBox.warning( 1129 E5MessageBox.warning(
1130 self, self.trUtf8("eric5 Icon Editor"), 1130 self, self.trUtf8("eric5 Icon Editor"),
1131 self.trUtf8("Cannot read file '{0}:\n{1}.") 1131 self.trUtf8("Cannot read file '{0}:\n{1}.")
1132 .format(fileName, file.errorString())) 1132 .format(fileName, file.errorString()))
1133 return 1133 return
1134 file.close() 1134 file.close()
1135 1135
1136 img = QImage(fileName) 1136 img = QImage(fileName)
1137 self.__editor.setIconImage(img, clearUndo=True) 1137 self.__editor.setIconImage(img, clearUndo=True)
1147 file = QFile(fileName) 1147 file = QFile(fileName)
1148 if not file.open(QFile.WriteOnly): 1148 if not file.open(QFile.WriteOnly):
1149 E5MessageBox.warning( 1149 E5MessageBox.warning(
1150 self, self.trUtf8("eric5 Icon Editor"), 1150 self, self.trUtf8("eric5 Icon Editor"),
1151 self.trUtf8("Cannot write file '{0}:\n{1}.") 1151 self.trUtf8("Cannot write file '{0}:\n{1}.")
1152 .format(fileName, file.errorString())) 1152 .format(fileName, file.errorString()))
1153 1153
1154 self.__checkActions() 1154 self.__checkActions()
1155 1155
1156 return False 1156 return False
1157 1157
1161 1161
1162 if not res: 1162 if not res:
1163 E5MessageBox.warning( 1163 E5MessageBox.warning(
1164 self, self.trUtf8("eric5 Icon Editor"), 1164 self, self.trUtf8("eric5 Icon Editor"),
1165 self.trUtf8("Cannot write file '{0}:\n{1}.") 1165 self.trUtf8("Cannot write file '{0}:\n{1}.")
1166 .format(fileName, file.errorString())) 1166 .format(fileName, file.errorString()))
1167 1167
1168 self.__checkActions() 1168 self.__checkActions()
1169 1169
1170 return False 1170 return False
1171 1171

eric ide

mercurial