Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GUI scaling #1788

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions novelwriter/assets/icons/typicons_dark/icons.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ status_time = typ_stopwatch-grey.svg
sticky-off = typ_pin-outline.svg
sticky-on = typ_pin.svg
unchecked = mixed_input-unchecked.svg
unfold-hide = typ_arrow-right.svg
unfold-show = typ_arrow-down.svg
unfold-hide = typ_unfold-hidden.svg
unfold-show = typ_unfold-visible.svg
up = typ_chevron-up.svg
view = typ_eye.svg
view_build = typ_export-grey.svg
Expand Down
4 changes: 0 additions & 4 deletions novelwriter/assets/icons/typicons_dark/typ_arrow-down.svg

This file was deleted.

4 changes: 0 additions & 4 deletions novelwriter/assets/icons/typicons_dark/typ_arrow-right.svg

This file was deleted.

4 changes: 4 additions & 0 deletions novelwriter/assets/icons/typicons_dark/typ_unfold-hidden.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions novelwriter/assets/icons/typicons_dark/typ_unfold-visible.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions novelwriter/assets/icons/typicons_light/icons.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ status_time = typ_stopwatch-grey.svg
sticky-off = typ_pin-outline.svg
sticky-on = typ_pin.svg
unchecked = mixed_input-unchecked.svg
unfold-hide = typ_arrow-right.svg
unfold-show = typ_arrow-down.svg
unfold-hide = typ_unfold-hidden.svg
unfold-show = typ_unfold-visible.svg
up = typ_chevron-up.svg
view = typ_eye.svg
view_build = typ_export-grey.svg
Expand Down
4 changes: 0 additions & 4 deletions novelwriter/assets/icons/typicons_light/typ_arrow-down.svg

This file was deleted.

4 changes: 0 additions & 4 deletions novelwriter/assets/icons/typicons_light/typ_arrow-right.svg

This file was deleted.

4 changes: 4 additions & 0 deletions novelwriter/assets/icons/typicons_light/typ_unfold-hidden.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions novelwriter/dialogs/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import logging

from PyQt5.QtGui import QCloseEvent, QColor
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QHBoxLayout, QLabel, QTextBrowser, QVBoxLayout,
QWidget
Expand All @@ -36,6 +35,7 @@
from novelwriter.common import readTextFile
from novelwriter.extensions.configlayout import NColourLabel
from novelwriter.extensions.versioninfo import VersionInfoWidget
from novelwriter.types import QtAlignRightTop

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -100,10 +100,8 @@ def __init__(self, parent: QWidget) -> None:
self.innerBox.addSpacing(hB)
self.innerBox.addWidget(self.btnBox)

topRight = Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignRight

self.outerBox = QHBoxLayout()
self.outerBox.addWidget(self.nwLogo, 0, topRight)
self.outerBox.addWidget(self.nwLogo, 0, QtAlignRightTop)
self.outerBox.addLayout(self.innerBox, 1)

self.setLayout(self.outerBox)
Expand Down
9 changes: 5 additions & 4 deletions novelwriter/dialogs/docmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import logging

from PyQt5.QtGui import QCloseEvent
from PyQt5.QtCore import Qt, QSize, pyqtSlot
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout, QLabel,
QListWidget, QListWidgetItem, QVBoxLayout, QWidget
Expand Down Expand Up @@ -59,13 +59,14 @@ def __init__(self, parent: QWidget, sHandle: str, itemList: list[str]) -> None:
SHARED.theme.helpText, parent=self, wrap=True
)

iPx = SHARED.theme.baseIconSize
iPx = SHARED.theme.baseIconHeight
iSz = SHARED.theme.baseIconSize
hSp = CONFIG.pxInt(12)
vSp = CONFIG.pxInt(8)
bSp = CONFIG.pxInt(12)

self.listBox = QListWidget()
self.listBox.setIconSize(QSize(iPx, iPx))
self.listBox = QListWidget(self)
self.listBox.setIconSize(iSz)
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
self.listBox.setSelectionBehavior(QAbstractItemView.SelectRows)
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/dialogs/docsplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, parent: QWidget, sHandle: str) -> None:
)

# Values
iPx = SHARED.theme.baseIconSize
iPx = SHARED.theme.baseIconHeight
hSp = CONFIG.pxInt(12)
vSp = CONFIG.pxInt(8)
bSp = CONFIG.pxInt(12)
Expand Down
38 changes: 17 additions & 21 deletions novelwriter/dialogs/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractButton, QCompleter, QDialog, QDialogButtonBox, QFileDialog,
QFontDialog, QHBoxLayout, QLineEdit, QPushButton, QToolButton, QVBoxLayout,
QWidget, qApp
QFontDialog, QHBoxLayout, QLineEdit, QPushButton, QVBoxLayout, QWidget,
qApp
)

