21 # Start-Of-Header |
21 # Start-Of-Header |
22 name = "Print Remover Plug-in" |
22 name = "Print Remover Plug-in" |
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
24 autoactivate = True |
24 autoactivate = True |
25 deactivateable = True |
25 deactivateable = True |
26 version = "0.3.0" |
26 version = "0.4.0" |
27 className = "PrintRemoverPlugin" |
27 className = "PrintRemoverPlugin" |
28 packageName = "PrintRemover" |
28 packageName = "PrintRemover" |
29 shortDescription = "Remove print() like debug statements." |
29 shortDescription = "Remove print() like debug statements." |
30 longDescription = \ |
30 longDescription = \ |
31 """This plug-in implements a tool to remove lines starting with""" \ |
31 """This plug-in implements a tool to remove lines starting with""" \ |
202 """ |
202 """ |
203 if name != "Tools": |
203 if name != "Tools": |
204 return |
204 return |
205 |
205 |
206 editor = e5App().getObject("ViewManager").activeWindow() |
206 editor = e5App().getObject("ViewManager").activeWindow() |
207 if editor is None: |
|
208 return |
|
209 |
207 |
210 if not menu.isEmpty(): |
208 if not menu.isEmpty(): |
211 menu.addSeparator() |
209 menu.addSeparator() |
212 |
210 |
213 for string in self.getPreferences("StartswithStrings"): |
211 for string in self.getPreferences("StartswithStrings"): |
214 act = menu.addAction( |
212 act = menu.addAction( |
215 self.tr("Remove '{0}'").format(string), |
213 self.tr("Remove '{0}'").format(string), |
216 self.__removeLine) |
214 self.__removeLine) |
217 act.setData(string) |
215 act.setData(string) |
|
216 act.setEnabled(editor is not None) |
218 |
217 |
219 def __editorOpened(self, editor): |
218 def __editorOpened(self, editor): |
220 """ |
219 """ |
221 Private slot called, when a new editor was opened. |
220 Private slot called, when a new editor was opened. |
222 |
221 |