Sun, 23 Aug 2015 11:59:39 +0200
Handling of unicode chars in user name handled correctly.
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 | |
94
03d6a17c66ac
Updated copyright for 2015.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
87
diff
changeset
|
3 | # Copyright (c) 2010 - 2015 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 |
50
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
13 | import sys |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
14 | |
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
|
15 | from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication, QTimer |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
16 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
17 | from E5Gui.E5Application import e5App |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
18 | |
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
|
19 | 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
|
20 | 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
|
21 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
22 | from Preferences.Shortcuts import readShortcuts |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
23 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
24 | # Start-Of-Header |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
25 | name = "Refactoring Rope Plugin" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
26 | author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
27 | autoactivate = True |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
28 | deactivateable = True |
135
50c8cfa9fc97
Handling of unicode chars in user name handled correctly.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
133
diff
changeset
|
29 | version = "4.2.2" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
30 | className = "RefactoringRopePlugin" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
31 | packageName = "RefactoringRope" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
32 | internalPackages = "rope" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
33 | 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
|
34 | 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
|
35 | """ 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
|
36 | """ 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
|
37 | """ 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
|
38 | """ as Eric is running is allowed.""" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
39 | 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
|
40 | doNotCompile = True |
76 | 41 | python2Compatible = True |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
42 | # End-Of-Header |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
43 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
44 | error = "" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
45 | |
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
|
46 | 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
|
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 | |
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 | 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
|
50 | """ |
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 | 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
|
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 | @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
|
54 | @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
|
55 | """ |
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 | 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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 | 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
|
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 | |
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 | 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
|
64 | """ |
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 | 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
|
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 | @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
|
68 | @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
|
69 | """ |
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 | 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
|
71 | 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
|
72 | 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
|
73 | 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
|
74 | 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
|
75 | |
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
|
76 | |
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
|
77 | 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
|
78 | """ |
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 | 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
|
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 | @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
|
82 | @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
|
83 | """ |
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 | 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
|
85 | 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
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | |
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
|
90 | |
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
|
91 | 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
|
92 | """ |
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
|
93 | 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
|
94 | |
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
|
95 | @return dictionary containing the relevant data |
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
|
96 | """ |
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
|
97 | data = { |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
98 | "ropeAutoCompletionPage": [ |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
99 | QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
100 | os.path.join("RefactoringRope", "ConfigurationPage", |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
101 | "preferences-refactoring.png"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
102 | createAutoCompletionPage, "editorAutocompletionPage", None], |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
103 | "ropeCallTipsPage": [ |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
104 | QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
105 | os.path.join("RefactoringRope", "ConfigurationPage", |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
106 | "preferences-refactoring.png"), |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
107 | createCallTipsPage, "editorCalltipsPage", 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
|
108 | } |
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
|
109 | |
133
6fb6ac582a39
Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
131
diff
changeset
|
110 | if e5App().getObject("UserInterface").versionIsNewer("6.0.99", "20150627"): |
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
|
111 | data["ropeMouseClickHandlerPage"] = [ |
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 | 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
|
113 | 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
|
114 | "preferences-refactoring.png"), |
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
|
115 | createMouseClickHandlerPage, "1editorMouseClickHandlers", None] |
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
|
116 | |
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
|
117 | 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
|
118 | |
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 | 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
|
121 | """ |
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
|
122 | 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
|
123 | """ |
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
|
124 | 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
|
125 | |
20
83b71483e198
Made the code PEP-8 compliant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
126 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
127 | class RefactoringRopePlugin(QObject): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
128 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
129 | Class implementing the Rope refactoring plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
130 | """ |
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
|
131 | 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
|
132 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
133 | def __init__(self, ui): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
134 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
135 | Constructor |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
136 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
137 | @param ui reference to the user interface object (UI.UserInterface) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
138 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
139 | QObject.__init__(self, ui) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
140 | self.__ui = ui |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
141 | self.__initialize() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
142 | |
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 | self.__defaults = { |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
144 | "CodeAssistEnabled": False, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
145 | "MaxFixes": 10, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
146 | "CodeAssistTimeout": 100, |
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
|
147 | "ShowQScintillaCompletions": True, |
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
|
148 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
149 | "CodeAssistCalltipsEnabled": False, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
150 | "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
|
151 | |
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
|
152 | "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
|
153 | "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
|
154 | "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
|
155 | } |
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
|
156 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
157 | self.__translator = None |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
158 | self.__loadTranslator() |
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
|
159 | |
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
|
160 | self.__acTimer = QTimer(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
|
161 | self.__acTimer.setSingleShot(True) |
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.__acTimer.setInterval(self.getPreferences("CodeAssistTimeout")) |
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 | self.__acTimer.timeout.connect(self.__codeAssist) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
164 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
165 | def __initialize(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
166 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
167 | Private slot to (re)initialize the plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
168 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
169 | self.__object = None |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
170 | self.__caObject = None |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
171 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
172 | self.__mainAct = None |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
173 | self.__mainMenu = None |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
174 | self.__projectIsOpen = False |
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 | |
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 | 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
|
177 | |
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
|
178 | 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
|
179 | 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
|
180 | self.__oldEditorText = "" |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
181 | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
182 | def __checkUiVersion(self): |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
183 | """ |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
184 | Private method to check, if the IDE has a suitable version. |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
185 | |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
186 | @return flag indicating a suitable version (boolean) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
187 | """ |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
188 | global error |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
189 | |
87
1fbf5fdbe721
Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
83
diff
changeset
|
190 | suitable = self.__ui.versionIsNewer("5.99.99", "20140701") |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
191 | if not suitable: |
87
1fbf5fdbe721
Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
83
diff
changeset
|
192 | error = self.tr("Your version of eric6 is not supported.") |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
193 | return suitable |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
194 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
195 | def activate(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
196 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
197 | Public method to activate this plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
198 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
199 | @return tuple of None and activation status (boolean) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
200 | """ |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
201 | global error |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
202 | error = "" # clear previous error |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
203 | |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
204 | if not self.__checkUiVersion(): |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
205 | return None, False |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
206 | |
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
|
207 | 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
|
208 | 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
|
209 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
210 | from RefactoringRope.Refactoring import Refactoring |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
211 | from RefactoringRope.CodeAssist import CodeAssist |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
212 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
213 | self.__caObject = CodeAssist(self, self) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
214 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
215 | self.__object = Refactoring(self, self.__ui) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
216 | self.__object.initActions() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
217 | e5App().registerPluginObject("RefactoringRope", self.__object) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
218 | try: |
20
83b71483e198
Made the code PEP-8 compliant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
219 | readShortcuts(pluginName="RefactoringRope") |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
220 | except TypeError: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
221 | # backwards comaytibility, ignore |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
222 | pass |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
223 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
224 | self.__mainMenu = self.__object.initMenu() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
225 | extrasAct = self.__ui.getMenuBarAction("extras") |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
226 | self.__mainAct = self.__ui.menuBar().insertMenu( |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
227 | extrasAct, self.__mainMenu) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
228 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
229 | if e5App().getObject("Project").isOpen(): |
76 | 230 | self.__projectOpened() |
231 | ||
232 | if self.__projectIsOpen: | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
233 | self.__object.projectOpened() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
234 | |
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
|
235 | 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
|
236 | 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
|
237 | 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
|
238 | 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
|
239 | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
240 | e5App().getObject("Project").projectOpened.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
241 | self.__object.projectOpened) |
76 | 242 | e5App().getObject("Project").projectPropertiesChanged.connect( |
243 | self.__object.projectOpened) | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
244 | e5App().getObject("Project").projectClosed.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
245 | self.__object.projectClosed) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
246 | e5App().getObject("Project").newProject.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
247 | self.__object.projectOpened) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
248 | |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
249 | e5App().getObject("Project").projectOpened.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
250 | self.__projectOpened) |
76 | 251 | e5App().getObject("Project").projectPropertiesChanged.connect( |
252 | self.__projectOpened) | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
253 | e5App().getObject("Project").projectClosed.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
254 | self.__projectClosed) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
255 | e5App().getObject("Project").newProject.connect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
256 | self.__projectOpened) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
257 | |
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
|
258 | 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
|
259 | 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
|
260 | 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
|
261 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
262 | return None, True |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
263 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
264 | def deactivate(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
265 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
266 | Public method to deactivate this plugin. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
267 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
268 | e5App().unregisterPluginObject("RefactoringRope") |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
269 | |
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
|
270 | 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
|
271 | 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
|
272 | 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
|
273 | 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
|
274 | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
275 | e5App().getObject("Project").projectOpened.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
276 | self.__object.projectOpened) |
76 | 277 | e5App().getObject("Project").projectPropertiesChanged.disconnect( |
278 | self.__object.projectOpened) | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
279 | e5App().getObject("Project").projectClosed.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
280 | self.__object.projectClosed) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
281 | e5App().getObject("Project").newProject.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
282 | self.__object.projectOpened) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
283 | |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
284 | e5App().getObject("Project").projectOpened.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
285 | self.__projectOpened) |
76 | 286 | e5App().getObject("Project").projectPropertiesChanged.disconnect( |
287 | self.__projectOpened) | |
31
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
288 | e5App().getObject("Project").projectClosed.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
289 | self.__projectClosed) |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
290 | e5App().getObject("Project").newProject.disconnect( |
0389d4a924cc
Dropped support for eric 5.0.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
291 | self.__projectOpened) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
292 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
293 | self.__ui.menuBar().removeAction(self.__mainAct) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
294 | |
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
|
295 | 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
|
296 | 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
|
297 | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
298 | self.__initialize() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
299 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
300 | def __loadTranslator(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
301 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
302 | Private method to load the translation file. |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
303 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
304 | if self.__ui is not None: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
305 | loc = self.__ui.getLocale() |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
306 | if loc and loc != "C": |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
307 | locale_dir = \ |
20
83b71483e198
Made the code PEP-8 compliant.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
308 | os.path.join(os.path.dirname(__file__), |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
309 | "RefactoringRope", "i18n") |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
310 | translation = "rope_%s" % loc |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
311 | translator = QTranslator(None) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
312 | loaded = translator.load(translation, locale_dir) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
313 | if loaded: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
314 | self.__translator = translator |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
315 | e5App().installTranslator(self.__translator) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
316 | else: |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
317 | print("Warning: translation file '{0}' could not" |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
318 | " be loaded.".format(translation)) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
319 | print("Using default.") |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
320 | |
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
|
321 | 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
|
322 | """ |
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 | 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
|
324 | |
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 | @param key the key of the value to get |
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
|
326 | @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
|
327 | """ |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
328 | if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", |
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
|
329 | "ShowQScintillaCompletions", "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
|
330 | 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
|
331 | 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
|
332 | 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
|
333 | 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
|
334 | 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
|
335 | |
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 | def setPreferences(self, key, value): |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
337 | """ |
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
|
338 | 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
|
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 | @param key the key of the setting to be set (string) |
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 | @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
|
342 | """ |
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
|
343 | 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
|
344 | 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
|
345 | |
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
|
346 | 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
|
347 | "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
|
348 | 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
|
349 | 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
|
350 | 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
|
351 | .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
|
352 | 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
|
353 | 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
|
354 | 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
|
355 | 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
|
356 | 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
|
357 | 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
|
358 | 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
|
359 | 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
|
360 | 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
|
361 | elif key == "CodeAssistTimeout": |
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
|
362 | self.__acTimer.setInterval(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
|
363 | |
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
|
364 | def __determineLanguage(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
|
365 | """ |
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 | Private method to determine the valid language strings. |
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
|
367 | |
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 | @return list of valid language strings (list of string) |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
369 | """ |
50
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
370 | if sys.version_info[0] == 3: |
114
b176e34cd6bd
Fixed a few bugs related to changing an editor's language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
112
diff
changeset
|
371 | lang = ["Python3", "Pygments|Python 3"] |
50
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
372 | elif sys.version_info[0] == 2: |
114
b176e34cd6bd
Fixed a few bugs related to changing an editor's language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
112
diff
changeset
|
373 | lang = ["Python", "Python2", "Pygments|Python"] |
50
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
374 | else: |
a29c3d2e6dc0
rope for Python2 projects enabled, if running on Python2
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
48
diff
changeset
|
375 | lang = [] |
76 | 376 | |
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
|
377 | return lang |
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
|
378 | |
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
|
379 | def __projectOpened(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
|
380 | """ |
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
|
381 | Private slot to handle the projectOpened signal. |
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
|
382 | """ |
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
|
383 | lang = self.__determineLanguage() |
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
|
384 | |
76 | 385 | enabled = e5App().getObject("Project").getProjectLanguage() in lang |
386 | self.__mainAct.setEnabled(enabled) | |
387 | self.__projectIsOpen = enabled | |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
388 | |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
389 | def __projectClosed(self): |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
390 | """ |
87
1fbf5fdbe721
Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
83
diff
changeset
|
391 | Private slot to handle the projectClosed signal. |
1
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
392 | """ |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
393 | self.__mainAct.setEnabled(False) |
9f687137a929
Started implementing the basic functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
394 | self.__projectIsOpen = False |
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
|
395 | |
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 | 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
|
397 | """ |
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 | 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
|
399 | |
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 | @param editor reference to the new editor (QScintilla.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
|
401 | """ |
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
|
402 | lang = self.__determineLanguage() |
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 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
404 | if editor.getLanguage() in lang: |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
405 | 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
|
406 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
407 | 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
|
408 | 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
|
409 | |
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
|
410 | 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
|
411 | """ |
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 | 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
|
413 | |
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 | @param editor reference to the editor (QScintilla.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
|
415 | """ |
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
|
416 | 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
|
417 | editor.languageChanged.disconnect(self.__editorLanguageChanged) |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
418 | 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
|
419 | 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
|
420 | |
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
|
421 | 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
|
422 | """ |
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
|
423 | 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
|
424 | |
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
|
425 | @param language programming language of the editor (string) |
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
|
426 | """ |
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
|
427 | 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
|
428 | lang = self.__determineLanguage() |
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 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
430 | if language in lang: |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
431 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
432 | if editor.getCompletionListHook("rope") is None or \ |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
433 | editor.getCallTipHook("rope") is None: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
434 | self.__connectEditor(editor) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
435 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
436 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
437 | if editor.autoCompletionHook() != self.codeAssist or \ |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
438 | editor.callTipHook() != self.codeAssistCallTip: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
439 | 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
|
440 | else: |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
441 | 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
|
442 | |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
443 | 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
|
444 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
445 | 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
|
446 | |
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 | @param editor reference to the editor (QScintilla.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
|
448 | """ |
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 | 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
|
450 | editor.editorSaved.connect(self.__editorSaved) |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
451 | |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
452 | if self.getPreferences("CodeAssistEnabled"): |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
453 | self.__setAutoCompletionHook(editor) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
454 | if self.getPreferences("CodeAssistCalltipsEnabled"): |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
455 | 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
|
456 | |
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
|
457 | if self.getPreferences("MouseClickEnabled"): |
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
|
458 | 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
|
459 | |
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
|
460 | 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
|
461 | """ |
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
|
462 | 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
|
463 | |
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
|
464 | @param editor reference to the editor (QScintilla.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
|
465 | """ |
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
|
466 | if self.getPreferences("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
|
467 | try: |
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
|
468 | editor.setMouseClickHandler( |
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
|
469 | "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
|
470 | self.getPreferences("MouseClickGotoModifiers"), |
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
|
471 | self.getPreferences("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
|
472 | self.__object.gotoDefinition |
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
|
473 | ) |
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
|
474 | except AttributeError: |
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
|
475 | # eric versions before 6.1.0 don't support this |
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
|
476 | pass |
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 | |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
478 | 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
|
479 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
480 | 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
|
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 | @param editor reference to the editor (QScintilla.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
|
483 | """ |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
484 | try: |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
485 | editor.editorAboutToBeSaved.disconnect(self.__editorAboutToBeSaved) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
486 | editor.editorSaved.disconnect(self.__editorSaved) |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
487 | except TypeError: |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
488 | # just ignore it |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
489 | pass |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
490 | |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
491 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
492 | if editor.getCompletionListHook("rope"): |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
493 | self.__unsetAutoCompletionHook(editor) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
494 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
495 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
496 | if editor.autoCompletionHook() == self.codeAssist: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
497 | self.__unsetAutoCompletionHook(editor) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
498 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
499 | if editor.getCallTipHook("rope"): |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
500 | self.__unsetCalltipsHook(editor) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
501 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
502 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
503 | if editor.callTipHook() == self.codeAssistCallTip: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
504 | 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
|
505 | |
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
|
506 | 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
|
507 | |
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
|
508 | 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
|
509 | """ |
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
|
510 | 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
|
511 | |
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
|
512 | @param editor reference to the editor (QScintilla.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
|
513 | """ |
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
|
514 | try: |
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
|
515 | editor.removeMouseClickHandlers("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
|
516 | except AttributeError: |
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
|
517 | # eric versions before 6.1.0 don't support this |
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
|
518 | pass |
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
|
519 | |
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
|
520 | def __completionListSelected(self, id, txt): |
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
|
521 | """ |
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
|
522 | Private slot to handle the selection from the completion list. |
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
|
523 | |
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
|
524 | @param id the ID of the user list (should be 1) (integer) |
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
|
525 | @param txt the selected text (QString) |
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
|
526 | """ |
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
|
527 | from QScintilla.Editor import EditorAutoCompletionListID |
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
|
528 | |
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
|
529 | 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
|
530 | if id == EditorAutoCompletionListID: |
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
|
531 | lst = txt.split() |
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
|
532 | if len(lst) > 1: |
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
|
533 | txt = lst[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
|
534 | |
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
|
535 | if Preferences.getEditor("AutoCompletionReplaceWord"): |
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
|
536 | editor.selectCurrentWord() |
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
|
537 | editor.removeSelectedText() |
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
|
538 | line, col = editor.getCursorPosition() |
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
|
539 | 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
|
540 | line, col = editor.getCursorPosition() |
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
|
541 | wLeft = editor.getWordLeft(line, col) |
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
|
542 | if not txt.startswith(wLeft): |
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
|
543 | editor.selectCurrentWord() |
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
|
544 | editor.removeSelectedText() |
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
|
545 | line, col = editor.getCursorPosition() |
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
|
546 | elif wLeft: |
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
|
547 | txt = txt[len(wLeft):] |
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
|
548 | editor.insert(txt) |
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
|
549 | editor.setCursorPosition(line, col + len(txt)) |
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
|
550 | |
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
|
551 | 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
|
552 | """ |
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
|
553 | 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
|
554 | |
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
|
555 | @param editor reference to the editor (QScintilla.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
|
556 | """ |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
557 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
558 | editor.addCompletionListHook("rope", self.getCompletionsList) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
559 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
560 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
561 | editor.userListActivated.connect(self.__completionListSelected) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
562 | editor.setAutoCompletionHook(self.codeAssist) |
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
|
563 | |
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
|
564 | 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
|
565 | """ |
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
|
566 | 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
|
567 | |
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
|
568 | @param editor reference to the editor (QScintilla.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
|
569 | """ |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
570 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
571 | editor.removeCompletionListHook("rope") |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
572 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
573 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
574 | editor.unsetAutoCompletionHook() |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
575 | editor.userListActivated.disconnect(self.__completionListSelected) |
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
|
576 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
116
diff
changeset
|
577 | def codeAssist(self, editor, context=False): |
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
|
578 | """ |
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
|
579 | Public method to determine the autocompletion proposals. |
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
|
580 | |
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
|
581 | @param editor reference to the editor object, that called this method |
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
|
582 | QScintilla.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
|
583 | @param context flag indicating to autocomplete a context (boolean) |
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
|
584 | """ |
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
|
585 | self.__currentEditor = 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
|
586 | if self.getPreferences("CodeAssistTimeout"): |
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
|
587 | self.__acTimer.stop() |
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
|
588 | self.__acTimer.start() |
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
|
589 | 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
|
590 | self.__codeAssist() |
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
|
591 | |
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
|
592 | def __codeAssist(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
|
593 | """ |
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
|
594 | Private slot to show a list with completion proposals. |
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
|
595 | """ |
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
|
596 | from QScintilla.Editor import EditorAutoCompletionListID |
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
|
597 | |
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
|
598 | if self.__currentEditor is not 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
|
599 | if self.__currentEditor.isListActive(): |
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
|
600 | self.__currentEditor.cancelList() |
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
|
601 | completions = self.getCompletionsList(self.__currentEditor, False) |
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
|
602 | if len(completions) == 0 and \ |
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
|
603 | self.getPreferences("ShowQScintillaCompletions"): |
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
|
604 | # try QScintilla autocompletion |
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
|
605 | self.__currentEditor.autoCompleteQScintilla() |
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
|
606 | 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
|
607 | completions.sort() |
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
|
608 | self.__currentEditor.showUserList(EditorAutoCompletionListID, |
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
|
609 | completions) |
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
|
610 | |
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
|
611 | 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
|
612 | """ |
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
|
613 | 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
|
614 | |
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
|
615 | @param editor reference to the editor object, that called this method |
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
|
616 | (QScintilla.Editor) |
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
|
617 | @param context flag indicating to autocomplete a context (boolean) |
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
|
618 | @return list of possible completions (list of strings) |
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
|
619 | """ |
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
|
620 | completions = self.__caObject.getCompletions(editor) |
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
|
621 | 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
|
622 | |
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
|
623 | 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
|
624 | """ |
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
|
625 | 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
|
626 | |
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
|
627 | @param filename name of the file about to be saved (string) |
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
|
628 | """ |
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
|
629 | 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
|
630 | 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
|
631 | 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
|
632 | 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
|
633 | 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
|
634 | 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
|
635 | 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
|
636 | 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
|
637 | 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
|
638 | |
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
|
639 | 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
|
640 | """ |
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
|
641 | 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
|
642 | |
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
|
643 | @param filename name of the file that was saved (string) |
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
|
644 | """ |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
645 | if filename == self.__savedEditorName and self.__oldEditorText: |
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
|
646 | self.__object.reportChanged(self.__savedEditorName, |
b2b2107b8047
Little improvement to update the SOA database for refactoring upon saving a file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
104
diff
changeset
|
647 | self.__oldEditorText) |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
648 | self.__caObject.reportChanged(self.__savedEditorName, |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
649 | self.__oldEditorText) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
650 | else: |
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
|
651 | self.__object.reportChanged(filename, "") |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
652 | self.__caObject.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
|
653 | |
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
|
654 | 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
|
655 | """ |
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
|
656 | 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
|
657 | |
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
|
658 | @param editor reference to the editor (QScintilla.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
|
659 | """ |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
660 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
661 | editor.addCallTipHook("rope", self.codeAssistCallTip) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
662 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
663 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
664 | editor.setCallTipHook(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
|
665 | |
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
|
666 | 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
|
667 | """ |
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
|
668 | 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
|
669 | |
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
|
670 | @param editor reference to the editor (QScintilla.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
|
671 | """ |
125
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
672 | try: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
673 | editor.removeCallTipHook("rope") |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
674 | except AttributeError: |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
675 | # old interface (before 6.1.0) |
e775b4f9d07c
Adapted to the extended Editor API as of eric 6.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
122
diff
changeset
|
676 | editor.unsetCallTipHook() |
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
|
677 | |
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
|
678 | 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
|
679 | """ |
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
|
680 | 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
|
681 | |
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
|
682 | @param editor reference to the editor (QScintilla.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
|
683 | @param pos position in the text for the calltip (integer) |
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
|
684 | @param commas minimum number of commas contained in the calltip |
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
|
685 | (integer) |
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
|
686 | @return list of possible calltips (list of strings) |
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
|
687 | """ |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
688 | cts = self.__caObject.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
|
689 | return cts |