Change the scaling and margins of the welcome dialog

This commit is contained in:
Veronica Berglyd Olsen
2024-02-09 23:26:53 +01:00
parent 186cead603
commit 492dd58068
3 changed files with 25 additions and 19 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ class Config:
# Size Settings
self._mainWinSize = [1200, 650] # Last size of the main GUI window
self._welcomeSize = [800, 500] # Last size of the welcome window
self._welcomeSize = [800, 550] # Last size of the welcome window
self._prefsWinSize = [700, 615] # Last size of the Preferences dialog
self._mainPanePos = [300, 800] # Last position of the main window splitter
self._viewPanePos = [500, 150] # Last position of the document viewer splitter
+22 -16
View File
@@ -50,6 +50,8 @@ from novelwriter.extensions.modified import NComboBox, NSpinBox
logger = logging.getLogger(__name__)
PANEL_ALPHA = 0.7
class GuiWelcome(QDialog):
@@ -62,15 +64,16 @@ class GuiWelcome(QDialog):
self.setObjectName("GuiWelcome")
self.setWindowTitle(self.tr("Welcome"))
self.setMinimumWidth(CONFIG.pxInt(700))
self.setMinimumHeight(CONFIG.pxInt(400))
self.setMinimumWidth(CONFIG.pxInt(650))
self.setMinimumHeight(CONFIG.pxInt(450))
hA = CONFIG.pxInt(8)
hB = CONFIG.pxInt(16)
hC = CONFIG.pxInt(24)
hD = CONFIG.pxInt(36)
hE = CONFIG.pxInt(48)
hF = CONFIG.pxInt(96)
hF = CONFIG.pxInt(128)
self._hPx = CONFIG.pxInt(600)
self.resize(*CONFIG.welcomeWinSize)
@@ -127,14 +130,14 @@ class GuiWelcome(QDialog):
self.innerBox.addWidget(self.nwInfo)
self.innerBox.addSpacing(hA)
self.innerBox.addWidget(self.mainStack)
self.innerBox.addSpacing(hA)
self.innerBox.addSpacing(hB)
self.innerBox.addWidget(self.btnBox)
topRight = Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignRight
self.outerBox = QHBoxLayout()
self.outerBox.addWidget(self.nwLogo, 3, topRight)
self.outerBox.addLayout(self.innerBox, 7)
self.outerBox.addLayout(self.innerBox, 9)
self.outerBox.setContentsMargins(hF, hE, hC, hE)
self.setLayout(self.outerBox)
@@ -155,7 +158,7 @@ class GuiWelcome(QDialog):
def paintEvent(self, event: QPaintEvent) -> None:
"""Overload the paint event to draw the background image."""
hWin = self.height()
hPix = min(hWin, 700)
hPix = min(hWin, self._hPx)
tMode = Qt.TransformationMode.SmoothTransformation
painter = QPainter(self)
painter.fillRect(self.rect(), self.bgColor)
@@ -257,9 +260,10 @@ class _OpenProjectPage(QWidget):
baseCol = self.palette().base().color()
self.setStyleSheet((
"QListView {{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(), m=CONFIG.pxInt(4)))
"QListView {{border: none; background: rgba({r},{g},{b},{a});}} "
"QLineEdit {{border: none; background: rgba({r},{g},{b},{a}); padding: {m}px;}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue(),
a=PANEL_ALPHA, m=CONFIG.pxInt(4)))
return
@@ -482,9 +486,9 @@ class _NewProjectPage(QWidget):
baseCol = self.palette().base().color()
self.setStyleSheet((
"QScrollArea {{border: none; background: rgba({r},{g},{b},0.65);}} "
"_NewProjectForm {{border: none; background: rgba({r},{g},{b},0.65);}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue()))
"QScrollArea {{border: none; background: rgba({r},{g},{b},{a});}} "
"_NewProjectForm {{border: none; background: rgba({r},{g},{b},{a});}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue(), a=PANEL_ALPHA))
return
@@ -520,6 +524,8 @@ class _NewProjectForm(QWidget):
self._fillMode = self.FILL_BLANK
self._copyPath = None
iPx = SHARED.theme.baseIconSize
# Project Settings
# ================
@@ -623,19 +629,19 @@ class _NewProjectForm(QWidget):
# Project Notes
# =============
self.addPlot = NSwitch(self)
self.addPlot = NSwitch(self, height=iPx)
self.addPlot.setChecked(True)
self.addPlot.clicked.connect(self._syncSwitches)
self.addChar = NSwitch(self)
self.addChar = NSwitch(self, height=iPx)
self.addChar.setChecked(True)
self.addChar.clicked.connect(self._syncSwitches)
self.addWorld = NSwitch(self)
self.addWorld = NSwitch(self, height=iPx)
self.addWorld.setChecked(False)
self.addWorld.clicked.connect(self._syncSwitches)
self.addNotes = NSwitch()
self.addNotes = NSwitch(self, height=iPx)
self.addNotes.setChecked(False)
self.notesForm = QFormLayout()
+2 -2
View File
@@ -1,5 +1,5 @@
[Meta]
timestamp = 2023-12-29 14:11:20
timestamp = 2024-02-09 12:05:00
[Main]
theme = default
@@ -14,7 +14,7 @@ lastpath =
[Sizes]
mainwindow = 1200, 650
welcome = 800, 500
welcome = 800, 550
preferences = 700, 615
mainpane = 300, 800
viewpane = 500, 150