Add support for dark theme welcome window
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 334 KiB |
@@ -255,9 +255,8 @@ class GuiTheme:
|
|||||||
|
|
||||||
backLNess = backCol.lightnessF()
|
backLNess = backCol.lightnessF()
|
||||||
textLNess = textCol.lightnessF()
|
textLNess = textCol.lightnessF()
|
||||||
|
self.isLightTheme = backLNess > textLNess
|
||||||
if self.helpText == [0, 0, 0]:
|
if self.helpText == [0, 0, 0]:
|
||||||
self.isLightTheme = backLNess > textLNess
|
|
||||||
if self.isLightTheme:
|
if self.isLightTheme:
|
||||||
helpLCol = textLNess + 0.35*(backLNess - textLNess)
|
helpLCol = textLNess + 0.35*(backLNess - textLNess)
|
||||||
else:
|
else:
|
||||||
@@ -487,7 +486,7 @@ class GuiIcons:
|
|||||||
}
|
}
|
||||||
|
|
||||||
IMAGE_MAP: dict[str, tuple[str, str]] = {
|
IMAGE_MAP: dict[str, tuple[str, str]] = {
|
||||||
"welcome": ("welcome.jpg", "welcome.jpg"),
|
"welcome": ("welcome-light.jpg", "welcome-dark.jpg"),
|
||||||
"nw-text": ("novelwriter-text-light.svg", "novelwriter-text-dark.svg"),
|
"nw-text": ("novelwriter-text-light.svg", "novelwriter-text-dark.svg"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ class GuiWelcome(QDialog):
|
|||||||
|
|
||||||
self.bgImage = SHARED.theme.loadDecoration("welcome")
|
self.bgImage = SHARED.theme.loadDecoration("welcome")
|
||||||
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=hD)
|
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=hD)
|
||||||
|
self.bgColor = QColor(255, 255, 255) if SHARED.theme.isLightTheme else QColor(54, 54, 54)
|
||||||
|
|
||||||
self.nwLogo = QLabel()
|
self.nwLogo = QLabel()
|
||||||
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (hF, hF)))
|
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (hF, hF)))
|
||||||
@@ -139,6 +140,7 @@ class GuiWelcome(QDialog):
|
|||||||
self.outerBox.setContentsMargins(hF, hE, hC, hE)
|
self.outerBox.setContentsMargins(hF, hE, hC, hE)
|
||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
self.setSizeGripEnabled(True)
|
||||||
|
|
||||||
logger.debug("Ready: GuiWelcome")
|
logger.debug("Ready: GuiWelcome")
|
||||||
|
|
||||||
@@ -158,7 +160,7 @@ class GuiWelcome(QDialog):
|
|||||||
hPix = min(hWin, 700)
|
hPix = min(hWin, 700)
|
||||||
tMode = Qt.TransformationMode.SmoothTransformation
|
tMode = Qt.TransformationMode.SmoothTransformation
|
||||||
painter = QPainter(self)
|
painter = QPainter(self)
|
||||||
painter.fillRect(self.rect(), QColor(255, 255, 255))
|
painter.fillRect(self.rect(), self.bgColor)
|
||||||
painter.drawPixmap(0, hWin - hPix, self.bgImage.scaledToHeight(hPix, tMode))
|
painter.drawPixmap(0, hWin - hPix, self.bgImage.scaledToHeight(hPix, tMode))
|
||||||
super().paintEvent(event)
|
super().paintEvent(event)
|
||||||
return
|
return
|
||||||
@@ -222,9 +224,6 @@ class _OpenProjectPage(QWidget):
|
|||||||
def __init__(self, parent: QWidget) -> None:
|
def __init__(self, parent: QWidget) -> None:
|
||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
|
|
||||||
hPx = CONFIG.pxInt(6)
|
|
||||||
vPx = CONFIG.pxInt(4)
|
|
||||||
|
|
||||||
# List View
|
# List View
|
||||||
self.listModel = _ProjectListModel(self)
|
self.listModel = _ProjectListModel(self)
|
||||||
self.itemDelegate = _ProjectListItem(self)
|
self.itemDelegate = _ProjectListItem(self)
|
||||||
@@ -239,7 +238,6 @@ class _OpenProjectPage(QWidget):
|
|||||||
|
|
||||||
# Info / Tool
|
# Info / Tool
|
||||||
self.selectedPath = QLineEdit(self)
|
self.selectedPath = QLineEdit(self)
|
||||||
self.selectedPath.setContentsMargins(hPx, vPx, hPx, vPx)
|
|
||||||
self.selectedPath.setReadOnly(True)
|
self.selectedPath.setReadOnly(True)
|
||||||
|
|
||||||
self.keyDelete = QShortcut(self)
|
self.keyDelete = QShortcut(self)
|
||||||
@@ -260,8 +258,8 @@ class _OpenProjectPage(QWidget):
|
|||||||
baseCol = self.palette().base().color()
|
baseCol = self.palette().base().color()
|
||||||
self.setStyleSheet((
|
self.setStyleSheet((
|
||||||
"QListView {{border: none; background: rgba({r},{g},{b},0.65);}} "
|
"QListView {{border: none; background: rgba({r},{g},{b},0.65);}} "
|
||||||
"QLineEdit {{border: none; background: rgba({r},{g},{b},0.65);}} "
|
"QLineEdit {{border: none; background: rgba({r},{g},{b},0.65); padding: {m}px;}} "
|
||||||
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue()))
|
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue(), m=CONFIG.pxInt(4)))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user