Beispiel #1
0
def loadFile(args):
    fileName = args[1]
    parentTags = []
    if '-b' in args:
        parentTags.append('BehaviorConfiguration')
    if '-i' in args:
        parentTags.append('InputConfiguration')
    if not parentTags: 
        parentTags = ['InputConfiguration', 'BehaviorConfiguration','PixelConfiguration',
                  'RendererConfiguration']
    confRoot = config.loadConfigFile(fileName).getroot()
    for tag in parentTags: 
        subTree = confRoot.find(tag)
        print tag + ':'
        nodesWithArgs = search.parental_tree_search(subTree,'.getchildren()', ".tag=='Args'")
        nodesWithDocs = search.parental_tree_search(subTree,'.getchildren()', ".tag=='Doc'")
        for obj in nodesWithArgs:
            args = obj.find('Args')
            cidEl = args.find('Id')
            docEl = args.find('Doc') or obj.find('Doc')
            classEl = obj.find('Class')
            cid = None
            doc = None
            className = None
            if cidEl != None:
                cid = cidEl.text
            if docEl != None:
                doc = docEl.text
            if classEl != None:
                className = classEl.text
                print '\tComponent %(id)s - Doc: %(doc)s - Class: %(class)s' % {'id':cid, 'doc':doc,
                                                                                'class':className}
Beispiel #2
0
 def pixelsInRange(self, minX, maxX):
     """Returns (pixelIndex, pixel).  Does a binary search.  Sorts first if neccesary."""
     if not self.pixelsSorted:
         self.computeXSortedPixels()
     minIndex = Search.find_ge(self.xPixelLocs, minX) 
     maxIndex = Search.find_le(self.xPixelLocs, maxX)+1
     return self.xSortedPixels[minIndex:maxIndex]
Beispiel #3
0
def loadFile(args):
    fileName = args[1]
    parentTags = []
    if '-b' in args:
        parentTags.append('BehaviorConfiguration')
    if '-i' in args:
        parentTags.append('InputConfiguration')
    if not parentTags:
        parentTags = [
            'InputConfiguration', 'BehaviorConfiguration',
            'PixelConfiguration', 'RendererConfiguration'
        ]
    confRoot = config.loadConfigFile(fileName).getroot()
    for tag in parentTags:
        subTree = confRoot.find(tag)
        print tag + ':\n'
        nodesWithArgs = search.parental_tree_search(subTree, '.getchildren()',
                                                    ".tag=='Args'")
        nodesWithDocs = search.parental_tree_search(subTree, '.getchildren()',
                                                    ".tag=='Doc'")
        for obj in nodesWithArgs:
            args = obj.find('Args')
            cidEl = args.find('Id')
            docEl = args.find('Doc') or obj.find('Doc')
            classEl = obj.find('Class')
            cid = None
            doc = None
            className = None
            if cidEl != None:
                cid = cidEl.text
            if docEl != None and args != None:
                argDict = config.pullArgsFromItem(obj)
                doc = docEl.text
                try:
                    doc = doc % argDict
                except:
                    doc = docEl.text
            if classEl != None:
                className = classEl.text
                print '\t%(id)s : %(class)s\n\t\t%(doc)s\n' % {
                    'id': cid,
                    'doc': doc,
                    'class': className
                }
Beispiel #4
0
def resolveDocumentInheritances(el):
    """In place resolution of document inheritances.  Doesn't return anything."""
    abstractMembers = Search.parental_tree_search(el, '.getchildren()', '.tag==\'InheritsFrom\'')
    for subel in abstractMembers:
        subel = resolveInheritance(subel)
Beispiel #5
0
def resolveDocumentInheritances(el):
    """In place resolution of document inheritances.  Doesn't return anything."""
    abstractMembers = Search.parental_tree_search(el, '.getchildren()',
                                                  '.tag==\'InheritsFrom\'')
    for subel in abstractMembers:
        subel = resolveInheritance(subel)