RefactoringRope/ConfigurationPage/AutoCompletionRopePage.py

Mon, 17 Oct 2022 16:45:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 17 Oct 2022 16:45:23 +0200
branch
eric7
changeset 394
b34f5dd3db27
parent 389
4f53795beff0
child 396
933b8fcd854f
permissions
-rw-r--r--

Enhanced the default configuration handling (for refactoring and code assist).

100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
374
958f34e97952 Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 365
diff changeset
3 # Copyright (c) 2008 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Rope Autocompletion configuration page.
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
365
f740b50380df Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 347
diff changeset
10 from PyQt6.QtCore import pyqtSlot
212
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
11
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
12 from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_AutoCompletionRopePage import Ui_AutoCompletionRopePage
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 class AutoCompletionRopePage(ConfigurationPageBase, Ui_AutoCompletionRopePage):
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Class implementing the Rope Autocompletion configuration page.
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
20
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, plugin):
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
24
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param plugin reference to the plugin object
205
55bba6be2cbc Corrected some source documentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 191
diff changeset
26 @type RefactoringRopePlugin
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 ConfigurationPageBase.__init__(self)
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self.setupUi(self)
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setObjectName("AutoCompletionRopePage")
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
31
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.__plugin = plugin
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
33
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 # set initial values
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.ropeAutocompletionCheckBox.setChecked(
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
36 self.__plugin.getPreferences("CodeAssistEnabled")
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
37 )
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
38 self.acMaxfixesSpinBox.setValue(self.__plugin.getPreferences("MaxFixes"))
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
39
100
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 def save(self):
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 Public slot to save the Rope Autocompletion configuration.
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
2bfe9e3fad8d Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__plugin.setPreferences(
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
45 "CodeAssistEnabled", self.ropeAutocompletionCheckBox.isChecked()
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
46 )
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
47 self.__plugin.setPreferences("MaxFixes", self.acMaxfixesSpinBox.value())
212
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
48
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
49 def polishPage(self):
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
50 """
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
51 Public slot to perform some polishing actions.
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
52 """
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
53 names = self.__plugin.getCodeAssistServer().connectionNames()
394
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
54 self.createPython3Button.setEnabled("Python3" in names)
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
55 self.editPython3Button.setEnabled("Python3" in names)
389
4f53795beff0 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 374
diff changeset
56
212
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
57 @pyqtSlot()
394
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
58 def on_editPython3Button_clicked(self):
212
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
59 """
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
60 Private slot to edit the rope configuration for Python 3.
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
61 """
f05681349336 Changed code assist to use the new async interface of the Editor class, if it available and performed some code refactorings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
62 self.__plugin.getCodeAssistServer().editConfig("Python3")
394
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
63
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
64 @pyqtSlot()
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
65 def on_createPython3Button_clicked(self):
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
66 """
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
67 Private slot to create a new default rope configuration for Python 3.
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
68 """
b34f5dd3db27 Enhanced the default configuration handling (for refactoring and code assist).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 389
diff changeset
69 self.__plugin.getCodeAssistServer().createConfig("Python3")

eric ide

mercurial