IconEditor/IconEditorWindow.py

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

eric ide

mercurial