147 @param editor reference to an Editor object, if this is a cloned view |
147 @param editor reference to an Editor object, if this is a cloned view |
148 @param tv reference to the task viewer object |
148 @param tv reference to the task viewer object |
149 @exception IOError raised to indicate an issue accessing the file |
149 @exception IOError raised to indicate an issue accessing the file |
150 """ |
150 """ |
151 super(Editor, self).__init__() |
151 super(Editor, self).__init__() |
152 self.setAttribute(Qt.WA_DeleteOnClose) |
152 ## self.setAttribute(Qt.WA_DeleteOnClose) |
153 self.setAttribute(Qt.WA_KeyCompression) |
153 self.setAttribute(Qt.WA_KeyCompression) |
154 self.setUtf8(True) |
154 self.setUtf8(True) |
155 |
155 |
156 self.dbs = dbs |
156 self.dbs = dbs |
157 self.taskViewer = tv |
157 self.taskViewer = tv |
610 else: |
610 else: |
611 self.checksMenu = self.__initContextMenuChecks() |
611 self.checksMenu = self.__initContextMenuChecks() |
612 self.menuShow = self.__initContextMenuShow() |
612 self.menuShow = self.__initContextMenuShow() |
613 self.graphicsMenu = self.__initContextMenuGraphics() |
613 self.graphicsMenu = self.__initContextMenuGraphics() |
614 self.autocompletionMenu = self.__initContextMenuAutocompletion() |
614 self.autocompletionMenu = self.__initContextMenuAutocompletion() |
|
615 self.toolsMenu = self.__initContextMenuTools() |
615 self.__menus["Checks"] = self.checksMenu |
616 self.__menus["Checks"] = self.checksMenu |
616 self.__menus["Show"] = self.menuShow |
617 self.__menus["Show"] = self.menuShow |
617 self.__menus["Graphics"] = self.graphicsMenu |
618 self.__menus["Graphics"] = self.graphicsMenu |
618 self.__menus["Autocompletion"] = self.autocompletionMenu |
619 self.__menus["Autocompletion"] = self.autocompletionMenu |
|
620 self.__menus["Tools"] = self.toolsMenu |
619 self.exportersMenu = self.__initContextMenuExporters() |
621 self.exportersMenu = self.__initContextMenuExporters() |
620 self.__menus["Exporters"] = self.exportersMenu |
622 self.__menus["Exporters"] = self.exportersMenu |
621 self.eolMenu = self.__initContextMenuEol() |
623 self.eolMenu = self.__initContextMenuEol() |
622 self.__menus["Eol"] = self.eolMenu |
624 self.__menus["Eol"] = self.eolMenu |
623 self.encodingsMenu = self.__initContextMenuEncodings() |
625 self.encodingsMenu = self.__initContextMenuEncodings() |
719 self.menu.addSeparator() |
721 self.menu.addSeparator() |
720 self.menuActs["Show"] = self.menu.addMenu(self.menuShow) |
722 self.menuActs["Show"] = self.menu.addMenu(self.menuShow) |
721 self.menu.addSeparator() |
723 self.menu.addSeparator() |
722 self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu) |
724 self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu) |
723 self.menu.addSeparator() |
725 self.menu.addSeparator() |
|
726 self.menuActs["Tools"] = self.menu.addMenu(self.toolsMenu) |
|
727 self.menu.addSeparator() |
724 self.menu.addAction( |
728 self.menu.addAction( |
725 UI.PixmapCache.getIcon("documentNewView.png"), |
729 UI.PixmapCache.getIcon("documentNewView.png"), |
726 self.trUtf8('New Document View'), self.__newView) |
730 self.trUtf8('New Document View'), self.__newView) |
727 self.menuActs["NewSplit"] = self.menu.addAction( |
731 self.menuActs["NewSplit"] = self.menu.addAction( |
728 UI.PixmapCache.getIcon("splitVertical.png"), |
732 UI.PixmapCache.getIcon("splitVertical.png"), |
795 |
799 |
796 @return reference to the generated menu (QMenu) |
800 @return reference to the generated menu (QMenu) |
797 """ |
801 """ |
798 menu = QMenu(self.trUtf8('Check')) |
802 menu = QMenu(self.trUtf8('Check')) |
799 menu.aboutToShow.connect(self.__showContextMenuChecks) |
803 menu.aboutToShow.connect(self.__showContextMenuChecks) |
|
804 return menu |
|
805 |
|
806 def __initContextMenuTools(self): |
|
807 """ |
|
808 Private method used to setup the Tools context sub menu. |
|
809 |
|
810 @return reference to the generated menu (QMenu) |
|
811 """ |
|
812 menu = QMenu(self.trUtf8('Tools')) |
|
813 menu.aboutToShow.connect(self.__showContextMenuTools) |
800 return menu |
814 return menu |
801 |
815 |
802 def __initContextMenuShow(self): |
816 def __initContextMenuShow(self): |
803 """ |
817 """ |
804 Private method used to setup the Show context sub menu. |
818 Private method used to setup the Show context sub menu. |
2952 # save to project, if a project is loaded |
2966 # save to project, if a project is loaded |
2953 if self.project.isOpen() and \ |
2967 if self.project.isOpen() and \ |
2954 self.project.startswithProjectPath(fn): |
2968 self.project.startswithProjectPath(fn): |
2955 self.project.appendFile(self.fileName) |
2969 self.project.appendFile(self.fileName) |
2956 self.addedToProject() |
2970 self.addedToProject() |
2957 self.setLanguage(self.fileName) |
2971 |
|
2972 self.setLanguage(self.fileName) |
2958 |
2973 |
2959 self.lastModified = QFileInfo(self.fileName).lastModified() |
2974 self.lastModified = QFileInfo(self.fileName).lastModified() |
2960 if newName is not None: |
2975 if newName is not None: |
2961 self.vm.addToRecentList(newName) |
2976 self.vm.addToRecentList(newName) |
2962 self.editorSaved.emit(self.fileName) |
2977 self.editorSaved.emit(self.fileName) |
4643 UI.PixmapCache.getIcon("splitHorizontal.png")) |
4658 UI.PixmapCache.getIcon("splitHorizontal.png")) |
4644 else: |
4659 else: |
4645 self.menuActs["NewSplit"].setIcon( |
4660 self.menuActs["NewSplit"].setIcon( |
4646 UI.PixmapCache.getIcon("splitVertical.png")) |
4661 UI.PixmapCache.getIcon("splitVertical.png")) |
4647 |
4662 |
|
4663 self.menuActs["Tools"].setEnabled(not self.toolsMenu.isEmpty()) |
|
4664 |
4648 self.showMenu.emit("Main", self.menu, self) |
4665 self.showMenu.emit("Main", self.menu, self) |
4649 |
4666 |
4650 def __showContextMenuAutocompletion(self): |
4667 def __showContextMenuAutocompletion(self): |
4651 """ |
4668 """ |
4652 Private slot called before the autocompletion menu is shown. |
4669 Private slot called before the autocompletion menu is shown. |
4825 Private slot handling the aboutToShow signal of the checks context |
4842 Private slot handling the aboutToShow signal of the checks context |
4826 menu. |
4843 menu. |
4827 """ |
4844 """ |
4828 self.showMenu.emit("Checks", self.checksMenu, self) |
4845 self.showMenu.emit("Checks", self.checksMenu, self) |
4829 |
4846 |
|
4847 def __showContextMenuTools(self): |
|
4848 """ |
|
4849 Private slot handling the aboutToShow signal of the tools context |
|
4850 menu. |
|
4851 """ |
|
4852 self.showMenu.emit("Tools", self.toolsMenu, self) |
|
4853 |
4830 def __contextSave(self): |
4854 def __contextSave(self): |
4831 """ |
4855 """ |
4832 Private slot handling the save context menu entry. |
4856 Private slot handling the save context menu entry. |
4833 """ |
4857 """ |
4834 ok = self.saveFile() |
4858 ok = self.saveFile() |
5333 """ |
5357 """ |
5334 for handle in list(self.syntaxerrors.keys()): |
5358 for handle in list(self.syntaxerrors.keys()): |
5335 line = self.markerLine(handle) + 1 |
5359 line = self.markerLine(handle) + 1 |
5336 self.toggleSyntaxError(line, 0, False) |
5360 self.toggleSyntaxError(line, 0, False) |
5337 |
5361 |
|
5362 self.syntaxerrors = {} |
|
5363 self.syntaxerrorToggled.emit(self) |
|
5364 |
5338 def __showSyntaxError(self, line=-1): |
5365 def __showSyntaxError(self, line=-1): |
5339 """ |
5366 """ |
5340 Private slot to handle the 'Show syntax error message' |
5367 Private slot to handle the 'Show syntax error message' |
5341 context menu action. |
5368 context menu action. |
5342 |
5369 |