AssistantEric/Assistant.py

changeset 98
9c331ebb4b8c
parent 97
6226cdaea3ad
child 106
df7a9c556d5c
equal deleted inserted replaced
97:6226cdaea3ad 98:9c331ebb4b8c
541 iconID = Editor.MethodPrivateID 541 iconID = Editor.MethodPrivateID
542 elif method.isProtected(): 542 elif method.isProtected():
543 iconID = Editor.MethodProtectedID 543 iconID = Editor.MethodProtectedID
544 else: 544 else:
545 iconID = Editor.MethodID 545 iconID = Editor.MethodID
546 if hasattr(method, "modifier"): 546 if (prefix == "cls" and
547 if (prefix == "cls" and 547 method.modifier == method.Class) or \
548 method.modifier == method.Class) or \ 548 prefix == "self":
549 prefix == "self":
550 comps.append((method.name, cl.name,
551 iconID))
552 else:
553 # eric 5.1 cannot differentiate method types
554 comps.append((method.name, cl.name, iconID)) 549 comps.append((method.name, cl.name, iconID))
555 if prefix != "cls": 550 if prefix != "cls":
556 for attribute in cl.attributes.values(): 551 for attribute in cl.attributes.values():
557 # determine icon type 552 # determine icon type
558 if attribute.isPrivate(): 553 if attribute.isPrivate():
600 cl = module.classes[prefix] 595 cl = module.classes[prefix]
601 comps = [] 596 comps = []
602 for method in cl.methods.values(): 597 for method in cl.methods.values():
603 if method.name == "__init__": 598 if method.name == "__init__":
604 continue 599 continue
605 if not doHierarchy and not hasattr(method, "modifier"):
606 # eric 5.1 cannot differentiate method types
607 continue
608 if doHierarchy or \ 600 if doHierarchy or \
609 method.modifier in [method.Class, method.Static]: 601 method.modifier in [method.Class, method.Static]:
610 # determine icon type 602 # determine icon type
611 if method.isPrivate(): 603 if method.isPrivate():
612 if doHierarchy: 604 if doHierarchy:
827 for cl in module.classes.values(): 819 for cl in module.classes.values():
828 if line >= cl.lineno and \ 820 if line >= cl.lineno and \
829 (cl.endlineno == -1 or line <= cl.endlineno): 821 (cl.endlineno == -1 or line <= cl.endlineno):
830 if word in cl.methods: 822 if word in cl.methods:
831 method = cl.methods[word] 823 method = cl.methods[word]
832 if hasattr(method, "modifier"): 824 if prefix == "self" or \
833 if prefix == "self" or \ 825 (prefix == "cls" and
834 (prefix == "cls" and 826 method.modifier == method.Class):
835 method.modifier == method.Class): 827 calltips.append(
836 calltips.append( 828 "{0}{1}{2}({3})".format(
837 "{0}{1}{2}({3})".format( 829 cl.name,
838 cl.name, 830 sep,
839 sep, 831 word,
840 word, 832 ', '.join(method.parameters[1:]
841 ', '.join(method.parameters[1:] 833 )))
842 )))
843 else:
844 # eric 5.1 cannot differentiate method
845 # types
846 calltips.append("{0}{1}{2}({3})".format(
847 cl.name,
848 sep,
849 word,
850 ', '.join(method.parameters[1:])))
851 834
852 for sup in cl.super: 835 for sup in cl.super:
853 calltips.extend(self.__getDocumentCalltips( 836 calltips.extend(self.__getDocumentCalltips(
854 word, sup, module, editor, 837 word, sup, module, editor,
855 doHierarchy=True)) 838 doHierarchy=True))
858 else: 841 else:
859 if prefix in module.classes: 842 if prefix in module.classes:
860 cl = module.classes[prefix] 843 cl = module.classes[prefix]
861 if word in cl.methods: 844 if word in cl.methods:
862 method = cl.methods[word] 845 method = cl.methods[word]
863 if doHierarchy or \ 846 if doHierarchy or method.modifier == method.Class:
864 (hasattr(method, "modifier") and
865 method.modifier == method.Class):
866 # only eric 5.2 and newer can differentiate
867 # method types
868 calltips.append("{0}{1}{2}({3})".format( 847 calltips.append("{0}{1}{2}({3})".format(
869 cl.name, 848 cl.name,
870 sep, 849 sep,
871 word, 850 word,
872 ', '.join(method.parameters[1:]))) 851 ', '.join(method.parameters[1:])))

eric ide

mercurial