def applySkin(self, desktop, parent): scrollbarWidth = 20 scrollbarBorderWidth = 1 ret = False if self.skinAttributes: widget_attribs = [] scrollbar_attribs = [] scrollbarAttrib = ["borderColor", "borderWidth", "scrollbarSliderForegroundColor", "scrollbarSliderBorderColor"] for (attrib, value) in self.skinAttributes[:]: if attrib in scrollbarAttrib: scrollbar_attribs.append((attrib, value)) self.skinAttributes.remove((attrib, value)) elif attrib in ("scrollbarSliderPicture", "sliderPixmap"): self.scrollbar.setPixmap(loadPixmap(value, desktop)) self.skinAttributes.remove((attrib, value)) elif attrib in ("scrollbarBackgroundPicture", "scrollbarbackgroundPixmap"): self.scrollbar.setBackgroundPixmap(loadPixmap(value, desktop)) self.skinAttributes.remove((attrib, value)) elif "transparent" in attrib or "backgroundColor" in attrib: widget_attribs.append((attrib, value)) elif "scrollbarWidth" in attrib: scrollbarWidth = int(value) self.skinAttributes.remove((attrib, value)) elif "scrollbarSliderBorderWidth" in attrib: scrollbarBorderWidth = int(value) self.skinAttributes.remove((attrib, value)) elif "split" in attrib: self.split = 1 if value.lower() in ("1", "enabled", "on", "split", "true", "yes") else 0 if self.split: self.right_text = eLabel(self.instance) self.skinAttributes.remove((attrib, value)) elif "colposition" in attrib or "colPosition" in attrib: self.column = int(value) elif "dividechar" in attrib or "divideChar" in attrib: self.splitchar = value if self.split: applyAllAttributes(self.long_text, desktop, self.skinAttributes + [("halign", "left")], parent.scale) applyAllAttributes(self.right_text, desktop, self.skinAttributes + [("transparent", "1"), ("halign", "left" if self.column else "right")], parent.scale) else: applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale) applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale) applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs + widget_attribs, parent.scale) ret = True self.pageWidth = self.long_text.size().width() lineheight = fontRenderClass.getInstance().getLineHeight(self.long_text.getFont()) or 30 # assume a random lineheight if nothing is visible lines = int(self.long_text.size().height() / lineheight) self.pageHeight = int(lines * lineheight) self.instance.move(self.long_text.position()) self.instance.resize(eSize(self.pageWidth, self.pageHeight + int(lineheight / 6))) self.long_text.resize(eSize(self.pageWidth - 30, self.pageHeight + int(lineheight / 6))) self.scrollbar.move(ePoint(self.pageWidth - scrollbarWidth, 0)) self.scrollbar.resize(eSize(scrollbarWidth, self.pageHeight + int(lineheight / 6))) self.scrollbar.setOrientation(eSlider.orVertical) self.scrollbar.setRange(0, 100) self.scrollbar.setBorderWidth(scrollbarBorderWidth) self.setText(self.message) return ret
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, "skin_path", path) pixmap = None attribs = [ ] for (attrib, value) in self.skinAttributes: if attrib == "pixmaps": pixmaps = value.split(',') for p in pixmaps: pngfile = resolveFilename(SCOPE_CURRENT_SKIN, p, path_prefix=skin_path_prefix) if not fileExists(pngfile) and fileExists(resolveFilename(SCOPE_CURRENT_LCDSKIN, p, path_prefix=skin_path_prefix)): pngfile = resolveFilename(SCOPE_CURRENT_LCDSKIN, p, path_prefix=skin_path_prefix) if path.exists(pngfile): self.pixmaps.append(loadPixmap(pngfile, desktop)) if not pixmap: pixmap = resolveFilename(SCOPE_CURRENT_SKIN, pixmaps[0], path_prefix=skin_path_prefix) if not fileExists(pixmap) and fileExists(resolveFilename(SCOPE_CURRENT_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_CURRENT_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix) elif attrib == "pixmap": pixmap = resolveFilename(SCOPE_CURRENT_SKIN, value, path_prefix=skin_path_prefix) if not fileExists(pixmap) and fileExists(resolveFilename(SCOPE_CURRENT_LCDSKIN, value, path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_CURRENT_LCDSKIN, value, path_prefix=skin_path_prefix) else: attribs.append((attrib, value)) if pixmap: attribs.append(("pixmap", pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: myScreen, path = domScreens.get(screen.__class__.__name__, (None, None)) skinPathPrefix = getattr(screen, "skin_path", path) pixmap = None attribs = [] for (attrib, value) in self.skinAttributes: if attrib == "pixmaps": pixmaps = value.split(",") for pix in pixmaps: if fileExists(resolveFilename(SCOPE_GUISKIN, pix, path_prefix=skinPathPrefix)): pngfile = resolveFilename(SCOPE_GUISKIN, pix, path_prefix=skinPathPrefix) elif fileExists(resolveFilename(SCOPE_LCDSKIN, pix, path_prefix=skinPathPrefix)): pngfile = resolveFilename(SCOPE_LCDSKIN, pix, path_prefix=skinPathPrefix) else: pngfile = "" if pngfile and isfile(pngfile): self.pixmaps.append(loadPixmap(pngfile, desktop)) if not pixmap: if fileExists(resolveFilename(SCOPE_GUISKIN, pixmaps[0], path_prefix=skinPathPrefix)): pixmap = resolveFilename(SCOPE_GUISKIN, pixmaps[0], path_prefix=skinPathPrefix) elif fileExists(resolveFilename(SCOPE_LCDSKIN, pixmaps[0], path_prefix=skinPathPrefix)): pixmap = resolveFilename(SCOPE_LCDSKIN, pixmaps[0], path_prefix=skinPathPrefix) elif attrib == "pixmap": if fileExists(resolveFilename(SCOPE_GUISKIN, value, path_prefix=skinPathPrefix)): pixmap = resolveFilename(SCOPE_GUISKIN, value, path_prefix=skinPathPrefix) elif fileExists(resolveFilename(SCOPE_LCDSKIN, value, path_prefix=skinPathPrefix)): pixmap = resolveFilename(SCOPE_LCDSKIN, value, path_prefix=skinPathPrefix) else: attribs.append((attrib, value)) if pixmap: attribs.append(("pixmap", pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, "skin_path", path) pixmap = None attribs = [] for (attrib, value) in self.skinAttributes: if attrib == "pixmaps": pixmaps = value.split(',') for p in pixmaps: self.pixmaps.append( loadPixmap( resolveFilename(SCOPE_SKIN_IMAGE, p, path_prefix=skin_path_prefix), desktop)) if not pixmap: pixmap = resolveFilename(SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix) elif attrib == "pixmap": pixmap = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix) else: attribs.append((attrib, value)) if pixmap: attribs.append(("pixmap", pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, "skin_path", path) pixmap = None attribs = [ ] for (attrib, value) in self.skinAttributes: if attrib == "pixmaps": pixmaps = value.split(',') for p in pixmaps: pngfile = resolveFilename(SCOPE_ACTIVE_SKIN, p, path_prefix=skin_path_prefix) if fileExists(resolveFilename(SCOPE_SKIN_IMAGE, p, path_prefix=skin_path_prefix)): pngfile = resolveFilename(SCOPE_SKIN_IMAGE, p, path_prefix=skin_path_prefix) elif fileExists(resolveFilename(SCOPE_ACTIVE_LCDSKIN, p, path_prefix=skin_path_prefix)): pngfile = resolveFilename(SCOPE_ACTIVE_LCDSKIN, p, path_prefix=skin_path_prefix) if path.exists(pngfile): self.pixmaps.append(loadPixmap(pngfile, desktop)) if not pixmap: pixmap = resolveFilename(SCOPE_ACTIVE_SKIN, pixmaps[0], path_prefix=skin_path_prefix) if fileExists(resolveFilename(SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix) elif fileExists(resolveFilename(SCOPE_ACTIVE_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_ACTIVE_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix) elif attrib == "pixmap": pixmap = resolveFilename(SCOPE_ACTIVE_SKIN, value, path_prefix=skin_path_prefix) if fileExists(resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix) elif fileExists(resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix) else: attribs.append((attrib,value)) if pixmap: attribs.append(("pixmap", pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, "skin_path", path) pixmap = None attribs = [ ] for (attrib, value) in self.skinAttributes: if attrib == "pixmaps": pixmaps = value.split(',') for p in pixmaps: self.pixmaps.append(loadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, p, path_prefix=skin_path_prefix), desktop) ) if not pixmap: pixmap = resolveFilename(SCOPE_CURRENT_SKIN, pixmaps[0], path_prefix=skin_path_prefix) elif attrib == "pixmap": pixmap = resolveFilename(SCOPE_CURRENT_SKIN, value, path_prefix=skin_path_prefix) else: attribs.append((attrib,value)) if pixmap: attribs.append(("pixmap", pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, 'skin_path', path) attribs = [] for attrib, value in self.skinAttributes: if attrib == 'pixmaps': index = 0 pixmaps = value.split(',') for p in pixmaps: self.instance.setPixmap( loadPixmap( resolveFilename(SCOPE_CURRENT_SKIN, p, path_prefix=skin_path_prefix), desktop), index, 0) index += 1 else: attribs.append((attrib, value)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)
def applySkin(self, desktop, screen): if self.skinAttributes is not None: skin_path_prefix = getattr(screen, 'skin_path', path) pixmap = None attribs = [] for attrib, value in self.skinAttributes: if attrib == 'pixmaps': pixmaps = value.split(',') for p in pixmaps: pngfile = resolveFilename(SCOPE_ACTIVE_SKIN, p, path_prefix=skin_path_prefix) if fileExists( resolveFilename(SCOPE_SKIN_IMAGE, p, path_prefix=skin_path_prefix)): pngfile = resolveFilename( SCOPE_SKIN_IMAGE, p, path_prefix=skin_path_prefix) elif fileExists( resolveFilename(SCOPE_ACTIVE_LCDSKIN, p, path_prefix=skin_path_prefix)): pngfile = resolveFilename( SCOPE_ACTIVE_LCDSKIN, p, path_prefix=skin_path_prefix) if path.exists(pngfile): self.pixmaps.append(loadPixmap(pngfile, desktop)) if not pixmap: pixmap = resolveFilename(SCOPE_ACTIVE_SKIN, pixmaps[0], path_prefix=skin_path_prefix) if fileExists( resolveFilename(SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix)): pixmap = resolveFilename( SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix) elif fileExists( resolveFilename(SCOPE_ACTIVE_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix)): pixmap = resolveFilename( SCOPE_ACTIVE_LCDSKIN, pixmaps[0], path_prefix=skin_path_prefix) elif attrib == 'pixmap': pixmap = resolveFilename(SCOPE_ACTIVE_SKIN, value, path_prefix=skin_path_prefix) if fileExists( resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix) elif fileExists( resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix)): pixmap = resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix) else: attribs.append((attrib, value)) if pixmap: attribs.append(('pixmap', pixmap)) self.skinAttributes = attribs return GUIComponent.applySkin(self, desktop, screen)