def updateBackground(self): img = findBackground(settings.corkBackground["image"]) self.setStyleSheet("""QListView {{ background:{color}; background-image: url({url}); background-attachment: fixed; }}""".format(color=settings.corkBackground["color"], url=img))
def test_paths(): assert F.appPath() != None assert F.writablePath != None assert len(F.allPaths("suffix")) == 2 assert F.tempFile("yop") != None f = F.findBackground("spacedreams.jpg") assert "resources/backgrounds/spacedreams.jpg" in f assert len(F.customIcons()) > 1
def test_paths(): assert F.appPath() is not None assert F.writablePath is not None assert len(F.allPaths("suffix")) == 2 assert F.tempFile("yop") is not None f = F.findBackground("spacedreams.jpg") assert "resources/backgrounds/spacedreams.jpg" in f assert len(F.customIcons()) > 1
def updateBackground(self): img = findBackground(settings.corkBackground["image"]) self.setStyleSheet("""QListView {{ background:{color}; background-image: url({url}); }}""".format( color=settings.corkBackground["color"], url=img ))
def updateBackground(self): if settings.corkBackground["image"] != "": img = findBackground(settings.corkBackground["image"]) else: # No background image img = "" self.setStyleSheet("""QListView {{ background:{color}; background-image: url({url}); background-attachment: fixed; }}""".format(color=settings.corkBackground["color"], url=img.replace("\\", "/")))
def generateTheme(themeDatas, screenRect): # Window Background px = QPixmap(screenRect.size()) px.fill(QColor(themeDatas["Background/Color"])) painter = QPainter(px) if themeDatas["Background/ImageFile"]: path = findBackground(themeDatas["Background/ImageFile"]) _type = themeDatas["Background/Type"] if path and _type > 0: if _type == 1: # Tiled painter.fillRect(screenRect, QBrush(QImage(path))) else: img = QImage(path) scaled = img.size() if _type == 3: # Stretched scaled.scale(screenRect.size(), Qt.IgnoreAspectRatio) elif _type == 4: # Scaled scaled.scale(screenRect.size(), Qt.KeepAspectRatio) elif _type == 5: # Zoomed scaled.scale(screenRect.size(), Qt.KeepAspectRatioByExpanding) painter.drawImage((screenRect.width() - scaled.width()) / 2, (screenRect.height() - scaled.height()) / 2, img.scaled(scaled)) # Text Background textRect = themeTextRect(themeDatas, screenRect) painter.save() color = QColor(themeDatas["Foreground/Color"]) color.setAlpha(themeDatas["Foreground/Opacity"] * 255 / 100) painter.setBrush(color) painter.setPen(Qt.NoPen) r = themeDatas["Foreground/Rounding"] painter.drawRoundedRect(textRect, r, r) painter.restore() painter.end() return px
def generateTheme(themeDatas, screenRect): # Window Background px = QPixmap(screenRect.size()) px.fill(QColor(themeDatas["Background/Color"])) painter = QPainter(px) if themeDatas["Background/ImageFile"]: path = findBackground(themeDatas["Background/ImageFile"]) _type = themeDatas["Background/Type"] if path and _type > 0: if _type == 1: # Tiled painter.fillRect(screenRect, QBrush(QImage(path))) else: img = QImage(path) scaled = img.size() if _type == 3: # Stretched scaled.scale(screenRect.size(), Qt.IgnoreAspectRatio) elif _type == 4: # Scaled scaled.scale(screenRect.size(), Qt.KeepAspectRatio) elif _type == 5: # Zoomed scaled.scale(screenRect.size(), Qt.KeepAspectRatioByExpanding) painter.drawImage((screenRect.width() - scaled.width()) / 2, (screenRect.height() - scaled.height()) / 2, img.scaled(scaled)) # Text Background textRect = themeTextRect(themeDatas, screenRect) painter.save() color = QColor(themeDatas["Foreground/Color"]) color.setAlpha(themeDatas["Foreground/Opacity"] * 255 / 100) painter.setBrush(color) painter.setPen(Qt.NoPen) r = themeDatas["Foreground/Rounding"] painter.drawRoundedRect(textRect, r, r) painter.restore() painter.end() return px
def setCorkImageDefault(self): if settings.corkBackground["image"] != "": i = self.cmbCorkImage.findData( findBackground(settings.corkBackground["image"])) if i != -1: self.cmbCorkImage.setCurrentIndex(i)
def setCorkImageDefault(self): if settings.corkBackground["image"] != "": i = self.cmbCorkImage.findData(findBackground(settings.corkBackground["image"])) if i != -1: self.cmbCorkImage.setCurrentIndex(i)