def showMovies(self, page): if '<item>' in page: dom = xmlparseString(page) items = dom.getElementsByTagName("item") else: item = xmlparseString(page) items = [item] for item in items: title = getText(item.getElementsByTagName("title")[0].childNodes).encode('utf8') description = getText(item.getElementsByTagName("description")[0].childNodes).encode('utf8') url = item.getElementsByTagName("enclosure")[0].getAttribute("url").encode('utf8') if url == "": url = "N/A" length = item.getElementsByTagName("enclosure")[0].getAttribute("length").encode('utf8') if length == "": length = "N/A" type = item.getElementsByTagName("enclosure")[0].getAttribute("type").encode('utf8') if type == "": type = "N/A" self.list.append(encodeUrl(title)) self.movies.append([description, (url, length, type)]) self["list"].setList(self.list) self.showInfo() self.working = False
def showMovies(self, page): if '<item>' in page: dom = xmlparseString(page) items = dom.getElementsByTagName("item") else: item = xmlparseString(page) items = [item] for item in items: title = getText(item.getElementsByTagName("title") [0].childNodes).encode('utf8') description = getText( item.getElementsByTagName("description")[0].childNodes).encode( 'utf8') url = item.getElementsByTagName("enclosure")[0].getAttribute( "url").encode('utf8') if url == "": url = "N/A" length = item.getElementsByTagName("enclosure")[0].getAttribute( "length").encode('utf8') if length == "": length = "N/A" type = item.getElementsByTagName("enclosure")[0].getAttribute( "type").encode('utf8') if type == "": type = "N/A" self.list.append(encodeUrl(title)) self.movies.append([description, (url, length, type)]) self["list"].setList(self.list) self.showInfo() self.working = False
def svgGetPaths(svgCode): doc = xmlparseString(svgCode) svg = doc.documentElement paths = findPathNodes(svg) isFigmaSVG = svgCode.find('Figma</desc>') != -1 if len(paths) == 0: return paths, (0,0) paths2 = [] for path in paths: id = path.getAttribute('id') if not isFigmaSVG or (id is None or id.find('stroke') == -1): tr = nodeTranslation(path) d = path.getAttribute('d') paths2.append((d, tr)) return paths2, isFigmaSVG
def glyphUpdateFromSVG(g, svgCode): doc = xmlparseString(svgCode) svg = doc.documentElement paths = findPathNodes(svg) if len(paths) == 0: raise Exception('no <path> found in SVG') path = paths[0] if len(paths) != 1: for p in paths: id = p.getAttribute('id') if id is not None and id.find('stroke') == -1: path = p break tr = nodeTranslation(path) d = path.getAttribute('d') g.clearContours() drawSVGPath(g, d, tr)