Exemplo n.º 1
0
 def loadIncludesFiles(self):
     if self._includesFilesLoaded: return
     basePath = getXBMCSkinPath('')
     for i in xpath.find('//include',xpath.findnode('//includes',self.xml)):
         fileAttr = i.attributes.get('file')
         if fileAttr:
             xmlName = xbmc.validatePath(fileAttr.value)
             p = os.path.join(basePath,xmlName)
             if not os.path.exists(p):
                 continue
             xml = minidom.parse(p)
             includes = xpath.findnode('includes',xml)
             xpath.findnode('..',i).replaceChild(includes,i)
             for sub_i in xpath.find('.//include',includes):
                 nameAttr = sub_i.attributes.get('name')
                 if nameAttr:
                     self.includesMap[nameAttr.value] = sub_i
         else:
             nameAttr = i.attributes.get('name')
             if nameAttr: self.includesMap[nameAttr.value] = i.cloneNode(True)
     self._includesFilesLoaded = True
Exemplo n.º 2
0
 def getVariable(self,name):
     var = xpath.findnode(".//variable[attribute::name='{0}']".format(name),xpath.findnode('includes',self.xml))
     if not var: return ''
     for val in xpath.find('.//value',var):
         conditionAttr = val.attributes.get('condition')
         if not conditionAttr:
             return val.childNodes[0].data or ''
         else:
             if xbmc.getCondVisibility(conditionAttr.value):
                 #print condition
                 #print repr(val.string)
                 return val.childNodes[0].data or ''
     return ''
Exemplo n.º 3
0
 def getWindowTexts(self):
     lt = xpath.find("//control[attribute::type='label' or attribute::type='fadelabel' or attribute::type='textbox']",self.xml)
     texts = []
     for l in lt:
         if not self.controlIsVisible(l): continue
         for p in nodeParents(self.xml,l):
             if not self.controlIsVisible(p): break
             typeAttr = p.attributes.get('type')
             if typeAttr and typeAttr.value in ('list','fixedlist','wraplist','panel'): break
         else:
             text = self.getLabelText(l)
             if text and not text in texts: texts.append(text)
     return self.processTextList(texts)
Exemplo n.º 4
0
 def getVariable(self, name):
     var = xpath.findnode(".//variable[attribute::name='{0}']".format(name),
                          xpath.findnode('includes', self.xml))
     if not var: return ''
     for val in xpath.find('.//value', var):
         conditionAttr = val.attributes.get('condition')
         if not conditionAttr:
             return val.childNodes[0].data or ''
         else:
             if xbmc.getCondVisibility(conditionAttr.value):
                 #print condition
                 #print repr(val.string)
                 return val.childNodes[0].data or ''
     return ''
Exemplo n.º 5
0
 def loadIncludesFiles(self):
     if self._includesFilesLoaded: return
     basePath = getXBMCSkinPath('')
     for i in xpath.find('//include',
                         xpath.findnode('//includes', self.xml)):
         fileAttr = i.attributes.get('file')
         if fileAttr:
             xmlName = xbmc.validatePath(fileAttr.value)
             p = os.path.join(basePath, xmlName)
             if not os.path.exists(p):
                 continue
             xml = minidom.parse(p)
             includes = xpath.findnode('includes', xml)
             xpath.findnode('..', i).replaceChild(includes, i)
             for sub_i in xpath.find('.//include', includes):
                 nameAttr = sub_i.attributes.get('name')
                 if nameAttr:
                     self.includesMap[nameAttr.value] = sub_i
         else:
             nameAttr = i.attributes.get('name')
             if nameAttr:
                 self.includesMap[nameAttr.value] = i.cloneNode(True)
     self._includesFilesLoaded = True
Exemplo n.º 6
0
 def processIncludes(self):
     self.includes = Includes()
     for i in xpath.find('//include',self.xml):
         conditionAttr = i.attributes.get('condition')
         if conditionAttr and not xbmc.getCondVisibility(conditionAttr.value):
             xpath.findnode('..',i).removeChild(i)
             continue
         matchingInclude = self.includes.getInclude(i.childNodes[0].data)
         if not matchingInclude:
             #print 'INCLUDE NOT FOUND: %s' % i.string
             continue
         #print 'INCLUDE FOUND: %s' % i.string
         new = matchingInclude.cloneNode(True)
         xpath.findnode('..',i).replaceChild(new,i)
Exemplo n.º 7
0
 def processIncludes(self):
     self.includes = Includes()
     for i in xpath.find('//include', self.xml):
         conditionAttr = i.attributes.get('condition')
         if conditionAttr and not xbmc.getCondVisibility(
                 conditionAttr.value):
             xpath.findnode('..', i).removeChild(i)
             continue
         matchingInclude = self.includes.getInclude(i.childNodes[0].data)
         if not matchingInclude:
             #print 'INCLUDE NOT FOUND: %s' % i.string
             continue
         #print 'INCLUDE FOUND: %s' % i.string
         new = matchingInclude.cloneNode(True)
         xpath.findnode('..', i).replaceChild(new, i)
Exemplo n.º 8
0
 def getListItemTexts(self,controlID):
     self.currentControl = controlID
     try:
         clist = self.getControl(controlID)
         if not clist: return None
         fl = xpath.findnode("focusedlayout",clist)
         if not fl: return None
         lt = xpath.find("//control[attribute::type='label' or attribute::type='fadelabel' or attribute::type='textbox']",fl)
         texts = []
         for l in lt:
             if not self.controlIsVisibleGlobally(l): continue
             text = self.getLabelText(l)
             if text and not text in texts: texts.append(text)
         return self.processTextList(texts)
     finally:
         self.currentControl = None
Exemplo n.º 9
0
 def getWindowTexts(self):
     lt = xpath.find(
         "//control[attribute::type='label' or attribute::type='fadelabel' or attribute::type='textbox']",
         self.xml)
     texts = []
     for l in lt:
         if not self.controlIsVisible(l): continue
         for p in nodeParents(self.xml, l):
             if not self.controlIsVisible(p): break
             typeAttr = p.attributes.get('type')
             if typeAttr and typeAttr.value in ('list', 'fixedlist',
                                                'wraplist', 'panel'):
                 break
         else:
             text = self.getLabelText(l)
             if text and not text in texts: texts.append(text)
     return self.processTextList(texts)
Exemplo n.º 10
0
 def getListItemTexts(self, controlID):
     self.currentControl = controlID
     try:
         clist = self.getControl(controlID)
         if not clist: return None
         fl = xpath.findnode("focusedlayout", clist)
         if not fl: return None
         lt = xpath.find(
             "//control[attribute::type='label' or attribute::type='fadelabel' or attribute::type='textbox']",
             fl)
         texts = []
         for l in lt:
             if not self.controlIsVisibleGlobally(l): continue
             text = self.getLabelText(l)
             if text and not text in texts: texts.append(text)
         return self.processTextList(texts)
     finally:
         self.currentControl = None