147 |
147 |
148 if not menu.isEmpty(): |
148 if not menu.isEmpty(): |
149 menu.addSeparator() |
149 menu.addSeparator() |
150 |
150 |
151 act = menu.addMenu(self.__menu) |
151 act = menu.addMenu(self.__menu) |
152 act.setEnabled(editor is not None and editor.hasSelectedText()) |
152 act.setEnabled(editor is not None and editor.selectedText() != '') |
153 |
153 |
154 def __editorOpened(self, editor): |
154 def __editorOpened(self, editor): |
155 """ |
155 """ |
156 Private slot called, when a new editor was opened. |
156 Private slot called, when a new editor was opened. |
157 |
157 |
186 @param menuName name of the menu to be shown (string) |
186 @param menuName name of the menu to be shown (string) |
187 @param menu reference to the menu (QMenu) |
187 @param menu reference to the menu (QMenu) |
188 @param editor reference to the editor |
188 @param editor reference to the editor |
189 """ |
189 """ |
190 if menuName == "Tools": |
190 if menuName == "Tools": |
191 self.__menu.setEnabled(editor.hasSelectedText()) |
191 self.__menu.setEnabled(editor.selectedText() != '') |
192 |
192 |
193 def __applyChange(self, newText, editor): |
193 def __applyChange(self, newText, editor): |
194 """ |
194 """ |
195 Private method to change the selected text. |
195 Private method to change the selected text. |
196 |
196 |