Changeset 8370


Ignore:
Timestamp:
6 May 2012, 13:18:17 (13 years ago)
Author:
uli
Message:

Fix iface_names().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py

    r8192 r8370  
    496496    Returns an unsorted list of strings.
    497497    """
    498     ifaces = [iface] + list(iface.getBases())
    499     names = []
    500     for item in ifaces:
    501         names += item.names()
    502     names = [x for x in names if x not in omit]
     498    ifaces = set((iface,))
     499    # Collect all interfaces (also bases) recursively
     500    while True:
     501        ext_ifaces = set(ifaces)
     502        for iface in ext_ifaces:
     503            ext_ifaces = set.union(ext_ifaces, set(iface.getBases()))
     504        if ext_ifaces == ifaces:
     505            # No new interfaces found, list complete
     506            break
     507        ifaces = ext_ifaces
     508    # Collect (filtered) names of collected interfaces
    503509    result = []
    504     for name in names:
    505         cls = iface.get(name).__class__
    506         if exclude_attribs and cls is Attribute:
    507             continue
    508         if exclude_methods and cls is Method:
    509             continue
    510         result.append(name)
     510    for iface in ifaces:
     511        for name, descr in iface.namesAndDescriptions():
     512            if name in omit:
     513                continue
     514            if exclude_attribs and descr.__class__ is Attribute:
     515                continue
     516            if exclude_methods and isinstance(descr, Method):
     517                continue
     518            result.append(name)
    511519    return result
    512520
Note: See TracChangeset for help on using the changeset viewer.