Drop all mappings of config object into classes now that tests don't need that

This commit is contained in:
Veronica Berglyd Olsen
2023-05-16 23:00:30 +02:00
parent 7f8ffb228e
commit 324b204eaa
39 changed files with 578 additions and 638 deletions
+8 -8
View File
@@ -26,7 +26,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import logging
import novelwriter
from PyQt5.QtGui import QColor, QPalette, QPainter
from PyQt5.QtCore import (
@@ -38,6 +37,7 @@ from PyQt5.QtWidgets import (
QStyleOptionTab, QLineEdit
)
from novelwriter import CONFIG
from novelwriter.constants import nwUnicode
logger = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ class QConfigLayout(QGridLayout):
self._itemMap = {}
wSp = novelwriter.CONFIG.pxInt(8)
wSp = CONFIG.pxInt(8)
self.setHorizontalSpacing(wSp)
self.setVerticalSpacing(wSp)
self.setColumnStretch(0, 1)
@@ -108,7 +108,7 @@ class QConfigLayout(QGridLayout):
qLabel = None
raise ValueError("theLabel must be a QLabel")
hM = novelwriter.CONFIG.pxInt(4)
hM = CONFIG.pxInt(4)
qLabel.setContentsMargins(0, hM, 0, hM)
self.addWidget(qLabel, self._nextRow, 0, 1, 2, Qt.AlignLeft)
@@ -142,7 +142,7 @@ class QConfigLayout(QGridLayout):
qWidget = None
raise ValueError("theWidget must be a QWidget")
wSp = novelwriter.CONFIG.pxInt(8)
wSp = CONFIG.pxInt(8)
qLabel.setIndent(wSp)
if helpText is not None:
qHelp = QHelpLabel(str(helpText), self._helpCol, self._fontScale)
@@ -235,18 +235,18 @@ class QSwitch(QAbstractButton):
super().__init__(parent=parent)
if width is None:
self._xW = novelwriter.CONFIG.pxInt(40)
self._xW = CONFIG.pxInt(40)
else:
self._xW = width
if height is None:
self._xH = novelwriter.CONFIG.pxInt(20)
self._xH = CONFIG.pxInt(20)
else:
self._xH = height
self._xR = int(self._xH*0.5)
self._xT = int(self._xH*0.6)
self._rB = int(novelwriter.CONFIG.guiScale*2)
self._rB = int(CONFIG.guiScale*2)
self._rH = self._xH - 2*self._rB
self._rR = self._xR - self._rB
@@ -434,7 +434,7 @@ class VerticalTabBar(QTabBar):
def __init__(self, parent=None):
super().__init__(parent=parent)
self._mW = novelwriter.CONFIG.pxInt(150)
self._mW = CONFIG.pxInt(150)
return
def tabSizeHint(self, index):