13 |
13 |
14 from PyQt6.QtCore import pyqtSignal, Qt, QSize, QSignalMapper, QEvent |
14 from PyQt6.QtCore import pyqtSignal, Qt, QSize, QSignalMapper, QEvent |
15 from PyQt6.QtGui import QPalette, QImage, QImageReader, QImageWriter, QKeySequence |
15 from PyQt6.QtGui import QPalette, QImage, QImageReader, QImageWriter, QKeySequence |
16 from PyQt6.QtWidgets import QScrollArea, QLabel, QDockWidget, QWhatsThis |
16 from PyQt6.QtWidgets import QScrollArea, QLabel, QDockWidget, QWhatsThis |
17 |
17 |
18 from EricGui.EricAction import EricAction, createActionGroup |
18 from eric7.EricGui.EricAction import EricAction, createActionGroup |
19 from EricWidgets import EricFileDialog, EricMessageBox |
19 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
20 from EricWidgets.EricMainWindow import EricMainWindow |
20 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
21 from EricWidgets.EricZoomWidget import EricZoomWidget |
21 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
22 |
22 |
23 from .IconEditorGrid import IconEditorGrid, IconEditorTool |
23 from .IconEditorGrid import IconEditorGrid, IconEditorTool |
24 |
24 |
25 import UI.PixmapCache |
25 from eric7.EricGui import EricPixmapCache |
26 import UI.Config |
26 from eric7.UI import Config |
27 |
27 |
28 import Preferences |
28 from eric7 import Preferences |
29 |
29 |
30 |
30 |
31 class IconEditorWindow(EricMainWindow): |
31 class IconEditorWindow(EricMainWindow): |
32 """ |
32 """ |
33 Class implementing the web browser main window. |
33 Class implementing the web browser main window. |
61 super().__init__(parent) |
61 super().__init__(parent) |
62 self.setObjectName("eric7_icon_editor") |
62 self.setObjectName("eric7_icon_editor") |
63 |
63 |
64 self.fromEric = fromEric |
64 self.fromEric = fromEric |
65 self.initShortcutsOnly = initShortcutsOnly |
65 self.initShortcutsOnly = initShortcutsOnly |
66 self.setWindowIcon(UI.PixmapCache.getIcon("iconEditor")) |
66 self.setWindowIcon(EricPixmapCache.getIcon("iconEditor")) |
67 |
67 |
68 if self.initShortcutsOnly: |
68 if self.initShortcutsOnly: |
69 self.__initActions() |
69 self.__initActions() |
70 else: |
70 else: |
71 if not self.fromEric: |
71 if not self.fromEric: |
190 """ |
190 """ |
191 Private method to define the file related user interface actions. |
191 Private method to define the file related user interface actions. |
192 """ |
192 """ |
193 self.newAct = EricAction( |
193 self.newAct = EricAction( |
194 self.tr("New"), |
194 self.tr("New"), |
195 UI.PixmapCache.getIcon("new"), |
195 EricPixmapCache.getIcon("new"), |
196 self.tr("&New"), |
196 self.tr("&New"), |
197 QKeySequence(self.tr("Ctrl+N", "File|New")), |
197 QKeySequence(self.tr("Ctrl+N", "File|New")), |
198 0, |
198 0, |
199 self, |
199 self, |
200 "iconEditor_file_new", |
200 "iconEditor_file_new", |
206 self.newAct.triggered.connect(self.__newIcon) |
206 self.newAct.triggered.connect(self.__newIcon) |
207 self.__actions.append(self.newAct) |
207 self.__actions.append(self.newAct) |
208 |
208 |
209 self.newWindowAct = EricAction( |
209 self.newWindowAct = EricAction( |
210 self.tr("New Window"), |
210 self.tr("New Window"), |
211 UI.PixmapCache.getIcon("newWindow"), |
211 EricPixmapCache.getIcon("newWindow"), |
212 self.tr("New &Window"), |
212 self.tr("New &Window"), |
213 0, |
213 0, |
214 0, |
214 0, |
215 self, |
215 self, |
216 "iconEditor_file_new_window", |
216 "iconEditor_file_new_window", |
225 self.newWindowAct.triggered.connect(self.__newWindow) |
225 self.newWindowAct.triggered.connect(self.__newWindow) |
226 self.__actions.append(self.newWindowAct) |
226 self.__actions.append(self.newWindowAct) |
227 |
227 |
228 self.openAct = EricAction( |
228 self.openAct = EricAction( |
229 self.tr("Open"), |
229 self.tr("Open"), |
230 UI.PixmapCache.getIcon("open"), |
230 EricPixmapCache.getIcon("open"), |
231 self.tr("&Open..."), |
231 self.tr("&Open..."), |
232 QKeySequence(self.tr("Ctrl+O", "File|Open")), |
232 QKeySequence(self.tr("Ctrl+O", "File|Open")), |
233 0, |
233 0, |
234 self, |
234 self, |
235 "iconEditor_file_open", |
235 "iconEditor_file_open", |
245 self.openAct.triggered.connect(self.__openIcon) |
245 self.openAct.triggered.connect(self.__openIcon) |
246 self.__actions.append(self.openAct) |
246 self.__actions.append(self.openAct) |
247 |
247 |
248 self.saveAct = EricAction( |
248 self.saveAct = EricAction( |
249 self.tr("Save"), |
249 self.tr("Save"), |
250 UI.PixmapCache.getIcon("fileSave"), |
250 EricPixmapCache.getIcon("fileSave"), |
251 self.tr("&Save"), |
251 self.tr("&Save"), |
252 QKeySequence(self.tr("Ctrl+S", "File|Save")), |
252 QKeySequence(self.tr("Ctrl+S", "File|Save")), |
253 0, |
253 0, |
254 self, |
254 self, |
255 "iconEditor_file_save", |
255 "iconEditor_file_save", |
264 self.saveAct.triggered.connect(self.__saveIcon) |
264 self.saveAct.triggered.connect(self.__saveIcon) |
265 self.__actions.append(self.saveAct) |
265 self.__actions.append(self.saveAct) |
266 |
266 |
267 self.saveAsAct = EricAction( |
267 self.saveAsAct = EricAction( |
268 self.tr("Save As"), |
268 self.tr("Save As"), |
269 UI.PixmapCache.getIcon("fileSaveAs"), |
269 EricPixmapCache.getIcon("fileSaveAs"), |
270 self.tr("Save &As..."), |
270 self.tr("Save &As..."), |
271 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
271 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
272 0, |
272 0, |
273 self, |
273 self, |
274 "iconEditor_file_save_as", |
274 "iconEditor_file_save_as", |
283 self.saveAsAct.triggered.connect(self.__saveIconAs) |
283 self.saveAsAct.triggered.connect(self.__saveIconAs) |
284 self.__actions.append(self.saveAsAct) |
284 self.__actions.append(self.saveAsAct) |
285 |
285 |
286 self.closeAct = EricAction( |
286 self.closeAct = EricAction( |
287 self.tr("Close"), |
287 self.tr("Close"), |
288 UI.PixmapCache.getIcon("close"), |
288 EricPixmapCache.getIcon("close"), |
289 self.tr("&Close"), |
289 self.tr("&Close"), |
290 QKeySequence(self.tr("Ctrl+W", "File|Close")), |
290 QKeySequence(self.tr("Ctrl+W", "File|Close")), |
291 0, |
291 0, |
292 self, |
292 self, |
293 "iconEditor_file_close", |
293 "iconEditor_file_close", |
337 self.closeOthersAct.triggered.connect(self.__closeOthers) |
337 self.closeOthersAct.triggered.connect(self.__closeOthers) |
338 self.__actions.append(self.closeOthersAct) |
338 self.__actions.append(self.closeOthersAct) |
339 |
339 |
340 self.exitAct = EricAction( |
340 self.exitAct = EricAction( |
341 self.tr("Quit"), |
341 self.tr("Quit"), |
342 UI.PixmapCache.getIcon("exit"), |
342 EricPixmapCache.getIcon("exit"), |
343 self.tr("&Quit"), |
343 self.tr("&Quit"), |
344 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
344 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
345 0, |
345 0, |
346 self, |
346 self, |
347 "iconEditor_file_quit", |
347 "iconEditor_file_quit", |
358 """ |
358 """ |
359 Private method to create the Edit actions. |
359 Private method to create the Edit actions. |
360 """ |
360 """ |
361 self.undoAct = EricAction( |
361 self.undoAct = EricAction( |
362 self.tr("Undo"), |
362 self.tr("Undo"), |
363 UI.PixmapCache.getIcon("editUndo"), |
363 EricPixmapCache.getIcon("editUndo"), |
364 self.tr("&Undo"), |
364 self.tr("&Undo"), |
365 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
365 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
366 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
366 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
367 self, |
367 self, |
368 "iconEditor_edit_undo", |
368 "iconEditor_edit_undo", |
374 self.undoAct.triggered.connect(self.__editor.editUndo) |
374 self.undoAct.triggered.connect(self.__editor.editUndo) |
375 self.__actions.append(self.undoAct) |
375 self.__actions.append(self.undoAct) |
376 |
376 |
377 self.redoAct = EricAction( |
377 self.redoAct = EricAction( |
378 self.tr("Redo"), |
378 self.tr("Redo"), |
379 UI.PixmapCache.getIcon("editRedo"), |
379 EricPixmapCache.getIcon("editRedo"), |
380 self.tr("&Redo"), |
380 self.tr("&Redo"), |
381 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
381 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
382 0, |
382 0, |
383 self, |
383 self, |
384 "iconEditor_edit_redo", |
384 "iconEditor_edit_redo", |
390 self.redoAct.triggered.connect(self.__editor.editRedo) |
390 self.redoAct.triggered.connect(self.__editor.editRedo) |
391 self.__actions.append(self.redoAct) |
391 self.__actions.append(self.redoAct) |
392 |
392 |
393 self.cutAct = EricAction( |
393 self.cutAct = EricAction( |
394 self.tr("Cut"), |
394 self.tr("Cut"), |
395 UI.PixmapCache.getIcon("editCut"), |
395 EricPixmapCache.getIcon("editCut"), |
396 self.tr("Cu&t"), |
396 self.tr("Cu&t"), |
397 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
397 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
398 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
398 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
399 self, |
399 self, |
400 "iconEditor_edit_cut", |
400 "iconEditor_edit_cut", |
409 self.cutAct.triggered.connect(self.__editor.editCut) |
409 self.cutAct.triggered.connect(self.__editor.editCut) |
410 self.__actions.append(self.cutAct) |
410 self.__actions.append(self.cutAct) |
411 |
411 |
412 self.copyAct = EricAction( |
412 self.copyAct = EricAction( |
413 self.tr("Copy"), |
413 self.tr("Copy"), |
414 UI.PixmapCache.getIcon("editCopy"), |
414 EricPixmapCache.getIcon("editCopy"), |
415 self.tr("&Copy"), |
415 self.tr("&Copy"), |
416 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
416 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
417 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
417 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
418 self, |
418 self, |
419 "iconEditor_edit_copy", |
419 "iconEditor_edit_copy", |
428 self.copyAct.triggered.connect(self.__editor.editCopy) |
428 self.copyAct.triggered.connect(self.__editor.editCopy) |
429 self.__actions.append(self.copyAct) |
429 self.__actions.append(self.copyAct) |
430 |
430 |
431 self.pasteAct = EricAction( |
431 self.pasteAct = EricAction( |
432 self.tr("Paste"), |
432 self.tr("Paste"), |
433 UI.PixmapCache.getIcon("editPaste"), |
433 EricPixmapCache.getIcon("editPaste"), |
434 self.tr("&Paste"), |
434 self.tr("&Paste"), |
435 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
435 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
436 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
436 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
437 self, |
437 self, |
438 "iconEditor_edit_paste", |
438 "iconEditor_edit_paste", |
464 self.pasteNewAct.triggered.connect(self.__editor.editPasteAsNew) |
464 self.pasteNewAct.triggered.connect(self.__editor.editPasteAsNew) |
465 self.__actions.append(self.pasteNewAct) |
465 self.__actions.append(self.pasteNewAct) |
466 |
466 |
467 self.deleteAct = EricAction( |
467 self.deleteAct = EricAction( |
468 self.tr("Clear"), |
468 self.tr("Clear"), |
469 UI.PixmapCache.getIcon("editDelete"), |
469 EricPixmapCache.getIcon("editDelete"), |
470 self.tr("Cl&ear"), |
470 self.tr("Cl&ear"), |
471 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")), |
471 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")), |
472 0, |
472 0, |
473 self, |
473 self, |
474 "iconEditor_edit_clear", |
474 "iconEditor_edit_clear", |
501 self.selectAllAct.triggered.connect(self.__editor.editSelectAll) |
501 self.selectAllAct.triggered.connect(self.__editor.editSelectAll) |
502 self.__actions.append(self.selectAllAct) |
502 self.__actions.append(self.selectAllAct) |
503 |
503 |
504 self.resizeAct = EricAction( |
504 self.resizeAct = EricAction( |
505 self.tr("Change Size"), |
505 self.tr("Change Size"), |
506 UI.PixmapCache.getIcon("transformResize"), |
506 EricPixmapCache.getIcon("transformResize"), |
507 self.tr("Change Si&ze..."), |
507 self.tr("Change Si&ze..."), |
508 0, |
508 0, |
509 0, |
509 0, |
510 self, |
510 self, |
511 "iconEditor_edit_change_size", |
511 "iconEditor_edit_change_size", |
517 self.resizeAct.triggered.connect(self.__editor.editResize) |
517 self.resizeAct.triggered.connect(self.__editor.editResize) |
518 self.__actions.append(self.resizeAct) |
518 self.__actions.append(self.resizeAct) |
519 |
519 |
520 self.grayscaleAct = EricAction( |
520 self.grayscaleAct = EricAction( |
521 self.tr("Grayscale"), |
521 self.tr("Grayscale"), |
522 UI.PixmapCache.getIcon("grayscale"), |
522 EricPixmapCache.getIcon("grayscale"), |
523 self.tr("&Grayscale"), |
523 self.tr("&Grayscale"), |
524 0, |
524 0, |
525 0, |
525 0, |
526 self, |
526 self, |
527 "iconEditor_edit_grayscale", |
527 "iconEditor_edit_grayscale", |
553 """ |
553 """ |
554 Private method to create the View actions. |
554 Private method to create the View actions. |
555 """ |
555 """ |
556 self.zoomInAct = EricAction( |
556 self.zoomInAct = EricAction( |
557 self.tr("Zoom in"), |
557 self.tr("Zoom in"), |
558 UI.PixmapCache.getIcon("zoomIn"), |
558 EricPixmapCache.getIcon("zoomIn"), |
559 self.tr("Zoom &in"), |
559 self.tr("Zoom &in"), |
560 QKeySequence(self.tr("Ctrl++", "View|Zoom in")), |
560 QKeySequence(self.tr("Ctrl++", "View|Zoom in")), |
561 0, |
561 0, |
562 self, |
562 self, |
563 "iconEditor_view_zoom_in", |
563 "iconEditor_view_zoom_in", |
572 self.zoomInAct.triggered.connect(self.__zoomIn) |
572 self.zoomInAct.triggered.connect(self.__zoomIn) |
573 self.__actions.append(self.zoomInAct) |
573 self.__actions.append(self.zoomInAct) |
574 |
574 |
575 self.zoomOutAct = EricAction( |
575 self.zoomOutAct = EricAction( |
576 self.tr("Zoom out"), |
576 self.tr("Zoom out"), |
577 UI.PixmapCache.getIcon("zoomOut"), |
577 EricPixmapCache.getIcon("zoomOut"), |
578 self.tr("Zoom &out"), |
578 self.tr("Zoom &out"), |
579 QKeySequence(self.tr("Ctrl+-", "View|Zoom out")), |
579 QKeySequence(self.tr("Ctrl+-", "View|Zoom out")), |
580 0, |
580 0, |
581 self, |
581 self, |
582 "iconEditor_view_zoom_out", |
582 "iconEditor_view_zoom_out", |
591 self.zoomOutAct.triggered.connect(self.__zoomOut) |
591 self.zoomOutAct.triggered.connect(self.__zoomOut) |
592 self.__actions.append(self.zoomOutAct) |
592 self.__actions.append(self.zoomOutAct) |
593 |
593 |
594 self.zoomResetAct = EricAction( |
594 self.zoomResetAct = EricAction( |
595 self.tr("Zoom reset"), |
595 self.tr("Zoom reset"), |
596 UI.PixmapCache.getIcon("zoomReset"), |
596 EricPixmapCache.getIcon("zoomReset"), |
597 self.tr("Zoom &reset"), |
597 self.tr("Zoom &reset"), |
598 QKeySequence(self.tr("Ctrl+0", "View|Zoom reset")), |
598 QKeySequence(self.tr("Ctrl+0", "View|Zoom reset")), |
599 0, |
599 0, |
600 self, |
600 self, |
601 "iconEditor_view_zoom_reset", |
601 "iconEditor_view_zoom_reset", |
611 self.zoomResetAct.triggered.connect(self.__zoomReset) |
611 self.zoomResetAct.triggered.connect(self.__zoomReset) |
612 self.__actions.append(self.zoomResetAct) |
612 self.__actions.append(self.zoomResetAct) |
613 |
613 |
614 self.showGridAct = EricAction( |
614 self.showGridAct = EricAction( |
615 self.tr("Show Grid"), |
615 self.tr("Show Grid"), |
616 UI.PixmapCache.getIcon("grid"), |
616 EricPixmapCache.getIcon("grid"), |
617 self.tr("Show &Grid"), |
617 self.tr("Show &Grid"), |
618 0, |
618 0, |
619 0, |
619 0, |
620 self, |
620 self, |
621 "iconEditor_view_show_grid", |
621 "iconEditor_view_show_grid", |
639 self.drawingActGrp = createActionGroup(self) |
639 self.drawingActGrp = createActionGroup(self) |
640 self.drawingActGrp.setExclusive(True) |
640 self.drawingActGrp.setExclusive(True) |
641 |
641 |
642 self.drawPencilAct = EricAction( |
642 self.drawPencilAct = EricAction( |
643 self.tr("Freehand"), |
643 self.tr("Freehand"), |
644 UI.PixmapCache.getIcon("drawBrush"), |
644 EricPixmapCache.getIcon("drawBrush"), |
645 self.tr("&Freehand"), |
645 self.tr("&Freehand"), |
646 0, |
646 0, |
647 0, |
647 0, |
648 self.drawingActGrp, |
648 self.drawingActGrp, |
649 "iconEditor_tools_pencil", |
649 "iconEditor_tools_pencil", |
656 self.drawPencilAct.triggered.connect(self.esm.map) |
656 self.drawPencilAct.triggered.connect(self.esm.map) |
657 self.__actions.append(self.drawPencilAct) |
657 self.__actions.append(self.drawPencilAct) |
658 |
658 |
659 self.drawColorPickerAct = EricAction( |
659 self.drawColorPickerAct = EricAction( |
660 self.tr("Color Picker"), |
660 self.tr("Color Picker"), |
661 UI.PixmapCache.getIcon("colorPicker"), |
661 EricPixmapCache.getIcon("colorPicker"), |
662 self.tr("&Color Picker"), |
662 self.tr("&Color Picker"), |
663 0, |
663 0, |
664 0, |
664 0, |
665 self.drawingActGrp, |
665 self.drawingActGrp, |
666 "iconEditor_tools_color_picker", |
666 "iconEditor_tools_color_picker", |
677 self.drawColorPickerAct.triggered.connect(self.esm.map) |
677 self.drawColorPickerAct.triggered.connect(self.esm.map) |
678 self.__actions.append(self.drawColorPickerAct) |
678 self.__actions.append(self.drawColorPickerAct) |
679 |
679 |
680 self.drawRectangleAct = EricAction( |
680 self.drawRectangleAct = EricAction( |
681 self.tr("Rectangle"), |
681 self.tr("Rectangle"), |
682 UI.PixmapCache.getIcon("drawRectangle"), |
682 EricPixmapCache.getIcon("drawRectangle"), |
683 self.tr("&Rectangle"), |
683 self.tr("&Rectangle"), |
684 0, |
684 0, |
685 0, |
685 0, |
686 self.drawingActGrp, |
686 self.drawingActGrp, |
687 "iconEditor_tools_rectangle", |
687 "iconEditor_tools_rectangle", |
694 self.drawRectangleAct.triggered.connect(self.esm.map) |
694 self.drawRectangleAct.triggered.connect(self.esm.map) |
695 self.__actions.append(self.drawRectangleAct) |
695 self.__actions.append(self.drawRectangleAct) |
696 |
696 |
697 self.drawFilledRectangleAct = EricAction( |
697 self.drawFilledRectangleAct = EricAction( |
698 self.tr("Filled Rectangle"), |
698 self.tr("Filled Rectangle"), |
699 UI.PixmapCache.getIcon("drawRectangleFilled"), |
699 EricPixmapCache.getIcon("drawRectangleFilled"), |
700 self.tr("F&illed Rectangle"), |
700 self.tr("F&illed Rectangle"), |
701 0, |
701 0, |
702 0, |
702 0, |
703 self.drawingActGrp, |
703 self.drawingActGrp, |
704 "iconEditor_tools_filled_rectangle", |
704 "iconEditor_tools_filled_rectangle", |
713 self.drawFilledRectangleAct.triggered.connect(self.esm.map) |
713 self.drawFilledRectangleAct.triggered.connect(self.esm.map) |
714 self.__actions.append(self.drawFilledRectangleAct) |
714 self.__actions.append(self.drawFilledRectangleAct) |
715 |
715 |
716 self.drawCircleAct = EricAction( |
716 self.drawCircleAct = EricAction( |
717 self.tr("Circle"), |
717 self.tr("Circle"), |
718 UI.PixmapCache.getIcon("drawCircle"), |
718 EricPixmapCache.getIcon("drawCircle"), |
719 self.tr("Circle"), |
719 self.tr("Circle"), |
720 0, |
720 0, |
721 0, |
721 0, |
722 self.drawingActGrp, |
722 self.drawingActGrp, |
723 "iconEditor_tools_circle", |
723 "iconEditor_tools_circle", |
730 self.drawCircleAct.triggered.connect(self.esm.map) |
730 self.drawCircleAct.triggered.connect(self.esm.map) |
731 self.__actions.append(self.drawCircleAct) |
731 self.__actions.append(self.drawCircleAct) |
732 |
732 |
733 self.drawFilledCircleAct = EricAction( |
733 self.drawFilledCircleAct = EricAction( |
734 self.tr("Filled Circle"), |
734 self.tr("Filled Circle"), |
735 UI.PixmapCache.getIcon("drawCircleFilled"), |
735 EricPixmapCache.getIcon("drawCircleFilled"), |
736 self.tr("Fille&d Circle"), |
736 self.tr("Fille&d Circle"), |
737 0, |
737 0, |
738 0, |
738 0, |
739 self.drawingActGrp, |
739 self.drawingActGrp, |
740 "iconEditor_tools_filled_circle", |
740 "iconEditor_tools_filled_circle", |
747 self.drawFilledCircleAct.triggered.connect(self.esm.map) |
747 self.drawFilledCircleAct.triggered.connect(self.esm.map) |
748 self.__actions.append(self.drawFilledCircleAct) |
748 self.__actions.append(self.drawFilledCircleAct) |
749 |
749 |
750 self.drawEllipseAct = EricAction( |
750 self.drawEllipseAct = EricAction( |
751 self.tr("Ellipse"), |
751 self.tr("Ellipse"), |
752 UI.PixmapCache.getIcon("drawEllipse"), |
752 EricPixmapCache.getIcon("drawEllipse"), |
753 self.tr("&Ellipse"), |
753 self.tr("&Ellipse"), |
754 0, |
754 0, |
755 0, |
755 0, |
756 self.drawingActGrp, |
756 self.drawingActGrp, |
757 "iconEditor_tools_ellipse", |
757 "iconEditor_tools_ellipse", |
764 self.drawEllipseAct.triggered.connect(self.esm.map) |
764 self.drawEllipseAct.triggered.connect(self.esm.map) |
765 self.__actions.append(self.drawEllipseAct) |
765 self.__actions.append(self.drawEllipseAct) |
766 |
766 |
767 self.drawFilledEllipseAct = EricAction( |
767 self.drawFilledEllipseAct = EricAction( |
768 self.tr("Filled Ellipse"), |
768 self.tr("Filled Ellipse"), |
769 UI.PixmapCache.getIcon("drawEllipseFilled"), |
769 EricPixmapCache.getIcon("drawEllipseFilled"), |
770 self.tr("Fille&d Elli&pse"), |
770 self.tr("Fille&d Elli&pse"), |
771 0, |
771 0, |
772 0, |
772 0, |
773 self.drawingActGrp, |
773 self.drawingActGrp, |
774 "iconEditor_tools_filled_ellipse", |
774 "iconEditor_tools_filled_ellipse", |
781 self.drawFilledEllipseAct.triggered.connect(self.esm.map) |
781 self.drawFilledEllipseAct.triggered.connect(self.esm.map) |
782 self.__actions.append(self.drawFilledEllipseAct) |
782 self.__actions.append(self.drawFilledEllipseAct) |
783 |
783 |
784 self.drawFloodFillAct = EricAction( |
784 self.drawFloodFillAct = EricAction( |
785 self.tr("Flood Fill"), |
785 self.tr("Flood Fill"), |
786 UI.PixmapCache.getIcon("drawFill"), |
786 EricPixmapCache.getIcon("drawFill"), |
787 self.tr("Fl&ood Fill"), |
787 self.tr("Fl&ood Fill"), |
788 0, |
788 0, |
789 0, |
789 0, |
790 self.drawingActGrp, |
790 self.drawingActGrp, |
791 "iconEditor_tools_flood_fill", |
791 "iconEditor_tools_flood_fill", |
802 self.drawFloodFillAct.triggered.connect(self.esm.map) |
802 self.drawFloodFillAct.triggered.connect(self.esm.map) |
803 self.__actions.append(self.drawFloodFillAct) |
803 self.__actions.append(self.drawFloodFillAct) |
804 |
804 |
805 self.drawLineAct = EricAction( |
805 self.drawLineAct = EricAction( |
806 self.tr("Line"), |
806 self.tr("Line"), |
807 UI.PixmapCache.getIcon("drawLine"), |
807 EricPixmapCache.getIcon("drawLine"), |
808 self.tr("&Line"), |
808 self.tr("&Line"), |
809 0, |
809 0, |
810 0, |
810 0, |
811 self.drawingActGrp, |
811 self.drawingActGrp, |
812 "iconEditor_tools_line", |
812 "iconEditor_tools_line", |
819 self.drawLineAct.triggered.connect(self.esm.map) |
819 self.drawLineAct.triggered.connect(self.esm.map) |
820 self.__actions.append(self.drawLineAct) |
820 self.__actions.append(self.drawLineAct) |
821 |
821 |
822 self.drawEraserAct = EricAction( |
822 self.drawEraserAct = EricAction( |
823 self.tr("Eraser (Transparent)"), |
823 self.tr("Eraser (Transparent)"), |
824 UI.PixmapCache.getIcon("drawEraser"), |
824 EricPixmapCache.getIcon("drawEraser"), |
825 self.tr("Eraser (&Transparent)"), |
825 self.tr("Eraser (&Transparent)"), |
826 0, |
826 0, |
827 0, |
827 0, |
828 self.drawingActGrp, |
828 self.drawingActGrp, |
829 "iconEditor_tools_eraser", |
829 "iconEditor_tools_eraser", |
839 self.drawEraserAct.triggered.connect(self.esm.map) |
839 self.drawEraserAct.triggered.connect(self.esm.map) |
840 self.__actions.append(self.drawEraserAct) |
840 self.__actions.append(self.drawEraserAct) |
841 |
841 |
842 self.drawRectangleSelectionAct = EricAction( |
842 self.drawRectangleSelectionAct = EricAction( |
843 self.tr("Rectangular Selection"), |
843 self.tr("Rectangular Selection"), |
844 UI.PixmapCache.getIcon("selectRectangle"), |
844 EricPixmapCache.getIcon("selectRectangle"), |
845 self.tr("Rect&angular Selection"), |
845 self.tr("Rect&angular Selection"), |
846 0, |
846 0, |
847 0, |
847 0, |
848 self.drawingActGrp, |
848 self.drawingActGrp, |
849 "iconEditor_tools_selection_rectangle", |
849 "iconEditor_tools_selection_rectangle", |
862 self.drawRectangleSelectionAct.triggered.connect(self.esm.map) |
862 self.drawRectangleSelectionAct.triggered.connect(self.esm.map) |
863 self.__actions.append(self.drawRectangleSelectionAct) |
863 self.__actions.append(self.drawRectangleSelectionAct) |
864 |
864 |
865 self.drawCircleSelectionAct = EricAction( |
865 self.drawCircleSelectionAct = EricAction( |
866 self.tr("Circular Selection"), |
866 self.tr("Circular Selection"), |
867 UI.PixmapCache.getIcon("selectCircle"), |
867 EricPixmapCache.getIcon("selectCircle"), |
868 self.tr("Rect&angular Selection"), |
868 self.tr("Rect&angular Selection"), |
869 0, |
869 0, |
870 0, |
870 0, |
871 self.drawingActGrp, |
871 self.drawingActGrp, |
872 "iconEditor_tools_selection_circle", |
872 "iconEditor_tools_selection_circle", |
922 self.aboutQtAct.triggered.connect(self.__aboutQt) |
922 self.aboutQtAct.triggered.connect(self.__aboutQt) |
923 self.__actions.append(self.aboutQtAct) |
923 self.__actions.append(self.aboutQtAct) |
924 |
924 |
925 self.whatsThisAct = EricAction( |
925 self.whatsThisAct = EricAction( |
926 self.tr("What's This?"), |
926 self.tr("What's This?"), |
927 UI.PixmapCache.getIcon("whatsThis"), |
927 EricPixmapCache.getIcon("whatsThis"), |
928 self.tr("&What's This?"), |
928 self.tr("&What's This?"), |
929 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
929 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
930 0, |
930 0, |
931 self, |
931 self, |
932 "iconEditor_help_whats_this", |
932 "iconEditor_help_whats_this", |
1021 """ |
1021 """ |
1022 Private method to create the toolbars. |
1022 Private method to create the toolbars. |
1023 """ |
1023 """ |
1024 filetb = self.addToolBar(self.tr("File")) |
1024 filetb = self.addToolBar(self.tr("File")) |
1025 filetb.setObjectName("FileToolBar") |
1025 filetb.setObjectName("FileToolBar") |
1026 filetb.setIconSize(UI.Config.ToolBarIconSize) |
1026 filetb.setIconSize(Config.ToolBarIconSize) |
1027 filetb.addAction(self.newAct) |
1027 filetb.addAction(self.newAct) |
1028 filetb.addAction(self.newWindowAct) |
1028 filetb.addAction(self.newWindowAct) |
1029 filetb.addAction(self.openAct) |
1029 filetb.addAction(self.openAct) |
1030 filetb.addSeparator() |
1030 filetb.addSeparator() |
1031 filetb.addAction(self.saveAct) |
1031 filetb.addAction(self.saveAct) |
1035 if not self.fromEric: |
1035 if not self.fromEric: |
1036 filetb.addAction(self.exitAct) |
1036 filetb.addAction(self.exitAct) |
1037 |
1037 |
1038 edittb = self.addToolBar(self.tr("Edit")) |
1038 edittb = self.addToolBar(self.tr("Edit")) |
1039 edittb.setObjectName("EditToolBar") |
1039 edittb.setObjectName("EditToolBar") |
1040 edittb.setIconSize(UI.Config.ToolBarIconSize) |
1040 edittb.setIconSize(Config.ToolBarIconSize) |
1041 edittb.addAction(self.undoAct) |
1041 edittb.addAction(self.undoAct) |
1042 edittb.addAction(self.redoAct) |
1042 edittb.addAction(self.redoAct) |
1043 edittb.addSeparator() |
1043 edittb.addSeparator() |
1044 edittb.addAction(self.cutAct) |
1044 edittb.addAction(self.cutAct) |
1045 edittb.addAction(self.copyAct) |
1045 edittb.addAction(self.copyAct) |
1048 edittb.addAction(self.resizeAct) |
1048 edittb.addAction(self.resizeAct) |
1049 edittb.addAction(self.grayscaleAct) |
1049 edittb.addAction(self.grayscaleAct) |
1050 |
1050 |
1051 viewtb = self.addToolBar(self.tr("View")) |
1051 viewtb = self.addToolBar(self.tr("View")) |
1052 viewtb.setObjectName("ViewToolBar") |
1052 viewtb.setObjectName("ViewToolBar") |
1053 viewtb.setIconSize(UI.Config.ToolBarIconSize) |
1053 viewtb.setIconSize(Config.ToolBarIconSize) |
1054 viewtb.addAction(self.showGridAct) |
1054 viewtb.addAction(self.showGridAct) |
1055 |
1055 |
1056 toolstb = self.addToolBar(self.tr("Tools")) |
1056 toolstb = self.addToolBar(self.tr("Tools")) |
1057 toolstb.setObjectName("ToolsToolBar") |
1057 toolstb.setObjectName("ToolsToolBar") |
1058 toolstb.setIconSize(UI.Config.ToolBarIconSize) |
1058 toolstb.setIconSize(Config.ToolBarIconSize) |
1059 toolstb.addAction(self.drawPencilAct) |
1059 toolstb.addAction(self.drawPencilAct) |
1060 toolstb.addAction(self.drawColorPickerAct) |
1060 toolstb.addAction(self.drawColorPickerAct) |
1061 toolstb.addAction(self.drawRectangleAct) |
1061 toolstb.addAction(self.drawRectangleAct) |
1062 toolstb.addAction(self.drawFilledRectangleAct) |
1062 toolstb.addAction(self.drawFilledRectangleAct) |
1063 toolstb.addAction(self.drawCircleAct) |
1063 toolstb.addAction(self.drawCircleAct) |
1071 toolstb.addAction(self.drawRectangleSelectionAct) |
1071 toolstb.addAction(self.drawRectangleSelectionAct) |
1072 toolstb.addAction(self.drawCircleSelectionAct) |
1072 toolstb.addAction(self.drawCircleSelectionAct) |
1073 |
1073 |
1074 helptb = self.addToolBar(self.tr("Help")) |
1074 helptb = self.addToolBar(self.tr("Help")) |
1075 helptb.setObjectName("HelpToolBar") |
1075 helptb.setObjectName("HelpToolBar") |
1076 helptb.setIconSize(UI.Config.ToolBarIconSize) |
1076 helptb.setIconSize(Config.ToolBarIconSize) |
1077 helptb.addAction(self.whatsThisAct) |
1077 helptb.addAction(self.whatsThisAct) |
1078 |
1078 |
1079 def __createStatusBar(self): |
1079 def __createStatusBar(self): |
1080 """ |
1080 """ |
1081 Private method to initialize the status bar. |
1081 Private method to initialize the status bar. |
1099 ) |
1099 ) |
1100 ) |
1100 ) |
1101 self.__updatePosition(0, 0) |
1101 self.__updatePosition(0, 0) |
1102 |
1102 |
1103 self.__zoomWidget = EricZoomWidget( |
1103 self.__zoomWidget = EricZoomWidget( |
1104 UI.PixmapCache.getPixmap("zoomOut"), |
1104 EricPixmapCache.getPixmap("zoomOut"), |
1105 UI.PixmapCache.getPixmap("zoomIn"), |
1105 EricPixmapCache.getPixmap("zoomIn"), |
1106 UI.PixmapCache.getPixmap("zoomReset"), |
1106 EricPixmapCache.getPixmap("zoomReset"), |
1107 self, |
1107 self, |
1108 ) |
1108 ) |
1109 self.__zoomWidget.setMinimum(IconEditorGrid.ZoomMinimum) |
1109 self.__zoomWidget.setMinimum(IconEditorGrid.ZoomMinimum) |
1110 self.__zoomWidget.setMaximum(IconEditorGrid.ZoomMaximum) |
1110 self.__zoomWidget.setMaximum(IconEditorGrid.ZoomMaximum) |
1111 self.__zoomWidget.setDefault(IconEditorGrid.ZoomDefault) |
1111 self.__zoomWidget.setDefault(IconEditorGrid.ZoomDefault) |