Wed, 27 Sep 2017 19:50:44 +0200
Started correcting the source code documentation.
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
2 | |
147
3f8a995f6e49
Updated copyright for 2017.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
145
diff
changeset
|
3 | # Copyright (c) 2010 - 2017 Detlev Offenbach <detlev@die-offenbachs.de> |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
4 | # |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
5 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
6 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
7 | Module implementing the Rope refactoring plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
8 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
9 | |
76 | 10 | from __future__ import unicode_literals |
50
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
11 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
12 | import os |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
13 | |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
14 | from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
15 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
16 | from E5Gui.E5Application import e5App |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
17 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
18 | import Preferences |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
19 | import Utilities |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
20 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
21 | # Start-Of-Header |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
22 | name = "Refactoring Rope Plugin" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
23 | author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
24 | autoactivate = True |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
25 | deactivateable = True |
160
989cd767992b
Started implementing the client/server variant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
156
diff
changeset
|
26 | version = "5.0.0" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
27 | className = "RefactoringRopePlugin" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
28 | packageName = "RefactoringRope" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
29 | internalPackages = "rope" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
30 | shortDescription = "Refactoring using the Rope library." |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
31 | longDescription = """This plug-in implements refactoring functionality""" \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
32 | """ using the Rope refactoring library. Additonally it implements an """ \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
33 | """ alternative auto-completion and calltips provider. Only""" \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
34 | """ refactoring, completions and calltips in the same Python variant""" \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
35 | """ as Eric is running is allowed.""" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
36 | pyqtApi = 2 |
52
abd297a94a55
Added the 'doNotCompile' plug-in module header entry to avoid attempting to compile the sources, which will raise errors due to the rope variants for both Python versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
51
diff
changeset
|
37 | doNotCompile = True |
76 | 38 | python2Compatible = True |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
39 | # End-Of-Header |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
40 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
41 | error = "" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
42 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
43 | refactoringRopePluginObject = None |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
44 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
45 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
46 | def createAutoCompletionPage(configDlg): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
47 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
48 | Module function to create the 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:
99
diff
changeset
|
49 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
50 | @param configDlg reference to the configuration dialog |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
51 | @return reference to the 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:
99
diff
changeset
|
52 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
53 | global refactoringRopePluginObject |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
54 | from RefactoringRope.ConfigurationPage.AutoCompletionRopePage \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
55 | import AutoCompletionRopePage |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
56 | page = AutoCompletionRopePage(refactoringRopePluginObject) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
57 | return page |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
58 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
59 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
60 | def createCallTipsPage(configDlg): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
61 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
62 | Module function to create the calltips 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:
99
diff
changeset
|
63 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
64 | @param configDlg reference to the configuration dialog |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
65 | @return reference to the 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:
99
diff
changeset
|
66 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
67 | global refactoringRopePluginObject |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
68 | from RefactoringRope.ConfigurationPage.CallTipsRopePage \ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
69 | import CallTipsRopePage |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
70 | page = CallTipsRopePage(refactoringRopePluginObject) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
71 | return page |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
72 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
73 | |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
74 | def createMouseClickHandlerPage(configDlg): |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
75 | """ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
76 | Module function to create the mouse click handler configuration page. |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
77 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
78 | @param configDlg reference to the configuration dialog |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
79 | @return reference to the configuration page |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
80 | """ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
81 | global refactoringRopePluginObject |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
82 | from RefactoringRope.ConfigurationPage.MouseClickHandlerRopePage \ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
83 | import MouseClickHandlerRopePage |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
84 | page = MouseClickHandlerRopePage(refactoringRopePluginObject) |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
85 | return page |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
86 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
87 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
88 | def getConfigData(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
89 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
90 | Module function returning data as required by the configuration dialog. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
91 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
92 | @return dictionary containing the relevant data |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
93 | @rtype dict |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
94 | """ |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
95 | data = { |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
96 | "ropeAutoCompletionPage": [ |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
97 | QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
98 | os.path.join("RefactoringRope", "ConfigurationPage", |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
99 | "preferences-refactoring.png"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
100 | createAutoCompletionPage, "editorAutocompletionPage", None], |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
101 | "ropeCallTipsPage": [ |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
102 | QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
103 | os.path.join("RefactoringRope", "ConfigurationPage", |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
104 | "preferences-refactoring.png"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
105 | createCallTipsPage, "editorCalltipsPage", None], |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
106 | "ropeMouseClickHandlerPage": [ |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
107 | QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
108 | os.path.join("RefactoringRope", "ConfigurationPage", |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
109 | "preferences-refactoring.png"), |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
110 | createMouseClickHandlerPage, "1editorMouseClickHandlers", None], |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
111 | } |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
112 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
113 | return data |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
114 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
115 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
116 | def prepareUninstall(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
117 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
118 | Module function to prepare for an uninstallation. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
119 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
120 | Preferences.Prefs.settings.remove(RefactoringRopePlugin.PreferencesKey) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
121 | |
20
83b71483e198
Made the code PEP-8 compliant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
122 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
123 | class RefactoringRopePlugin(QObject): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
124 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
125 | Class implementing the Rope refactoring plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
126 | """ |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
127 | PreferencesKey = "RefactoringRope" |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
128 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
129 | def __init__(self, ui): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
130 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
131 | Constructor |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
132 | |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
133 | @param ui reference to the user interface object |
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
134 | @type UI.UserInterface |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
135 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
136 | QObject.__init__(self, ui) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
137 | self.__ui = ui |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
138 | self.__initialize() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
139 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
140 | self.__defaults = { |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
141 | "CodeAssistEnabled": False, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
142 | "MaxFixes": 10, |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
143 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
144 | "CodeAssistCalltipsEnabled": False, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
145 | "CalltipsMaxFixes": 10, |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
146 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
147 | "MouseClickEnabled": True, |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
148 | "MouseClickGotoModifiers": int(Qt.ControlModifier), |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
149 | "MouseClickGotoButton": int(Qt.LeftButton), |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
150 | } |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
151 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
152 | self.__translator = None |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
153 | self.__loadTranslator() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
154 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
155 | def __initialize(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
156 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
157 | Private slot to (re)initialize the plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
158 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
159 | self.__refactoringServer = None |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
160 | self.__codeAssistServer = None |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
161 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
162 | self.__editors = [] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
163 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
164 | self.__currentEditor = None |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
165 | self.__savedEditorName = None |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
166 | self.__oldEditorText = "" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
167 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
168 | def activate(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
169 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
170 | Public method to activate this plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
171 | |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
172 | @return tuple of None and activation status |
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
173 | @rtype tuple of (None, bool) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
174 | """ |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
175 | global refactoringRopePluginObject |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
176 | refactoringRopePluginObject = self |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
177 | |
197
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
178 | e5App().getObject("PluginManager").shutdown.connect( |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
179 | self.__shutdown) |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
180 | |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
181 | from RefactoringRope.CodeAssistServer import CodeAssistServer |
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
182 | self.__codeAssistServer = CodeAssistServer(self, self.__ui) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
183 | |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
184 | from RefactoringRope.RefactoringServer import RefactoringServer |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
185 | self.__refactoringServer = RefactoringServer(self, self.__ui) |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
186 | self.__refactoringServer.activate() |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
187 | |
197
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
188 | e5App().getObject("PluginManager").shutdown.connect( |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
189 | self.__shutdown) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
190 | e5App().getObject("ViewManager").editorOpenedEd.connect( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
191 | self.__editorOpened) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
192 | e5App().getObject("ViewManager").editorClosedEd.connect( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
193 | self.__editorClosed) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
194 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
195 | if e5App().getObject("Project").isOpen(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
196 | for editor in e5App().getObject("ViewManager").getOpenEditors(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
197 | self.__editorOpened(editor) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
198 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
199 | return None, True |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
200 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
201 | def deactivate(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
202 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
203 | Public method to deactivate this plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
204 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
205 | self.__refactoringServer.deactivate() |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
206 | |
197
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
207 | self.__codeAssistServer.deactivate() |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
208 | |
200
1584892147ef
Implemented the distributed code assist "report changed" method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
197
diff
changeset
|
209 | e5App().getObject("PluginManager").shutdown.disconnect( |
1584892147ef
Implemented the distributed code assist "report changed" method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
197
diff
changeset
|
210 | self.__shutdown) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
211 | e5App().getObject("ViewManager").editorOpenedEd.disconnect( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
212 | self.__editorOpened) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
213 | e5App().getObject("ViewManager").editorClosedEd.disconnect( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
214 | self.__editorClosed) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
215 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
216 | for editor in self.__editors[:]: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
217 | self.__editorClosed(editor) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
218 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
219 | self.__initialize() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
220 | |
197
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
221 | def __shutdown(self): |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
222 | """ |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
223 | Private slot handling the shutdown signal of the plug-in manager. |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
224 | """ |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
225 | if self.__codeAssistServer: |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
226 | self.__codeAssistServer.deactivate() |
7046ac1bcb4b
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
195
diff
changeset
|
227 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
228 | def __loadTranslator(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
229 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
230 | Private method to load the translation file. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
231 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
232 | if self.__ui is not None: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
233 | loc = self.__ui.getLocale() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
234 | if loc and loc != "C": |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
235 | locale_dir = \ |
20
83b71483e198
Made the code PEP-8 compliant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
236 | os.path.join(os.path.dirname(__file__), |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
237 | "RefactoringRope", "i18n") |
151
5260100b6700
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
148
diff
changeset
|
238 | translation = "rope_{0}".format(loc) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
239 | translator = QTranslator(None) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
240 | loaded = translator.load(translation, locale_dir) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
241 | if loaded: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
242 | self.__translator = translator |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
243 | e5App().installTranslator(self.__translator) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
244 | else: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
245 | print("Warning: translation file '{0}' could not" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
246 | " be loaded.".format(translation)) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
247 | print("Using default.") |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
248 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
249 | def getPreferences(self, key): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
250 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
251 | Public method to retrieve the various refactoring settings. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
252 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
253 | @param key the key of the value to get |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
254 | @type str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
255 | @return the requested refactoring setting |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
256 | """ |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
257 | if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", |
153
9557ef516806
Removed the outdated check for the correct eric version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
151
diff
changeset
|
258 | "MouseClickEnabled"]: |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
259 | return Preferences.toBool(Preferences.Prefs.settings.value( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
260 | self.PreferencesKey + "/" + key, self.__defaults[key])) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
261 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
262 | return int(Preferences.Prefs.settings.value( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
263 | self.PreferencesKey + "/" + key, self.__defaults[key])) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
264 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
265 | def setPreferences(self, key, value): |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
266 | """ |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
267 | Public method to store the various refactoring settings. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
268 | |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
269 | @param key the key of the setting to be set |
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
270 | @type str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
271 | @param value the value to be set |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
272 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
273 | Preferences.Prefs.settings.setValue( |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
274 | self.PreferencesKey + "/" + key, value) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
275 | |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
276 | if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
277 | "MouseClickEnabled"]: |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
278 | if value: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
279 | if e5App().getObject("Project").isOpen(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
280 | for editor in e5App().getObject("ViewManager")\ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
281 | .getOpenEditors(): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
282 | if editor not in self.__editors: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
283 | self.__editorOpened(editor) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
284 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
285 | for editor in self.__editors[:]: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
286 | self.__editorClosed(editor) |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
287 | elif key in ["MouseClickGotoModifiers", "MouseClickGotoButton"]: |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
288 | for editor in self.__editors: |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
289 | self.__disconnectMouseClickHandler(editor) |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
290 | self.__connectMouseClickHandler(editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
291 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
292 | def __editorOpened(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
293 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
294 | Private slot called, when a new editor was opened. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
295 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
296 | @param editor reference to the new editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
297 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
298 | """ |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
299 | if self.__codeAssistServer.isSupportedLanguage(editor.getLanguage()): |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
300 | self.__connectEditor(editor) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
301 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
302 | editor.languageChanged.connect(self.__editorLanguageChanged) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
303 | self.__editors.append(editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
304 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
305 | def __editorClosed(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
306 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
307 | Private slot called, when an editor was closed. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
308 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
309 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
310 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
311 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
312 | if editor in self.__editors: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
313 | editor.languageChanged.disconnect(self.__editorLanguageChanged) |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
314 | self.__disconnectEditor(editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
315 | self.__editors.remove(editor) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
316 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
317 | def __editorLanguageChanged(self, language): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
318 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
319 | Private slot to handle the language change of an editor. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
320 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
321 | @param language programming language of the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
322 | @type str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
323 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
324 | editor = self.sender() |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
325 | |
201
e677d82706d4
Extended the auto completions pictures supported by code assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
200
diff
changeset
|
326 | if self.__codeAssistServer.isSupportedLanguage(language): |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
327 | if editor.getCompletionListHook("rope") is None or \ |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
328 | editor.getCallTipHook("rope") is None: |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
329 | self.__connectEditor(editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
330 | else: |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
331 | self.__disconnectEditor(editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
332 | |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
333 | def __connectEditor(self, editor): |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
334 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
335 | Private method to connect an editor. |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
336 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
337 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
338 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
339 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
340 | editor.editorAboutToBeSaved.connect(self.__editorAboutToBeSaved) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
341 | editor.editorSaved.connect(self.__editorSaved) |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
342 | |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
343 | if self.getPreferences("CodeAssistEnabled"): |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
344 | self.__setAutoCompletionHook(editor) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
345 | if self.getPreferences("CodeAssistCalltipsEnabled"): |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
346 | self.__setCalltipsHook(editor) |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
347 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
348 | if self.getPreferences("MouseClickEnabled"): |
140
584c697c66f4
Fix for an issue in the mouse click handler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
138
diff
changeset
|
349 | self.__disconnectMouseClickHandler(editor) |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
350 | self.__connectMouseClickHandler(editor) |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
351 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
352 | def __connectMouseClickHandler(self, editor): |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
353 | """ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
354 | Private method to connect the mouse click handler to an editor. |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
355 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
356 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
357 | @type QScintilla.Editor |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
358 | """ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
359 | if self.getPreferences("MouseClickGotoButton"): |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
360 | editor.setMouseClickHandler( |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
361 | "rope", |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
362 | self.getPreferences("MouseClickGotoModifiers"), |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
363 | self.getPreferences("MouseClickGotoButton"), |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
364 | self.__refactoringServer.gotoDefinition |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
365 | ) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
366 | |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
367 | def __disconnectEditor(self, editor): |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
368 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
369 | Private method to disconnect an editor. |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
370 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
371 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
372 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
373 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
374 | try: |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
375 | editor.editorAboutToBeSaved.disconnect(self.__editorAboutToBeSaved) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
376 | editor.editorSaved.disconnect(self.__editorSaved) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
377 | except TypeError: |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
378 | # just ignore it |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
379 | pass |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
380 | |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
381 | if editor.getCompletionListHook("rope"): |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
382 | self.__unsetAutoCompletionHook(editor) |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
383 | if editor.getCallTipHook("rope"): |
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
384 | self.__unsetCalltipsHook(editor) |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
385 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
386 | self.__disconnectMouseClickHandler(editor) |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
387 | |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
388 | def __disconnectMouseClickHandler(self, editor): |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
389 | """ |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
390 | Private method to disconnect the mouse click handler from an editor. |
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
391 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
392 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
393 | @type QScintilla.Editor |
129
23ee57a96ea3
Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
127
diff
changeset
|
394 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
395 | editor.removeMouseClickHandlers("rope") |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
396 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
397 | def __setAutoCompletionHook(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
398 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
399 | Private method to set the autocompletion hook. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
400 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
401 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
402 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
403 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
404 | editor.addCompletionListHook("rope", self.getCompletionsList) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
405 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
406 | def __unsetAutoCompletionHook(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
407 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
408 | Private method to unset the autocompletion hook. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
409 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
410 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
411 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
412 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
413 | editor.removeCompletionListHook("rope") |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
414 | |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
415 | def getCompletionsList(self, editor, context): |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
416 | """ |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
417 | Public method to get a list of possible completions. |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
418 | |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
419 | @param editor reference to the editor object, that called this method |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
420 | @type QScintilla.Editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
421 | @param context flag indicating to autocomplete a context |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
422 | @type bool |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
423 | @return list of possible completions |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
424 | @rtype list of str |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
425 | """ |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
426 | completions = self.__codeAssistServer.getCompletions(editor) |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
427 | return completions |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
428 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
429 | def __editorAboutToBeSaved(self, filename): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
430 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
431 | Private slot to get the old contents of the named file. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
432 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
433 | @param filename name of the file about to be saved |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
434 | @type str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
435 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
436 | if filename and os.path.exists(filename): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
437 | try: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
438 | self.__oldEditorText = Utilities.readEncodedFile(filename)[0] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
439 | except IOError: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
440 | self.__oldEditorText = "" |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
441 | self.__savedEditorName = filename |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
442 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
443 | self.__savedEditorName = "" |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
444 | self.__oldEditorText = "" |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
445 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
446 | def __editorSaved(self, filename): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
447 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
448 | Private slot to activate SOA. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
449 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
450 | @param filename name of the file that was saved |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
451 | @type str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
452 | """ |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
453 | if filename == self.__savedEditorName and self.__oldEditorText: |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
454 | self.__refactoringServer.reportChanged(self.__savedEditorName, |
106
b2b2107b8047
Little improvement to update the SOA database for refactoring upon saving a file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
104
diff
changeset
|
455 | self.__oldEditorText) |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
456 | self.__codeAssistServer.reportChanged(self.__savedEditorName, |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
457 | self.__oldEditorText) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
458 | else: |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
459 | self.__refactoringServer.reportChanged(filename, "") |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
460 | self.__codeAssistServer.reportChanged(filename, "") |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
461 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
462 | def __setCalltipsHook(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
463 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
464 | Private method to set the calltip hook. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
465 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
466 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
467 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
468 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
469 | editor.addCallTipHook("rope", self.codeAssistCallTip) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
470 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
471 | def __unsetCalltipsHook(self, editor): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
472 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
473 | Private method to unset the calltip hook. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
474 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
475 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
476 | @type QScintilla.Editor |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
477 | """ |
191
2af42804bca2
Did some code refactoring and removed backward compatability code for eric < 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
189
diff
changeset
|
478 | editor.removeCallTipHook("rope") |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
479 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
480 | def codeAssistCallTip(self, editor, pos, commas): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
481 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
482 | Public method to return a list of calltips. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
483 | |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
484 | @param editor reference to the editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
485 | @type QScintilla.Editor |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
486 | @param pos position in the text for the calltip |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
487 | @type int |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
488 | @param commas minimum number of commas contained in the calltip |
202
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
489 | @type int |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
490 | @return list of possible calltips |
a111134b5dc7
Started correcting the source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
201
diff
changeset
|
491 | @rtype list of str |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
492 | """ |
195
5d614a567be3
Continued implementing the distributed Code Assist.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
191
diff
changeset
|
493 | cts = self.__codeAssistServer.getCallTips(pos, editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
99
diff
changeset
|
494 | return cts |
151
5260100b6700
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
148
diff
changeset
|
495 | |
5260100b6700
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
148
diff
changeset
|
496 | # |
5260100b6700
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
148
diff
changeset
|
497 | # eflag: noqa = M801 |