from novelwriter import CONFIG, SHARED
from novelwriter.constants import nwConst, nwUnicode
from novelwriter.dialogs.quotes import GuiQuoteSelect
from novelwriter.extensions.switch import NSwitch
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
from novelwriter.extensions.configlayout import NColourLabel, NScrollableForm
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconToolButton, NSpinBox
from novelwriter.extensions.pagedsidebar import NPagedSideBar
from novelwriter.extensions.switch import NSwitch
from novelwriter.types import QtAlignCenter

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -132,8 +133,8 @@ def __del__(self) -> None: # pragma: no cover
def buildForm(self) -> None:
"""Build the settings form."""
section = 0
iSz = SHARED.theme.baseIconSize
minWidth = CONFIG.pxInt(200)
mIcon = SHARED.theme.getIcon("more")

# Label
self.sidebar.addLabel(self.tr("General"))
Expand Down Expand Up @@ -175,8 +176,7 @@ def buildForm(self) -> None:
self.guiFont.setReadOnly(True)
self.guiFont.setMinimumWidth(CONFIG.pxInt(162))
self.guiFont.setText(CONFIG.guiFont)
self.guiFontButton = QToolButton(self)
self.guiFontButton.setIcon(mIcon)
self.guiFontButton = NIconToolButton(self, iSz, "more")
self.guiFontButton.clicked.connect(self._selectGuiFont)
self.mainForm.addRow(
self.tr("Application font family"), self.guiFont,
Expand Down Expand Up @@ -236,8 +236,7 @@ def buildForm(self) -> None:
self.textFont.setReadOnly(True)
self.textFont.setMinimumWidth(CONFIG.pxInt(162))
self.textFont.setText(CONFIG.textFont)
self.textFontButton = QToolButton(self)
self.textFontButton.setIcon(mIcon)
self.textFontButton = NIconToolButton(self, iSz, "more")
self.textFontButton.clicked.connect(self._selectTextFont)
self.mainForm.addRow(
self.tr("Document font family"), self.textFont,
Expand Down Expand Up @@ -320,6 +319,7 @@ def buildForm(self) -> None:
# Backup Path
self.backupPath = CONFIG.backupPath()
self.backupGetPath = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Browse"), self)
self.backupGetPath.setIconSize(iSz)
self.backupGetPath.clicked.connect(self._backupFolder)
self.mainForm.addRow(
self.tr("Backup storage location"), self.backupGetPath,
Expand Down Expand Up @@ -675,10 +675,9 @@ def buildForm(self) -> None:
self.quoteSym["SO"].setMaxLength(1)
self.quoteSym["SO"].setReadOnly(True)
self.quoteSym["SO"].setFixedWidth(qWidth)
self.quoteSym["SO"].setAlignment(Qt.AlignCenter)
self.quoteSym["SO"].setAlignment(QtAlignCenter)
self.quoteSym["SO"].setText(CONFIG.fmtSQuoteOpen)
self.btnSingleStyleO = QToolButton(self)
self.btnSingleStyleO.setIcon(mIcon)
self.btnSingleStyleO = NIconToolButton(self, iSz, "more")
self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO"))
self.mainForm.addRow(
self.tr("Single quote open style"), self.quoteSym["SO"],
Expand All @@ -690,10 +689,9 @@ def buildForm(self) -> None:
self.quoteSym["SC"].setMaxLength(1)
self.quoteSym["SC"].setReadOnly(True)
self.quoteSym["SC"].setFixedWidth(qWidth)
self.quoteSym["SC"].setAlignment(Qt.AlignCenter)
self.quoteSym["SC"].setAlignment(QtAlignCenter)
self.quoteSym["SC"].setText(CONFIG.fmtSQuoteClose)
self.btnSingleStyleC = QToolButton(self)
self.btnSingleStyleC.setIcon(mIcon)
self.btnSingleStyleC = NIconToolButton(self, iSz, "more")
self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC"))
self.mainForm.addRow(
self.tr("Single quote close style"), self.quoteSym["SC"],
Expand All @@ -706,10 +704,9 @@ def buildForm(self) -> None:
self.quoteSym["DO"].setMaxLength(1)
self.quoteSym["DO"].setReadOnly(True)
self.quoteSym["DO"].setFixedWidth(qWidth)
self.quoteSym["DO"].setAlignment(Qt.AlignCenter)
self.quoteSym["DO"].setAlignment(QtAlignCenter)
self.quoteSym["DO"].setText(CONFIG.fmtDQuoteOpen)
self.btnDoubleStyleO = QToolButton(self)
self.btnDoubleStyleO.setIcon(mIcon)
self.btnDoubleStyleO = NIconToolButton(self, iSz, "more")
self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO"))
self.mainForm.addRow(
self.tr("Double quote open style"), self.quoteSym["DO"],
Expand All @@ -721,10 +718,9 @@ def buildForm(self) -> None:
self.quoteSym["DC"].setMaxLength(1)
self.quoteSym["DC"].setReadOnly(True)
self.quoteSym["DC"].setFixedWidth(qWidth)
self.quoteSym["DC"].setAlignment(Qt.AlignCenter)
self.quoteSym["DC"].setAlignment(QtAlignCenter)
self.quoteSym["DC"].setText(CONFIG.fmtDQuoteClose)
self.btnDoubleStyleC = QToolButton(self)
self.btnDoubleStyleC.setIcon(mIcon)
self.btnDoubleStyleC = NIconToolButton(self, iSz, "more")
self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC"))
self.mainForm.addRow(
self.tr("Double quote close style"), self.quoteSym["DC"],
Expand Down
30 changes: 17 additions & 13 deletions novelwriter/dialogs/projectsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@

from novelwriter import CONFIG, SHARED
from novelwriter.common import simplified
from novelwriter.extensions.switch import NSwitch
from novelwriter.extensions.modified import NComboBox
from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollableForm
from novelwriter.extensions.modified import NComboBox, NIconToolButton
from novelwriter.extensions.pagedsidebar import NPagedSideBar
from novelwriter.extensions.switch import NSwitch

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -329,7 +329,9 @@ def __init__(self, parent: QWidget, isStatus: bool) -> None:
self._colDeleted = []
self._selColour = QColor(100, 100, 100)

self.iPx = SHARED.theme.baseIconSize
self.iPx = SHARED.theme.baseIconHeight
iSz = SHARED.theme.baseIconSize
bSz = SHARED.theme.buttonIconSize

# Title
self.pageTitle = NColourLabel(
Expand All @@ -348,16 +350,16 @@ def __init__(self, parent: QWidget, isStatus: bool) -> None:
self._addItem(key, entry["name"], entry["cols"], entry["count"])

# List Controls
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "", self)
self.addButton = NIconToolButton(self, iSz, "add")
self.addButton.clicked.connect(self._newItem)

self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "", self)
self.delButton = NIconToolButton(self, iSz, "remove")
self.delButton.clicked.connect(self._delItem)

self.upButton = QPushButton(SHARED.theme.getIcon("up"), "", self)
self.upButton = NIconToolButton(self, iSz, "up")
self.upButton.clicked.connect(lambda: self._moveItem(-1))

self.dnButton = QPushButton(SHARED.theme.getIcon("down"), "", self)
self.dnButton = NIconToolButton(self, iSz, "down")
self.dnButton.clicked.connect(lambda: self._moveItem(1))

# Edit Form
Expand All @@ -368,12 +370,12 @@ def __init__(self, parent: QWidget, isStatus: bool) -> None:

self.colPixmap = QPixmap(self.iPx, self.iPx)
self.colPixmap.fill(QColor(100, 100, 100))
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"))
self.colButton.setIconSize(self.colPixmap.rect().size())
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"), self)
self.colButton.setIconSize(bSz)
self.colButton.setEnabled(False)
self.colButton.clicked.connect(self._selectColour)

self.saveButton = QPushButton(self.tr("Save"))
self.saveButton = QPushButton(self.tr("Save"), self)
self.saveButton.setEnabled(False)
self.saveButton.clicked.connect(self._saveItem)

Expand Down Expand Up @@ -589,6 +591,8 @@ def __init__(self, parent: QWidget) -> None:

self._changed = False

iSz = SHARED.theme.baseIconSize

wCol0 = CONFIG.pxInt(
SHARED.project.options.getInt("GuiProjectSettings", "replaceColW", 130)
)
Expand All @@ -614,10 +618,10 @@ def __init__(self, parent: QWidget) -> None:
self.listBox.setSortingEnabled(True)

# List Controls
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "")
self.addButton = NIconToolButton(self, iSz, "add")
self.addButton.clicked.connect(self._addEntry)

self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "")
self.delButton = NIconToolButton(self, iSz, "remove")
self.delButton.clicked.connect(self._delEntry)

# Edit Form
Expand All @@ -630,7 +634,7 @@ def __init__(self, parent: QWidget) -> None:
self.editValue.setEnabled(False)
self.editValue.setMaxLength(80)

self.saveButton = QPushButton(self.tr("Save"))
self.saveButton = QPushButton(self.tr("Save"), self)
self.saveButton.clicked.connect(self._saveEntry)

# Assemble
Expand Down
5 changes: 3 additions & 2 deletions novelwriter/dialogs/quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

from novelwriter import CONFIG
from novelwriter.constants import trConst, nwQuotes
from novelwriter.types import QtAlignCenter, QtAlignTop

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -68,7 +69,7 @@ def __init__(self, parent: QWidget, current: str = '"') -> None:
self.previewLabel = QLabel(current)
self.previewLabel.setFont(lblFont)
self.previewLabel.setFixedSize(QSize(pxW, pxH))
self.previewLabel.setAlignment(Qt.AlignCenter)
self.previewLabel.setAlignment(QtAlignCenter)
self.previewLabel.setFrameStyle(QFrame.Box | QFrame.Plain)

# Quote Symbols
Expand All @@ -94,7 +95,7 @@ def __init__(self, parent: QWidget, current: str = '"') -> None:
self.buttonBox.rejected.connect(self.reject)

# Assemble
self.labelBox.addWidget(self.previewLabel, 0, Qt.AlignTop)
self.labelBox.addWidget(self.previewLabel, 0, QtAlignTop)
self.labelBox.addStretch(1)

self.innerBox.addLayout(self.labelBox)
Expand Down
Loading
Loading