PluginRefactoringRope.py

changeset 354
a967ff16629a
parent 351
3b569862cd46
child 356
c7fcb0cb0247
equal deleted inserted replaced
353:d38295fd97c2 354:a967ff16629a
6 """ 6 """
7 Module implementing the Rope refactoring plugin. 7 Module implementing the Rope refactoring plugin.
8 """ 8 """
9 9
10 import os 10 import os
11 import contextlib
11 12
12 from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication 13 from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication
13 14
14 from E5Gui.E5Application import e5App 15 from E5Gui.E5Application import e5App
15 16
19 # Start-Of-Header 20 # Start-Of-Header
20 name = "Refactoring Rope Plugin" 21 name = "Refactoring Rope Plugin"
21 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 22 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
22 autoactivate = True 23 autoactivate = True
23 deactivateable = True 24 deactivateable = True
24 version = "7.3.2" 25 version = "7.4.0"
25 className = "RefactoringRopePlugin" 26 className = "RefactoringRopePlugin"
26 packageName = "RefactoringRope" 27 packageName = "RefactoringRope"
27 internalPackages = "rope" 28 internalPackages = "rope"
28 shortDescription = "Refactoring using the Rope library." 29 shortDescription = "Refactoring using the Rope library."
29 longDescription = ( 30 longDescription = (
99 except AttributeError: 100 except AttributeError:
100 from PyQt5.QtGui import QPalette 101 from PyQt5.QtGui import QPalette
101 palette = e5App().palette() 102 palette = e5App().palette()
102 lightness = palette.color(QPalette.Window).lightness() 103 lightness = palette.color(QPalette.Window).lightness()
103 usesDarkPalette = lightness <= 128 104 usesDarkPalette = lightness <= 128
104 if usesDarkPalette: 105 iconSuffix = "dark" if usesDarkPalette else "light"
105 iconSuffix = "dark"
106 else:
107 iconSuffix = "light"
108 106
109 data = { 107 data = {
110 "ropeAutoCompletionPage": [ 108 "ropeAutoCompletionPage": [
111 QCoreApplication.translate("RefactoringRopePlugin", "Rope"), 109 QCoreApplication.translate("RefactoringRopePlugin", "Rope"),
112 os.path.join("RefactoringRope", "ConfigurationPage", 110 os.path.join("RefactoringRope", "ConfigurationPage",
364 Private method to disconnect an editor. 362 Private method to disconnect an editor.
365 363
366 @param editor reference to the editor 364 @param editor reference to the editor
367 @type QScintilla.Editor.Editor 365 @type QScintilla.Editor.Editor
368 """ 366 """
369 try: 367 with contextlib.suppress(TypeError):
370 editor.editorAboutToBeSaved.disconnect(self.__editorAboutToBeSaved) 368 editor.editorAboutToBeSaved.disconnect(self.__editorAboutToBeSaved)
371 editor.editorSaved.disconnect(self.__editorSaved) 369 editor.editorSaved.disconnect(self.__editorSaved)
372 except TypeError:
373 # just ignore it
374 pass
375 370
376 self.__unsetAutoCompletionHook(editor) 371 self.__unsetAutoCompletionHook(editor)
377 self.__unsetCalltipsHook(editor) 372 self.__unsetCalltipsHook(editor)
378 373
379 self.__disconnectMouseClickHandler(editor) 374 self.__disconnectMouseClickHandler(editor)

eric ide

mercurial