AssistantEric/Assistant.py

branch
eric7
changeset 191
6798a98189da
parent 190
3104a5a3ea13
child 200
90c24865ba02
equal deleted inserted replaced
190:3104a5a3ea13 191:6798a98189da
11 import re 11 import re
12 import imp 12 import imp
13 13
14 from PyQt6.QtCore import QObject 14 from PyQt6.QtCore import QObject
15 15
16 from EricWidgets.EricApplication import ericApp 16 from eric7.EricWidgets.EricApplication import ericApp
17 17
18 from .APIsManager import APIsManager, ApisNameProject 18 from .APIsManager import APIsManager, ApisNameProject
19 19
20 AcsAPIs = 0x0001 20 AcsAPIs = 0x0001
21 AcsDocument = 0x0002 21 AcsDocument = 0x0002
48 48
49 self.__editors = [] 49 self.__editors = []
50 self.__lastContext = None 50 self.__lastContext = None
51 self.__lastFullContext = None 51 self.__lastFullContext = None
52 52
53 from QScintilla.Editor import Editor 53 from eric7.QScintilla.Editor import Editor
54 54
55 self.__fromDocumentID = Editor.FromDocumentID 55 self.__fromDocumentID = Editor.FromDocumentID
56 56
57 def activate(self): 57 def activate(self):
58 """ 58 """
186 @param userListId the ID of the user list (should be 1) 186 @param userListId the ID of the user list (should be 1)
187 @type int 187 @type int
188 @param txt the selected text 188 @param txt the selected text
189 @type str 189 @type str
190 """ 190 """
191 from QScintilla.Editor import EditorAutoCompletionListID 191 from eric7.QScintilla.Editor import EditorAutoCompletionListID
192 192
193 if userListId == EditorAutoCompletionListID: 193 if userListId == EditorAutoCompletionListID:
194 lst = txt.split() 194 lst = txt.split()
195 if len(lst) > 1: 195 if len(lst) > 1:
196 self.__lastFullContext = lst[1][1:].split(")")[0] 196 self.__lastFullContext = lst[1][1:].split(")")[0]
296 col -= 1 296 col -= 1
297 if col > 0 and beg[col - 1] != " ": 297 if col > 0 and beg[col - 1] != " ":
298 col -= 1 298 col -= 1
299 prefix = editor.getWordLeft(line, col) 299 prefix = editor.getWordLeft(line, col)
300 if editor.isPyFile(): 300 if editor.isPyFile():
301 from Utilities.ModuleParser import Module 301 from eric7.Utilities.ModuleParser import Module
302 302
303 src = editor.text() 303 src = editor.text()
304 fn = editor.getFileName() 304 fn = editor.getFileName()
305 if fn is None: 305 if fn is None:
306 fn = "" 306 fn = ""
570 """ 570 """
571 completionsList = [] 571 completionsList = []
572 572
573 prefixFound = False 573 prefixFound = False
574 if prefix and module: 574 if prefix and module:
575 from QScintilla.Editor import Editor 575 from eric7.QScintilla.Editor import Editor
576 576
577 line, col = editor.getCursorPosition() 577 line, col = editor.getCursorPosition()
578 if prefix in ["cls", "self"]: 578 if prefix in ["cls", "self"]:
579 prefixFound = True 579 prefixFound = True
580 for cl in module.classes.values(): 580 for cl in module.classes.values():
824 col -= 1 824 col -= 1
825 if col >= 0: 825 if col >= 0:
826 col -= 1 826 col -= 1
827 prefix = editor.getWordLeft(line, col) 827 prefix = editor.getWordLeft(line, col)
828 if editor.isPyFile(): 828 if editor.isPyFile():
829 from Utilities.ModuleParser import Module 829 from eric7.Utilities.ModuleParser import Module
830 830
831 src = editor.text() 831 src = editor.text()
832 fn = editor.getFileName() 832 fn = editor.getFileName()
833 if fn is None: 833 if fn is None:
834 fn = "" 834 fn = ""

eric ide

mercurial