37 QLabel, |
37 QLabel, |
38 ) |
38 ) |
39 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog |
39 from PyQt6.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog |
40 from PyQt6.Qsci import QsciScintilla |
40 from PyQt6.Qsci import QsciScintilla |
41 |
41 |
42 from EricGui.EricAction import EricAction, createActionGroup |
42 from eric7.EricGui.EricAction import EricAction, createActionGroup |
43 from EricWidgets import EricMessageBox, EricFileDialog |
43 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
44 from EricWidgets.EricMainWindow import EricMainWindow |
44 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
45 from EricWidgets.EricClickableLabel import EricClickableLabel |
45 from eric7.EricWidgets.EricClickableLabel import EricClickableLabel |
46 from EricWidgets.EricZoomWidget import EricZoomWidget |
46 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
47 from EricGui.EricOverrideCursor import EricOverrideCursor |
47 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
48 |
48 |
49 from .QsciScintillaCompat import QsciScintillaCompat |
49 from .QsciScintillaCompat import QsciScintillaCompat |
50 |
50 |
51 import UI.PixmapCache |
51 from eric7.EricGui import EricPixmapCache |
52 import UI.Config |
52 from eric7.UI import Config |
53 |
53 |
54 from Globals import isMacPlatform |
54 from eric7.Globals import isMacPlatform |
55 |
55 |
56 import Utilities |
56 from eric7 import Preferences, Utilities |
57 import Preferences |
|
58 |
57 |
59 |
58 |
60 class MiniScintilla(QsciScintillaCompat): |
59 class MiniScintilla(QsciScintillaCompat): |
61 """ |
60 """ |
62 Class implementing a QsciScintillaCompat subclass for handling focus |
61 Class implementing a QsciScintillaCompat subclass for handling focus |
271 @param name object name of the window (string) |
270 @param name object name of the window (string) |
272 """ |
271 """ |
273 super().__init__(parent) |
272 super().__init__(parent) |
274 if name is not None: |
273 if name is not None: |
275 self.setObjectName(name) |
274 self.setObjectName(name) |
276 self.setWindowIcon(UI.PixmapCache.getIcon("editor")) |
275 self.setWindowIcon(EricPixmapCache.getIcon("editor")) |
277 |
276 |
278 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
277 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
279 |
278 |
280 self.__textEdit = MiniScintilla(self) |
279 self.__textEdit = MiniScintilla(self) |
281 self.__textEdit.clearSearchIndicators = self.clearSearchIndicators |
280 self.__textEdit.clearSearchIndicators = self.clearSearchIndicators |
538 self.sbPos.setText(self.tr("Pos: {0:5}").format(pos)) |
537 self.sbPos.setText(self.tr("Pos: {0:5}").format(pos)) |
539 |
538 |
540 if language is None: |
539 if language is None: |
541 pixmap = QPixmap() |
540 pixmap = QPixmap() |
542 elif language == "": |
541 elif language == "": |
543 pixmap = UI.PixmapCache.getPixmap("fileText") |
542 pixmap = EricPixmapCache.getPixmap("fileText") |
544 else: |
543 else: |
545 import QScintilla.Lexers |
544 from eric7.QScintilla import Lexers |
546 |
545 |
547 pixmap = QScintilla.Lexers.getLanguageIcon(language, True) |
546 pixmap = Lexers.getLanguageIcon(language, True) |
548 self.sbLanguage.setPixmap(pixmap) |
547 self.sbLanguage.setPixmap(pixmap) |
549 if pixmap.isNull(): |
548 if pixmap.isNull(): |
550 self.sbLanguage.setText(language) |
549 self.sbLanguage.setText(language) |
551 self.sbLanguage.setToolTip("") |
550 self.sbLanguage.setToolTip("") |
552 else: |
551 else: |
668 self.saveAct.triggered.connect(self.__save) |
667 self.saveAct.triggered.connect(self.__save) |
669 self.fileActions.append(self.saveAct) |
668 self.fileActions.append(self.saveAct) |
670 |
669 |
671 self.saveAsAct = EricAction( |
670 self.saveAsAct = EricAction( |
672 self.tr("Save as"), |
671 self.tr("Save as"), |
673 UI.PixmapCache.getIcon("fileSaveAs"), |
672 EricPixmapCache.getIcon("fileSaveAs"), |
674 self.tr("Save &as..."), |
673 self.tr("Save &as..."), |
675 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
674 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
676 0, |
675 0, |
677 self, |
676 self, |
678 "vm_file_save_as", |
677 "vm_file_save_as", |
688 self.saveAsAct.triggered.connect(self.__saveAs) |
687 self.saveAsAct.triggered.connect(self.__saveAs) |
689 self.fileActions.append(self.saveAsAct) |
688 self.fileActions.append(self.saveAsAct) |
690 |
689 |
691 self.saveCopyAct = EricAction( |
690 self.saveCopyAct = EricAction( |
692 self.tr("Save Copy"), |
691 self.tr("Save Copy"), |
693 UI.PixmapCache.getIcon("fileSaveCopy"), |
692 EricPixmapCache.getIcon("fileSaveCopy"), |
694 self.tr("Save &Copy..."), |
693 self.tr("Save &Copy..."), |
695 0, |
694 0, |
696 0, |
695 0, |
697 self, |
696 self, |
698 "vm_file_save_copy", |
697 "vm_file_save_copy", |
743 self.printAct.triggered.connect(self.__printFile) |
742 self.printAct.triggered.connect(self.__printFile) |
744 self.fileActions.append(self.printAct) |
743 self.fileActions.append(self.printAct) |
745 |
744 |
746 self.printPreviewAct = EricAction( |
745 self.printPreviewAct = EricAction( |
747 self.tr("Print Preview"), |
746 self.tr("Print Preview"), |
748 UI.PixmapCache.getIcon("printPreview"), |
747 EricPixmapCache.getIcon("printPreview"), |
749 QCoreApplication.translate("ViewManager", "Print Preview"), |
748 QCoreApplication.translate("ViewManager", "Print Preview"), |
750 0, |
749 0, |
751 0, |
750 0, |
752 self, |
751 self, |
753 "vm_file_print_preview", |
752 "vm_file_print_preview", |
766 """ |
765 """ |
767 Private method to create the Edit actions. |
766 Private method to create the Edit actions. |
768 """ |
767 """ |
769 self.undoAct = EricAction( |
768 self.undoAct = EricAction( |
770 self.tr("Undo"), |
769 self.tr("Undo"), |
771 UI.PixmapCache.getIcon("editUndo"), |
770 EricPixmapCache.getIcon("editUndo"), |
772 self.tr("&Undo"), |
771 self.tr("&Undo"), |
773 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
772 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
774 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
773 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
775 self, |
774 self, |
776 "vm_edit_undo", |
775 "vm_edit_undo", |
804 self.redoAct.triggered.connect(self.__redo) |
803 self.redoAct.triggered.connect(self.__redo) |
805 self.editActions.append(self.redoAct) |
804 self.editActions.append(self.redoAct) |
806 |
805 |
807 self.cutAct = EricAction( |
806 self.cutAct = EricAction( |
808 self.tr("Cut"), |
807 self.tr("Cut"), |
809 UI.PixmapCache.getIcon("editCut"), |
808 EricPixmapCache.getIcon("editCut"), |
810 self.tr("Cu&t"), |
809 self.tr("Cu&t"), |
811 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
810 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
812 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
811 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
813 self, |
812 self, |
814 "vm_edit_cut", |
813 "vm_edit_cut", |
824 self.cutAct.triggered.connect(self.__textEdit.cut) |
823 self.cutAct.triggered.connect(self.__textEdit.cut) |
825 self.editActions.append(self.cutAct) |
824 self.editActions.append(self.cutAct) |
826 |
825 |
827 self.copyAct = EricAction( |
826 self.copyAct = EricAction( |
828 self.tr("Copy"), |
827 self.tr("Copy"), |
829 UI.PixmapCache.getIcon("editCopy"), |
828 EricPixmapCache.getIcon("editCopy"), |
830 self.tr("&Copy"), |
829 self.tr("&Copy"), |
831 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
830 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
832 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
831 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
833 self, |
832 self, |
834 "vm_edit_copy", |
833 "vm_edit_copy", |
844 self.copyAct.triggered.connect(self.__textEdit.copy) |
843 self.copyAct.triggered.connect(self.__textEdit.copy) |
845 self.editActions.append(self.copyAct) |
844 self.editActions.append(self.copyAct) |
846 |
845 |
847 self.pasteAct = EricAction( |
846 self.pasteAct = EricAction( |
848 self.tr("Paste"), |
847 self.tr("Paste"), |
849 UI.PixmapCache.getIcon("editPaste"), |
848 EricPixmapCache.getIcon("editPaste"), |
850 self.tr("&Paste"), |
849 self.tr("&Paste"), |
851 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
850 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
852 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
851 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
853 self, |
852 self, |
854 "vm_edit_paste", |
853 "vm_edit_paste", |
864 self.pasteAct.triggered.connect(self.__textEdit.paste) |
863 self.pasteAct.triggered.connect(self.__textEdit.paste) |
865 self.editActions.append(self.pasteAct) |
864 self.editActions.append(self.pasteAct) |
866 |
865 |
867 self.deleteAct = EricAction( |
866 self.deleteAct = EricAction( |
868 self.tr("Clear"), |
867 self.tr("Clear"), |
869 UI.PixmapCache.getIcon("editDelete"), |
868 EricPixmapCache.getIcon("editDelete"), |
870 self.tr("Cl&ear"), |
869 self.tr("Cl&ear"), |
871 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")), |
870 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")), |
872 0, |
871 0, |
873 self, |
872 self, |
874 "vm_edit_clear", |
873 "vm_edit_clear", |
2539 Private method defining the user interface actions for the search |
2538 Private method defining the user interface actions for the search |
2540 commands. |
2539 commands. |
2541 """ |
2540 """ |
2542 self.searchAct = EricAction( |
2541 self.searchAct = EricAction( |
2543 QCoreApplication.translate("ViewManager", "Search"), |
2542 QCoreApplication.translate("ViewManager", "Search"), |
2544 UI.PixmapCache.getIcon("find"), |
2543 EricPixmapCache.getIcon("find"), |
2545 QCoreApplication.translate("ViewManager", "&Search..."), |
2544 QCoreApplication.translate("ViewManager", "&Search..."), |
2546 QKeySequence( |
2545 QKeySequence( |
2547 QCoreApplication.translate("ViewManager", "Ctrl+F", "Search|Search") |
2546 QCoreApplication.translate("ViewManager", "Ctrl+F", "Search|Search") |
2548 ), |
2547 ), |
2549 0, |
2548 0, |
2565 self.searchAct.triggered.connect(self.showSearchWidget) |
2564 self.searchAct.triggered.connect(self.showSearchWidget) |
2566 self.searchActions.append(self.searchAct) |
2565 self.searchActions.append(self.searchAct) |
2567 |
2566 |
2568 self.searchNextAct = EricAction( |
2567 self.searchNextAct = EricAction( |
2569 QCoreApplication.translate("ViewManager", "Search next"), |
2568 QCoreApplication.translate("ViewManager", "Search next"), |
2570 UI.PixmapCache.getIcon("findNext"), |
2569 EricPixmapCache.getIcon("findNext"), |
2571 QCoreApplication.translate("ViewManager", "Search &next"), |
2570 QCoreApplication.translate("ViewManager", "Search &next"), |
2572 QKeySequence( |
2571 QKeySequence( |
2573 QCoreApplication.translate("ViewManager", "F3", "Search|Search next") |
2572 QCoreApplication.translate("ViewManager", "F3", "Search|Search next") |
2574 ), |
2573 ), |
2575 0, |
2574 0, |
2591 self.searchNextAct.triggered.connect(self.__searchNext) |
2590 self.searchNextAct.triggered.connect(self.__searchNext) |
2592 self.searchActions.append(self.searchNextAct) |
2591 self.searchActions.append(self.searchNextAct) |
2593 |
2592 |
2594 self.searchPrevAct = EricAction( |
2593 self.searchPrevAct = EricAction( |
2595 QCoreApplication.translate("ViewManager", "Search previous"), |
2594 QCoreApplication.translate("ViewManager", "Search previous"), |
2596 UI.PixmapCache.getIcon("findPrev"), |
2595 EricPixmapCache.getIcon("findPrev"), |
2597 QCoreApplication.translate("ViewManager", "Search &previous"), |
2596 QCoreApplication.translate("ViewManager", "Search &previous"), |
2598 QKeySequence( |
2597 QKeySequence( |
2599 QCoreApplication.translate( |
2598 QCoreApplication.translate( |
2600 "ViewManager", "Shift+F3", "Search|Search previous" |
2599 "ViewManager", "Shift+F3", "Search|Search previous" |
2601 ) |
2600 ) |
2621 self.searchPrevAct.triggered.connect(self.__searchPrev) |
2620 self.searchPrevAct.triggered.connect(self.__searchPrev) |
2622 self.searchActions.append(self.searchPrevAct) |
2621 self.searchActions.append(self.searchPrevAct) |
2623 |
2622 |
2624 self.searchClearMarkersAct = EricAction( |
2623 self.searchClearMarkersAct = EricAction( |
2625 QCoreApplication.translate("ViewManager", "Clear search markers"), |
2624 QCoreApplication.translate("ViewManager", "Clear search markers"), |
2626 UI.PixmapCache.getIcon("findClear"), |
2625 EricPixmapCache.getIcon("findClear"), |
2627 QCoreApplication.translate("ViewManager", "Clear search markers"), |
2626 QCoreApplication.translate("ViewManager", "Clear search markers"), |
2628 QKeySequence( |
2627 QKeySequence( |
2629 QCoreApplication.translate( |
2628 QCoreApplication.translate( |
2630 "ViewManager", "Ctrl+3", "Search|Clear search markers" |
2629 "ViewManager", "Ctrl+3", "Search|Clear search markers" |
2631 ) |
2630 ) |
2674 self.replaceAct.triggered.connect(self.showReplaceWidget) |
2673 self.replaceAct.triggered.connect(self.showReplaceWidget) |
2675 self.searchActions.append(self.replaceAct) |
2674 self.searchActions.append(self.replaceAct) |
2676 |
2675 |
2677 self.replaceAndSearchAct = EricAction( |
2676 self.replaceAndSearchAct = EricAction( |
2678 QCoreApplication.translate("ViewManager", "Replace and Search"), |
2677 QCoreApplication.translate("ViewManager", "Replace and Search"), |
2679 UI.PixmapCache.getIcon("editReplaceSearch"), |
2678 EricPixmapCache.getIcon("editReplaceSearch"), |
2680 QCoreApplication.translate("ViewManager", "Replace and Search"), |
2679 QCoreApplication.translate("ViewManager", "Replace and Search"), |
2681 QKeySequence( |
2680 QKeySequence( |
2682 QCoreApplication.translate( |
2681 QCoreApplication.translate( |
2683 "ViewManager", "Meta+R", "Search|Replace and Search" |
2682 "ViewManager", "Meta+R", "Search|Replace and Search" |
2684 ) |
2683 ) |
2704 self.replaceAndSearchAct.triggered.connect(self.__replaceWidget.replaceSearch) |
2703 self.replaceAndSearchAct.triggered.connect(self.__replaceWidget.replaceSearch) |
2705 self.searchActions.append(self.replaceAndSearchAct) |
2704 self.searchActions.append(self.replaceAndSearchAct) |
2706 |
2705 |
2707 self.replaceSelectionAct = EricAction( |
2706 self.replaceSelectionAct = EricAction( |
2708 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
2707 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
2709 UI.PixmapCache.getIcon("editReplace"), |
2708 EricPixmapCache.getIcon("editReplace"), |
2710 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
2709 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
2711 QKeySequence( |
2710 QKeySequence( |
2712 QCoreApplication.translate( |
2711 QCoreApplication.translate( |
2713 "ViewManager", "Ctrl+Meta+R", "Search|Replace Occurrence" |
2712 "ViewManager", "Ctrl+Meta+R", "Search|Replace Occurrence" |
2714 ) |
2713 ) |
2731 self.replaceSelectionAct.triggered.connect(self.__replaceWidget.replace) |
2730 self.replaceSelectionAct.triggered.connect(self.__replaceWidget.replace) |
2732 self.searchActions.append(self.replaceSelectionAct) |
2731 self.searchActions.append(self.replaceSelectionAct) |
2733 |
2732 |
2734 self.replaceAllAct = EricAction( |
2733 self.replaceAllAct = EricAction( |
2735 QCoreApplication.translate("ViewManager", "Replace All"), |
2734 QCoreApplication.translate("ViewManager", "Replace All"), |
2736 UI.PixmapCache.getIcon("editReplaceAll"), |
2735 EricPixmapCache.getIcon("editReplaceAll"), |
2737 QCoreApplication.translate("ViewManager", "Replace All"), |
2736 QCoreApplication.translate("ViewManager", "Replace All"), |
2738 QKeySequence( |
2737 QKeySequence( |
2739 QCoreApplication.translate( |
2738 QCoreApplication.translate( |
2740 "ViewManager", "Shift+Meta+R", "Search|Replace All" |
2739 "ViewManager", "Shift+Meta+R", "Search|Replace All" |
2741 ) |
2740 ) |
2762 """ |
2761 """ |
2763 Private method to create the View actions. |
2762 Private method to create the View actions. |
2764 """ |
2763 """ |
2765 self.zoomInAct = EricAction( |
2764 self.zoomInAct = EricAction( |
2766 QCoreApplication.translate("ViewManager", "Zoom in"), |
2765 QCoreApplication.translate("ViewManager", "Zoom in"), |
2767 UI.PixmapCache.getIcon("zoomIn"), |
2766 EricPixmapCache.getIcon("zoomIn"), |
2768 QCoreApplication.translate("ViewManager", "Zoom &in"), |
2767 QCoreApplication.translate("ViewManager", "Zoom &in"), |
2769 QKeySequence( |
2768 QKeySequence( |
2770 QCoreApplication.translate("ViewManager", "Ctrl++", "View|Zoom in") |
2769 QCoreApplication.translate("ViewManager", "Ctrl++", "View|Zoom in") |
2771 ), |
2770 ), |
2772 QKeySequence( |
2771 QKeySequence( |
2788 self.zoomInAct.triggered.connect(self.__zoomIn) |
2787 self.zoomInAct.triggered.connect(self.__zoomIn) |
2789 self.viewActions.append(self.zoomInAct) |
2788 self.viewActions.append(self.zoomInAct) |
2790 |
2789 |
2791 self.zoomOutAct = EricAction( |
2790 self.zoomOutAct = EricAction( |
2792 QCoreApplication.translate("ViewManager", "Zoom out"), |
2791 QCoreApplication.translate("ViewManager", "Zoom out"), |
2793 UI.PixmapCache.getIcon("zoomOut"), |
2792 EricPixmapCache.getIcon("zoomOut"), |
2794 QCoreApplication.translate("ViewManager", "Zoom &out"), |
2793 QCoreApplication.translate("ViewManager", "Zoom &out"), |
2795 QKeySequence( |
2794 QKeySequence( |
2796 QCoreApplication.translate("ViewManager", "Ctrl+-", "View|Zoom out") |
2795 QCoreApplication.translate("ViewManager", "Ctrl+-", "View|Zoom out") |
2797 ), |
2796 ), |
2798 QKeySequence( |
2797 QKeySequence( |
2814 self.zoomOutAct.triggered.connect(self.__zoomOut) |
2813 self.zoomOutAct.triggered.connect(self.__zoomOut) |
2815 self.viewActions.append(self.zoomOutAct) |
2814 self.viewActions.append(self.zoomOutAct) |
2816 |
2815 |
2817 self.zoomResetAct = EricAction( |
2816 self.zoomResetAct = EricAction( |
2818 QCoreApplication.translate("ViewManager", "Zoom reset"), |
2817 QCoreApplication.translate("ViewManager", "Zoom reset"), |
2819 UI.PixmapCache.getIcon("zoomReset"), |
2818 EricPixmapCache.getIcon("zoomReset"), |
2820 QCoreApplication.translate("ViewManager", "Zoom &reset"), |
2819 QCoreApplication.translate("ViewManager", "Zoom &reset"), |
2821 QKeySequence( |
2820 QKeySequence( |
2822 QCoreApplication.translate("ViewManager", "Ctrl+0", "View|Zoom reset") |
2821 QCoreApplication.translate("ViewManager", "Ctrl+0", "View|Zoom reset") |
2823 ), |
2822 ), |
2824 0, |
2823 0, |
2839 self.zoomResetAct.triggered.connect(self.__zoomReset) |
2838 self.zoomResetAct.triggered.connect(self.__zoomReset) |
2840 self.viewActions.append(self.zoomResetAct) |
2839 self.viewActions.append(self.zoomResetAct) |
2841 |
2840 |
2842 self.zoomToAct = EricAction( |
2841 self.zoomToAct = EricAction( |
2843 QCoreApplication.translate("ViewManager", "Zoom"), |
2842 QCoreApplication.translate("ViewManager", "Zoom"), |
2844 UI.PixmapCache.getIcon("zoomTo"), |
2843 EricPixmapCache.getIcon("zoomTo"), |
2845 QCoreApplication.translate("ViewManager", "&Zoom"), |
2844 QCoreApplication.translate("ViewManager", "&Zoom"), |
2846 0, |
2845 0, |
2847 0, |
2846 0, |
2848 self, |
2847 self, |
2849 "vm_view_zoom", |
2848 "vm_view_zoom", |
2894 self.aboutQtAct.triggered.connect(self.__aboutQt) |
2893 self.aboutQtAct.triggered.connect(self.__aboutQt) |
2895 self.helpActions.append(self.aboutQtAct) |
2894 self.helpActions.append(self.aboutQtAct) |
2896 |
2895 |
2897 self.whatsThisAct = EricAction( |
2896 self.whatsThisAct = EricAction( |
2898 self.tr("What's This?"), |
2897 self.tr("What's This?"), |
2899 UI.PixmapCache.getIcon("whatsThis"), |
2898 EricPixmapCache.getIcon("whatsThis"), |
2900 self.tr("&What's This?"), |
2899 self.tr("&What's This?"), |
2901 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
2900 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
2902 0, |
2901 0, |
2903 self, |
2902 self, |
2904 "help_help_whats_this", |
2903 "help_help_whats_this", |
2922 """ |
2921 """ |
2923 Private method to create the Settings actions. |
2922 Private method to create the Settings actions. |
2924 """ |
2923 """ |
2925 self.prefAct = EricAction( |
2924 self.prefAct = EricAction( |
2926 self.tr("Preferences"), |
2925 self.tr("Preferences"), |
2927 UI.PixmapCache.getIcon("configure"), |
2926 EricPixmapCache.getIcon("configure"), |
2928 self.tr("&Preferences..."), |
2927 self.tr("&Preferences..."), |
2929 0, |
2928 0, |
2930 0, |
2929 0, |
2931 self, |
2930 self, |
2932 "hexEditor_settings_preferences", |
2931 "hexEditor_settings_preferences", |
3001 def __createToolBars(self): |
3000 def __createToolBars(self): |
3002 """ |
3001 """ |
3003 Private method to create the various toolbars. |
3002 Private method to create the various toolbars. |
3004 """ |
3003 """ |
3005 filetb = self.addToolBar(self.tr("File")) |
3004 filetb = self.addToolBar(self.tr("File")) |
3006 filetb.setIconSize(UI.Config.ToolBarIconSize) |
3005 filetb.setIconSize(Config.ToolBarIconSize) |
3007 filetb.addAction(self.newAct) |
3006 filetb.addAction(self.newAct) |
3008 filetb.addAction(self.openAct) |
3007 filetb.addAction(self.openAct) |
3009 filetb.addAction(self.saveAct) |
3008 filetb.addAction(self.saveAct) |
3010 filetb.addAction(self.saveAsAct) |
3009 filetb.addAction(self.saveAsAct) |
3011 filetb.addAction(self.saveCopyAct) |
3010 filetb.addAction(self.saveCopyAct) |
3014 filetb.addAction(self.printAct) |
3013 filetb.addAction(self.printAct) |
3015 filetb.addSeparator() |
3014 filetb.addSeparator() |
3016 filetb.addAction(self.closeAct) |
3015 filetb.addAction(self.closeAct) |
3017 |
3016 |
3018 edittb = self.addToolBar(self.tr("Edit")) |
3017 edittb = self.addToolBar(self.tr("Edit")) |
3019 edittb.setIconSize(UI.Config.ToolBarIconSize) |
3018 edittb.setIconSize(Config.ToolBarIconSize) |
3020 edittb.addAction(self.undoAct) |
3019 edittb.addAction(self.undoAct) |
3021 edittb.addAction(self.redoAct) |
3020 edittb.addAction(self.redoAct) |
3022 edittb.addSeparator() |
3021 edittb.addSeparator() |
3023 edittb.addAction(self.cutAct) |
3022 edittb.addAction(self.cutAct) |
3024 edittb.addAction(self.copyAct) |
3023 edittb.addAction(self.copyAct) |
3025 edittb.addAction(self.pasteAct) |
3024 edittb.addAction(self.pasteAct) |
3026 edittb.addAction(self.deleteAct) |
3025 edittb.addAction(self.deleteAct) |
3027 |
3026 |
3028 findtb = self.addToolBar(self.tr("Search")) |
3027 findtb = self.addToolBar(self.tr("Search")) |
3029 findtb.setIconSize(UI.Config.ToolBarIconSize) |
3028 findtb.setIconSize(Config.ToolBarIconSize) |
3030 findtb.addAction(self.searchAct) |
3029 findtb.addAction(self.searchAct) |
3031 findtb.addAction(self.searchNextAct) |
3030 findtb.addAction(self.searchNextAct) |
3032 findtb.addAction(self.searchPrevAct) |
3031 findtb.addAction(self.searchPrevAct) |
3033 findtb.addAction(self.searchClearMarkersAct) |
3032 findtb.addAction(self.searchClearMarkersAct) |
3034 |
3033 |
3035 viewtb = self.addToolBar(self.tr("View")) |
3034 viewtb = self.addToolBar(self.tr("View")) |
3036 viewtb.setIconSize(UI.Config.ToolBarIconSize) |
3035 viewtb.setIconSize(Config.ToolBarIconSize) |
3037 viewtb.addAction(self.zoomInAct) |
3036 viewtb.addAction(self.zoomInAct) |
3038 viewtb.addAction(self.zoomOutAct) |
3037 viewtb.addAction(self.zoomOutAct) |
3039 viewtb.addAction(self.zoomResetAct) |
3038 viewtb.addAction(self.zoomResetAct) |
3040 viewtb.addAction(self.zoomToAct) |
3039 viewtb.addAction(self.zoomToAct) |
3041 |
3040 |
3042 settingstb = self.addToolBar(self.tr("Settings")) |
3041 settingstb = self.addToolBar(self.tr("Settings")) |
3043 settingstb.setIconSize(UI.Config.ToolBarIconSize) |
3042 settingstb.setIconSize(Config.ToolBarIconSize) |
3044 settingstb.addAction(self.prefAct) |
3043 settingstb.addAction(self.prefAct) |
3045 |
3044 |
3046 helptb = self.addToolBar(self.tr("Help")) |
3045 helptb = self.addToolBar(self.tr("Help")) |
3047 helptb.setIconSize(UI.Config.ToolBarIconSize) |
3046 helptb.setIconSize(Config.ToolBarIconSize) |
3048 helptb.addAction(self.whatsThisAct) |
3047 helptb.addAction(self.whatsThisAct) |
3049 |
3048 |
3050 def __createStatusBar(self): |
3049 def __createStatusBar(self): |
3051 """ |
3050 """ |
3052 Private method to initialize the status bar. |
3051 Private method to initialize the status bar. |
3090 """ of the editor.</p>""" |
3089 """ of the editor.</p>""" |
3091 ) |
3090 ) |
3092 ) |
3091 ) |
3093 |
3092 |
3094 self.sbZoom = EricZoomWidget( |
3093 self.sbZoom = EricZoomWidget( |
3095 UI.PixmapCache.getPixmap("zoomOut"), |
3094 EricPixmapCache.getPixmap("zoomOut"), |
3096 UI.PixmapCache.getPixmap("zoomIn"), |
3095 EricPixmapCache.getPixmap("zoomIn"), |
3097 UI.PixmapCache.getPixmap("zoomReset"), |
3096 EricPixmapCache.getPixmap("zoomReset"), |
3098 self.__statusBar, |
3097 self.__statusBar, |
3099 ) |
3098 ) |
3100 self.__statusBar.addPermanentWidget(self.sbZoom) |
3099 self.__statusBar.addPermanentWidget(self.sbZoom) |
3101 self.sbZoom.setWhatsThis( |
3100 self.sbZoom.setWhatsThis( |
3102 self.tr( |
3101 self.tr( |
3760 languages = sorted(supportedLanguages.keys()) |
3759 languages = sorted(supportedLanguages.keys()) |
3761 for language in languages: |
3760 for language in languages: |
3762 if language != "Guessed": |
3761 if language != "Guessed": |
3763 self.supportedLanguages[language] = supportedLanguages[language][:2] |
3762 self.supportedLanguages[language] = supportedLanguages[language][:2] |
3764 act = menu.addAction( |
3763 act = menu.addAction( |
3765 UI.PixmapCache.getIcon(supportedLanguages[language][2]), |
3764 EricPixmapCache.getIcon(supportedLanguages[language][2]), |
3766 self.supportedLanguages[language][0], |
3765 self.supportedLanguages[language][0], |
3767 ) |
3766 ) |
3768 act.setCheckable(True) |
3767 act.setCheckable(True) |
3769 act.setData(language) |
3768 act.setData(language) |
3770 self.supportedLanguages[language].append(act) |
3769 self.supportedLanguages[language].append(act) |
4481 |
4480 |
4482 def __zoom(self): |
4481 def __zoom(self): |
4483 """ |
4482 """ |
4484 Private method to handle the zoom action. |
4483 Private method to handle the zoom action. |
4485 """ |
4484 """ |
4486 from QScintilla.ZoomDialog import ZoomDialog |
4485 from eric7.QScintilla.ZoomDialog import ZoomDialog |
4487 |
4486 |
4488 dlg = ZoomDialog(self.getZoom(), self, None, True) |
4487 dlg = ZoomDialog(self.getZoom(), self, None, True) |
4489 if dlg.exec() == QDialog.DialogCode.Accepted: |
4488 if dlg.exec() == QDialog.DialogCode.Accepted: |
4490 value = dlg.getZoomSize() |
4489 value = dlg.getZoomSize() |
4491 self.__zoomTo(value) |
4490 self.__zoomTo(value) |