719 self.menu.addSeparator() |
719 self.menu.addSeparator() |
720 self.menuActs["Show"] = self.menu.addMenu(self.menuShow) |
720 self.menuActs["Show"] = self.menu.addMenu(self.menuShow) |
721 self.menu.addSeparator() |
721 self.menu.addSeparator() |
722 self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu) |
722 self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu) |
723 self.menu.addSeparator() |
723 self.menu.addSeparator() |
724 self.menu.addAction(self.trUtf8('New view'), self.__newView) |
724 self.menu.addAction( |
725 act = self.menu.addAction( |
725 UI.PixmapCache.getIcon("documentNewView.png"), |
726 self.trUtf8('New view (with new split)'), self.__newViewNewSplit) |
726 self.trUtf8('New Document View'), self.__newView) |
727 if not self.vm.canSplit(): |
727 self.menuActs["NewSplit"] = self.menu.addAction( |
728 act.setEnabled(False) |
728 UI.PixmapCache.getIcon("splitVertical.png"), |
|
729 self.trUtf8('New Document View (with new split)'), |
|
730 self.__newViewNewSplit) |
|
731 self.menuActs["NewSplit"].setEnabled(self.vm.canSplit()) |
729 self.menu.addAction( |
732 self.menu.addAction( |
730 UI.PixmapCache.getIcon("close.png"), |
733 UI.PixmapCache.getIcon("close.png"), |
731 self.trUtf8('Close'), self.__contextClose) |
734 self.trUtf8('Close'), self.__contextClose) |
732 self.menu.addSeparator() |
735 self.menu.addSeparator() |
733 self.menuActs["Save"] = self.menu.addAction( |
736 self.menuActs["Save"] = self.menu.addAction( |
3067 def handleMonospacedEnable(self): |
3070 def handleMonospacedEnable(self): |
3068 """ |
3071 """ |
3069 Private slot to handle the Use Monospaced Font context menu entry. |
3072 Private slot to handle the Use Monospaced Font context menu entry. |
3070 """ |
3073 """ |
3071 if self.menuActs["MonospacedFont"].isChecked(): |
3074 if self.menuActs["MonospacedFont"].isChecked(): |
3072 self.setMonospaced(True) |
3075 if not self.lexer_: |
|
3076 self.setMonospaced(True) |
3073 else: |
3077 else: |
3074 if self.lexer_: |
3078 if self.lexer_: |
3075 self.lexer_.readSettings( |
3079 self.lexer_.readSettings( |
3076 Preferences.Prefs.settings, "Scintilla") |
3080 Preferences.Prefs.settings, "Scintilla") |
3077 self.lexer_.initProperties() |
3081 self.lexer_.initProperties() |
4628 if self.fileName: |
4632 if self.fileName: |
4629 rej = "{0}.rej".format(self.fileName) |
4633 rej = "{0}.rej".format(self.fileName) |
4630 self.menuActs["OpenRejections"].setEnabled(os.path.exists(rej)) |
4634 self.menuActs["OpenRejections"].setEnabled(os.path.exists(rej)) |
4631 else: |
4635 else: |
4632 self.menuActs["OpenRejections"].setEnabled(False) |
4636 self.menuActs["OpenRejections"].setEnabled(False) |
|
4637 |
|
4638 self.menuActs["MonospacedFont"].setEnabled(self.lexer_ is None) |
|
4639 |
|
4640 splitOrientation = self.vm.getSplitOrientation() |
|
4641 if splitOrientation == Qt.Horizontal: |
|
4642 self.menuActs["NewSplit"].setIcon( |
|
4643 UI.PixmapCache.getIcon("splitHorizontal.png")) |
|
4644 else: |
|
4645 self.menuActs["NewSplit"].setIcon( |
|
4646 UI.PixmapCache.getIcon("splitVertical.png")) |
4633 |
4647 |
4634 self.showMenu.emit("Main", self.menu, self) |
4648 self.showMenu.emit("Main", self.menu, self) |
4635 |
4649 |
4636 def __showContextMenuAutocompletion(self): |
4650 def __showContextMenuAutocompletion(self): |
4637 """ |
4651 """ |
6106 Public method to set/reset a monospaced font. |
6120 Public method to set/reset a monospaced font. |
6107 |
6121 |
6108 @param on flag to indicate usage of a monospace font (boolean) |
6122 @param on flag to indicate usage of a monospace font (boolean) |
6109 """ |
6123 """ |
6110 if on: |
6124 if on: |
6111 f = Preferences.getEditorOtherFonts("MonospacedFont") |
6125 if not self.lexer_: |
6112 self.monospacedStyles(f) |
6126 f = Preferences.getEditorOtherFonts("MonospacedFont") |
|
6127 self.monospacedStyles(f) |
6113 else: |
6128 else: |
6114 if not self.lexer_: |
6129 if not self.lexer_: |
6115 self.clearStyles() |
6130 self.clearStyles() |
6116 self.__setMarginsDisplay() |
6131 self.__setMarginsDisplay() |
6117 self.setFont(Preferences.getEditorOtherFonts("DefaultFont")) |
6132 self.setFont(Preferences.getEditorOtherFonts("DefaultFont")) |
6118 |
6133 |
6119 self.useMonospaced = on |
6134 self.useMonospaced = on |
|
6135 |
|
6136 def clearStyles(self): |
|
6137 """ |
|
6138 Public method to set the styles according the selected Qt style |
|
6139 or the selected editor colours. |
|
6140 """ |
|
6141 super(Editor, self).clearStyles() |
|
6142 if Preferences.getEditor("OverrideEditAreaColours"): |
|
6143 self.setColor(Preferences.getEditorColour("EditAreaForeground")) |
|
6144 self.setPaper(Preferences.getEditorColour("EditAreaBackground")) |
6120 |
6145 |
6121 ################################################################# |
6146 ################################################################# |
6122 ## Drag and Drop Support |
6147 ## Drag and Drop Support |
6123 ################################################################# |
6148 ################################################################# |
6124 |
6149 |