QScintilla/Editor.py

changeset 461
34528aaedf1c
parent 460
6a3899e91d76
child 478
e7d778ea21d6
equal deleted inserted replaced
460:6a3899e91d76 461:34528aaedf1c
656 self.menu.addAction(UI.PixmapCache.getIcon("printPreview.png"), 656 self.menu.addAction(UI.PixmapCache.getIcon("printPreview.png"),
657 self.trUtf8("Print Preview"), self.printPreviewFile) 657 self.trUtf8("Print Preview"), self.printPreviewFile)
658 self.menu.addAction(UI.PixmapCache.getIcon("print.png"), 658 self.menu.addAction(UI.PixmapCache.getIcon("print.png"),
659 self.trUtf8('Print'), self.printFile) 659 self.trUtf8('Print'), self.printFile)
660 660
661 self.connect(self.menu, SIGNAL('aboutToShow()'), self.__showContextMenu) 661 self.menu.aboutToShow.connect(self.__showContextMenu)
662 662
663 self.spellingMenu = QMenu() 663 self.spellingMenu = QMenu()
664 self.__menus["Spelling"] = self.spellingMenu 664 self.__menus["Spelling"] = self.spellingMenu
665 665
666 self.connect(self.spellingMenu, SIGNAL('aboutToShow()'), 666 self.spellingMenu.aboutToShow.connect(self.__showContextMenuSpelling)
667 self.__showContextMenuSpelling)
668 self.connect(self.spellingMenu, SIGNAL('triggered(QAction *)'), 667 self.connect(self.spellingMenu, SIGNAL('triggered(QAction *)'),
669 self.__contextMenuSpellingTriggered) 668 self.__contextMenuSpellingTriggered)
670 669
671 def __initContextMenuAutocompletion(self): 670 def __initContextMenuAutocompletion(self):
672 """ 671 """
688 self.autoCompleteFromAll) 687 self.autoCompleteFromAll)
689 menu.addSeparator() 688 menu.addSeparator()
690 self.menuActs["calltip"] = \ 689 self.menuActs["calltip"] = \
691 menu.addAction(self.trUtf8('Calltip'), self.callTip) 690 menu.addAction(self.trUtf8('Calltip'), self.callTip)
692 691
693 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuAutocompletion) 692 menu.aboutToShow.connect(self.__showContextMenuAutocompletion)
694 693
695 return menu 694 return menu
696 695
697 def __initContextMenuChecks(self): 696 def __initContextMenuChecks(self):
698 """ 697 """
699 Private method used to setup the Checks context sub menu. 698 Private method used to setup the Checks context sub menu.
700 """ 699 """
701 menu = QMenu(self.trUtf8('Check')) 700 menu = QMenu(self.trUtf8('Check'))
702 self.connect(menu, SIGNAL("aboutToShow()"), self.__showContextMenuChecks) 701 menu.aboutToShow.connect(self.__showContextMenuChecks)
703 return menu 702 return menu
704 703
705 def __initContextMenuShow(self): 704 def __initContextMenuShow(self):
706 """ 705 """
707 Private method used to setup the Show context sub menu. 706 Private method used to setup the Show context sub menu.
718 menu.addAction(self.trUtf8('Hide code coverage annotations'), 717 menu.addAction(self.trUtf8('Hide code coverage annotations'),
719 self.__codeCoverageHideAnnotations) 718 self.__codeCoverageHideAnnotations)
720 self.profileMenuAct = \ 719 self.profileMenuAct = \
721 menu.addAction(self.trUtf8('Profile data...'), self.__showProfileData) 720 menu.addAction(self.trUtf8('Profile data...'), self.__showProfileData)
722 721
723 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuShow) 722 menu.aboutToShow.connect(self.__showContextMenuShow)
724 723
725 return menu 724 return menu
726 725
727 def __initContextMenuGraphics(self): 726 def __initContextMenuGraphics(self):
728 """ 727 """
738 self.__showImportsDiagram) 737 self.__showImportsDiagram)
739 self.applicationDiagramMenuAct = \ 738 self.applicationDiagramMenuAct = \
740 menu.addAction(self.trUtf8('Application Diagram...'), 739 menu.addAction(self.trUtf8('Application Diagram...'),
741 self.__showApplicationDiagram) 740 self.__showApplicationDiagram)
742 741
743 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuGraphics) 742 menu.aboutToShow.connect(self.__showContextMenuGraphics)
744 743
745 return menu 744 return menu
746 745
747 def __initContextMenuLanguages(self): 746 def __initContextMenuLanguages(self):
748 """ 747 """
776 self.languagesActGrp.addAction(self.pygmentsAct) 775 self.languagesActGrp.addAction(self.pygmentsAct)
777 self.pygmentsSelAct = menu.addAction(self.trUtf8("Alternatives")) 776 self.pygmentsSelAct = menu.addAction(self.trUtf8("Alternatives"))
778 self.pygmentsSelAct.setData("Alternatives") 777 self.pygmentsSelAct.setData("Alternatives")
779 778
780 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__languageMenuTriggered) 779 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__languageMenuTriggered)
781 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuLanguages) 780 menu.aboutToShow.connect(self.__showContextMenuLanguages)
782 781
783 return menu 782 return menu
784 783
785 def __initContextMenuEncodings(self): 784 def __initContextMenuEncodings(self):
786 """ 785 """
798 act.setData(encoding) 797 act.setData(encoding)
799 self.supportedEncodings[encoding] = act 798 self.supportedEncodings[encoding] = act
800 self.encodingsActGrp.addAction(act) 799 self.encodingsActGrp.addAction(act)
801 800
802 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__encodingsMenuTriggered) 801 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__encodingsMenuTriggered)
803 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuEncodings) 802 menu.aboutToShow.connect(self.__showContextMenuEncodings)
804 803
805 return menu 804 return menu
806 805
807 def __initContextMenuEol(self): 806 def __initContextMenuEol(self):
808 """ 807 """
831 act.setData('\r') 830 act.setData('\r')
832 self.supportedEols['\r'] = act 831 self.supportedEols['\r'] = act
833 self.eolActGrp.addAction(act) 832 self.eolActGrp.addAction(act)
834 833
835 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__eolMenuTriggered) 834 self.connect(menu, SIGNAL('triggered(QAction *)'), self.__eolMenuTriggered)
836 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuEol) 835 menu.aboutToShow.connect(self.__showContextMenuEol)
837 836
838 return menu 837 return menu
839 838
840 def __initContextMenuExporters(self): 839 def __initContextMenuExporters(self):
841 """ 840 """
881 self.previousBookmark) 880 self.previousBookmark)
882 self.marginMenuActs["ClearBookmark"] = \ 881 self.marginMenuActs["ClearBookmark"] = \
883 self.bmMarginMenu.addAction(self.trUtf8('Clear all bookmarks'), 882 self.bmMarginMenu.addAction(self.trUtf8('Clear all bookmarks'),
884 self.clearBookmarks) 883 self.clearBookmarks)
885 884
886 self.connect(self.bmMarginMenu, SIGNAL('aboutToShow()'), 885 self.bmMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
887 self.__showContextMenuMargin)
888 886
889 # breakpoint margin 887 # breakpoint margin
890 self.bpMarginMenu = QMenu() 888 self.bpMarginMenu = QMenu()
891 889
892 self.marginMenuActs["Breakpoint"] = \ 890 self.marginMenuActs["Breakpoint"] = \
909 self.menuPreviousBreakpoint) 907 self.menuPreviousBreakpoint)
910 self.marginMenuActs["ClearBreakpoint"] = \ 908 self.marginMenuActs["ClearBreakpoint"] = \
911 self.bpMarginMenu.addAction(self.trUtf8('Clear all breakpoints'), 909 self.bpMarginMenu.addAction(self.trUtf8('Clear all breakpoints'),
912 self.__menuClearBreakpoints) 910 self.__menuClearBreakpoints)
913 911
914 self.connect(self.bpMarginMenu, SIGNAL('aboutToShow()'), 912 self.bpMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
915 self.__showContextMenuMargin)
916 913
917 # indicator margin 914 # indicator margin
918 self.indicMarginMenu = QMenu() 915 self.indicMarginMenu = QMenu()
919 916
920 self.marginMenuActs["GotoSyntaxError"] = \ 917 self.marginMenuActs["GotoSyntaxError"] = \
952 self.nextTask) 949 self.nextTask)
953 self.marginMenuActs["PreviousTaskMarker"] = \ 950 self.marginMenuActs["PreviousTaskMarker"] = \
954 self.indicMarginMenu.addAction(self.trUtf8('Previous task'), 951 self.indicMarginMenu.addAction(self.trUtf8('Previous task'),
955 self.previousTask) 952 self.previousTask)
956 953
957 self.connect(self.indicMarginMenu, SIGNAL('aboutToShow()'), 954 self.indicMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
958 self.__showContextMenuMargin)
959 955
960 def __initContextMenuUnifiedMargins(self): 956 def __initContextMenuUnifiedMargins(self):
961 """ 957 """
962 Private method used to setup the context menu for the unified margins 958 Private method used to setup the context menu for the unified margins
963 """ 959 """
1043 self.marginMenu.addAction(self.trUtf8('LMB toggles breakpoints'), 1039 self.marginMenu.addAction(self.trUtf8('LMB toggles breakpoints'),
1044 self.__lmBbreakpoints) 1040 self.__lmBbreakpoints)
1045 self.marginMenuActs["LMBbreakpoints"].setCheckable(True) 1041 self.marginMenuActs["LMBbreakpoints"].setCheckable(True)
1046 self.marginMenuActs["LMBbreakpoints"].setChecked(True) 1042 self.marginMenuActs["LMBbreakpoints"].setChecked(True)
1047 1043
1048 self.connect(self.marginMenu, SIGNAL('aboutToShow()'), 1044 self.marginMenu.aboutToShow.connect(self.__showContextMenuMargin)
1049 self.__showContextMenuMargin)
1050 1045
1051 def __exportMenuTriggered(self, act): 1046 def __exportMenuTriggered(self, act):
1052 """ 1047 """
1053 Private method to handle the selection of an export format. 1048 Private method to handle the selection of an export format.
1054 1049
5016 self.__addLocalizedResource) 5011 self.__addLocalizedResource)
5017 menu.addSeparator() 5012 menu.addSeparator()
5018 menu.addAction(self.trUtf8('Add resource frame'), 5013 menu.addAction(self.trUtf8('Add resource frame'),
5019 self.__addResourceFrame) 5014 self.__addResourceFrame)
5020 5015
5021 self.connect(menu, SIGNAL('aboutToShow()'), self.__showContextMenuResources) 5016 menu.aboutToShow.connect(self.__showContextMenuResources)
5022 5017
5023 return menu 5018 return menu
5024 5019
5025 def __showContextMenuResources(self): 5020 def __showContextMenuResources(self):
5026 """ 5021 """

eric ide

mercurial