Add a custom widgets subpackage

This commit is contained in:
Veronica Berglyd Olsen
2023-02-21 16:06:41 +01:00
parent 06407a44d3
commit 7a60d8d867
16 changed files with 677 additions and 554 deletions
+15 -15
View File
@@ -46,11 +46,11 @@ from PyQt5.QtPrintSupport import QPrinter, QPrintPreviewDialog
from novelwriter.enum import nwAlert, nwItemType, nwItemLayout, nwItemClass
from novelwriter.error import formatException, logException
from novelwriter.common import fuzzyTime, makeFileNameSafe
from novelwriter.custom import QSwitch
from novelwriter.constants import nwConst, nwFiles
from novelwriter.core.tomd import ToMarkdown
from novelwriter.core.toodt import ToOdt
from novelwriter.core.tohtml import ToHtml
from novelwriter.custom.switch import NSwitch
logger = logging.getLogger(__name__)
@@ -174,12 +174,12 @@ class GuiBuildNovel(QDialog):
if langIdx != -1:
self.buildLang.setCurrentIndex(langIdx)
self.hideScene = QSwitch(width=wS, height=hS)
self.hideScene = NSwitch(width=wS, height=hS)
self.hideScene.setChecked(
pOptions.getBool("GuiBuildNovel", "hideScene", False)
)
self.hideSection = QSwitch(width=wS, height=hS)
self.hideSection = NSwitch(width=wS, height=hS)
self.hideSection.setChecked(
pOptions.getBool("GuiBuildNovel", "hideSection", True)
)
@@ -291,12 +291,12 @@ class GuiBuildNovel(QDialog):
self.styleForm = QGridLayout(self)
self.styleGroup.setLayout(self.styleForm)
self.justifyText = QSwitch(width=wS, height=hS)
self.justifyText = NSwitch(width=wS, height=hS)
self.justifyText.setChecked(
pOptions.getBool("GuiBuildNovel", "justifyText", False)
)
self.noStyling = QSwitch(width=wS, height=hS)
self.noStyling = NSwitch(width=wS, height=hS)
self.noStyling.setChecked(
pOptions.getBool("GuiBuildNovel", "noStyling", False)
)
@@ -316,22 +316,22 @@ class GuiBuildNovel(QDialog):
self.textForm = QGridLayout(self)
self.textGroup.setLayout(self.textForm)
self.includeSynopsis = QSwitch(width=wS, height=hS)
self.includeSynopsis = NSwitch(width=wS, height=hS)
self.includeSynopsis.setChecked(
pOptions.getBool("GuiBuildNovel", "incSynopsis", False)
)
self.includeComments = QSwitch(width=wS, height=hS)
self.includeComments = NSwitch(width=wS, height=hS)
self.includeComments.setChecked(
pOptions.getBool("GuiBuildNovel", "incComments", False)
)
self.includeKeywords = QSwitch(width=wS, height=hS)
self.includeKeywords = NSwitch(width=wS, height=hS)
self.includeKeywords.setChecked(
pOptions.getBool("GuiBuildNovel", "incKeywords", False)
)
self.includeBody = QSwitch(width=wS, height=hS)
self.includeBody = NSwitch(width=wS, height=hS)
self.includeBody.setChecked(
pOptions.getBool("GuiBuildNovel", "incBodyText", True)
)
@@ -371,7 +371,7 @@ class GuiBuildNovel(QDialog):
rootLabel = QLabel(nwItem.itemName)
rootLabel.setWordWrap(True)
rootValue = QSwitch(width=wS, height=hS)
rootValue = NSwitch(width=wS, height=hS)
rootValue.setChecked(tHandle not in rootFilter)
self.rootSelection[tHandle] = rootValue
@@ -390,17 +390,17 @@ class GuiBuildNovel(QDialog):
self.fileForm = QGridLayout(self)
self.fileGroup.setLayout(self.fileForm)
self.novelFiles = QSwitch(width=wS, height=hS)
self.novelFiles = NSwitch(width=wS, height=hS)
self.novelFiles.setChecked(
pOptions.getBool("GuiBuildNovel", "addNovel", True)
)
self.noteFiles = QSwitch(width=wS, height=hS)
self.noteFiles = NSwitch(width=wS, height=hS)
self.noteFiles.setChecked(
pOptions.getBool("GuiBuildNovel", "addNotes", False)
)
self.ignoreFlag = QSwitch(width=wS, height=hS)
self.ignoreFlag = NSwitch(width=wS, height=hS)
self.ignoreFlag.setChecked(
pOptions.getBool("GuiBuildNovel", "ignoreFlag", False)
)
@@ -426,12 +426,12 @@ class GuiBuildNovel(QDialog):
self.exportForm = QGridLayout(self)
self.exportGroup.setLayout(self.exportForm)
self.replaceTabs = QSwitch(width=wS, height=hS)
self.replaceTabs = NSwitch(width=wS, height=hS)
self.replaceTabs.setChecked(
pOptions.getBool("GuiBuildNovel", "replaceTabs", False)
)
self.replaceUCode = QSwitch(width=wS, height=hS)
self.replaceUCode = NSwitch(width=wS, height=hS)
self.replaceUCode.setChecked(
pOptions.getBool("GuiBuildNovel", "replaceUCode", False)
)
+2 -2
View File
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import (
)
from novelwriter.common import readTextFile
from novelwriter.custom import QSwitch
from novelwriter.custom.switch import NSwitch
logger = logging.getLogger(__name__)
@@ -78,7 +78,7 @@ class GuiLipsum(QDialog):
self.paraCount.setValue(5)
self.randLabel = QLabel(self.tr("Randomise order"))
self.randSwitch = QSwitch()
self.randSwitch = NSwitch()
self.formBox = QGridLayout()
self.formBox.addWidget(self.headLabel, 0, 0, 1, 2, Qt.AlignLeft)
+5 -5
View File
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import (
)
from novelwriter.common import makeFileNameSafe
from novelwriter.custom import QSwitch
from novelwriter.custom.switch import NSwitch
logger = logging.getLogger(__name__)
@@ -328,19 +328,19 @@ class ProjWizardCustomPage(QWizardPage):
fS = self.mainConf.pxInt(4)
# Root Folders
self.addPlot = QSwitch()
self.addPlot = NSwitch()
self.addPlot.setChecked(True)
self.addPlot.clicked.connect(self._syncSwitches)
self.addChar = QSwitch()
self.addChar = NSwitch()
self.addChar.setChecked(True)
self.addChar.clicked.connect(self._syncSwitches)
self.addWorld = QSwitch()
self.addWorld = NSwitch()
self.addWorld.setChecked(False)
self.addWorld.clicked.connect(self._syncSwitches)
self.addNotes = QSwitch()
self.addNotes = NSwitch()
self.addNotes.setChecked(False)
# Generate Content
+7 -7
View File
@@ -40,8 +40,8 @@ from PyQt5.QtWidgets import (
from novelwriter.enum import nwAlert
from novelwriter.error import formatException
from novelwriter.common import formatTime, checkInt, checkIntTuple, minmax
from novelwriter.custom import QSwitch
from novelwriter.constants import nwConst, nwFiles
from novelwriter.custom.switch import NSwitch
logger = logging.getLogger(__name__)
@@ -190,37 +190,37 @@ class GuiWritingStats(QDialog):
self.filterForm = QGridLayout(self)
self.filterBox.setLayout(self.filterForm)
self.incNovel = QSwitch(width=2*sPx, height=sPx)
self.incNovel = NSwitch(width=2*sPx, height=sPx)
self.incNovel.setChecked(
pOptions.getBool("GuiWritingStats", "incNovel", True)
)
self.incNovel.clicked.connect(self._updateListBox)
self.incNotes = QSwitch(width=2*sPx, height=sPx)
self.incNotes = NSwitch(width=2*sPx, height=sPx)
self.incNotes.setChecked(
pOptions.getBool("GuiWritingStats", "incNotes", True)
)
self.incNotes.clicked.connect(self._updateListBox)
self.hideZeros = QSwitch(width=2*sPx, height=sPx)
self.hideZeros = NSwitch(width=2*sPx, height=sPx)
self.hideZeros.setChecked(
pOptions.getBool("GuiWritingStats", "hideZeros", True)
)
self.hideZeros.clicked.connect(self._updateListBox)
self.hideNegative = QSwitch(width=2*sPx, height=sPx)
self.hideNegative = NSwitch(width=2*sPx, height=sPx)
self.hideNegative.setChecked(
pOptions.getBool("GuiWritingStats", "hideNegative", False)
)
self.hideNegative.clicked.connect(self._updateListBox)
self.groupByDay = QSwitch(width=2*sPx, height=sPx)
self.groupByDay = NSwitch(width=2*sPx, height=sPx)
self.groupByDay.setChecked(
pOptions.getBool("GuiWritingStats", "groupByDay", False)
)
self.groupByDay.clicked.connect(self._updateListBox)
self.showIdleTime = QSwitch(width=2*sPx, height=sPx)
self.showIdleTime = NSwitch(width=2*sPx, height=sPx)
self.showIdleTime.setChecked(
pOptions.getBool("GuiWritingStats", "showIdleTime", False)
)