Revert last changes, but keep code improvements

This commit is contained in:
Veronica Berglyd Olsen
2024-04-13 00:03:08 +02:00
parent a43c351e25
commit 95d91562ec
2 changed files with 1 additions and 36 deletions
+1 -30
View File
@@ -48,7 +48,7 @@ from novelwriter.core.tohtml import ToHtml
from novelwriter.core.tokenizer import HeadingFormatter from novelwriter.core.tokenizer import HeadingFormatter
from novelwriter.error import logException from novelwriter.error import logException
from novelwriter.extensions.circularprogress import NProgressCircle from novelwriter.extensions.circularprogress import NProgressCircle
from novelwriter.extensions.modified import NComboBox, NIconToggleButton, NIconToolButton from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton
from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
from novelwriter.tools.manusbuild import GuiManuscriptBuild from novelwriter.tools.manusbuild import GuiManuscriptBuild
from novelwriter.tools.manussettings import GuiBuildSettings from novelwriter.tools.manussettings import GuiBuildSettings
@@ -91,8 +91,6 @@ class GuiManuscript(QDialog):
self.setMinimumHeight(CONFIG.pxInt(500)) self.setMinimumHeight(CONFIG.pxInt(500))
iSz = SHARED.theme.baseIconSize iSz = SHARED.theme.baseIconSize
sPx = CONFIG.pxInt(12)
bPx = CONFIG.pxInt(4)
wWin = CONFIG.pxInt(900) wWin = CONFIG.pxInt(900)
hWin = CONFIG.pxInt(600) hWin = CONFIG.pxInt(600)
@@ -169,22 +167,6 @@ class GuiManuscript(QDialog):
CONFIG.pxInt(pOptions.getInt("GuiManuscript", "detailsHeight", 50)), CONFIG.pxInt(pOptions.getInt("GuiManuscript", "detailsHeight", 50)),
]) ])
# Build Language
# ==============
projLang = SHARED.project.data.language or CONFIG.guiLocale
self.buildLanguage = NComboBox(self)
# self.projLang.setMinimumWidth(xW)
for tag, language in CONFIG.listLanguages(CONFIG.LANG_PROJ):
self.buildLanguage.addItem(language, tag)
self.buildLanguage.setCurrentData(projLang, projLang)
self.buildLanguage.currentIndexChanged.connect(self._updateBuildLanguage)
self.languageBox = QHBoxLayout()
self.languageBox.addWidget(QLabel(self.tr("Build Language"), self), 0)
self.languageBox.addWidget(self.buildLanguage, 1)
self.languageBox.setContentsMargins(0, 0, 0, 0)
# Process Controls # Process Controls
# ================ # ================
@@ -205,7 +187,6 @@ class GuiManuscript(QDialog):
self.processBox.addWidget(self.btnPrint, 0, 1) self.processBox.addWidget(self.btnPrint, 0, 1)
self.processBox.addWidget(self.btnBuild, 1, 0) self.processBox.addWidget(self.btnBuild, 1, 0)
self.processBox.addWidget(self.btnClose, 1, 1) self.processBox.addWidget(self.btnClose, 1, 1)
self.processBox.setSpacing(bPx)
# Assemble GUI # Assemble GUI
# ============ # ============
@@ -224,10 +205,8 @@ class GuiManuscript(QDialog):
self.controlBox = QVBoxLayout() self.controlBox = QVBoxLayout()
self.controlBox.addLayout(self.listToolBox, 0) self.controlBox.addLayout(self.listToolBox, 0)
self.controlBox.addWidget(self.buildSplit, 1) self.controlBox.addWidget(self.buildSplit, 1)
self.controlBox.addLayout(self.languageBox, 0)
self.controlBox.addLayout(self.processBox, 0) self.controlBox.addLayout(self.processBox, 0)
self.controlBox.setContentsMargins(0, 0, 0, 0) self.controlBox.setContentsMargins(0, 0, 0, 0)
self.controlBox.setSpacing(sPx)
self.optsWidget = QWidget(self) self.optsWidget = QWidget(self)
self.optsWidget.setLayout(self.controlBox) self.optsWidget.setLayout(self.controlBox)
@@ -344,14 +323,6 @@ class GuiManuscript(QDialog):
self._updateBuildsList() self._updateBuildsList()
return return
@pyqtSlot(int)
def _updateBuildLanguage(self, index: int) -> None:
"""Update the build language on user selection."""
SHARED.project.setProjectLang(self.buildLanguage.currentData())
if build := self._getSelectedBuild():
self.buildDetails.updateInfo(build)
return
@pyqtSlot(BuildSettings) @pyqtSlot(BuildSettings)
def _processNewSettings(self, build: BuildSettings) -> None: def _processNewSettings(self, build: BuildSettings) -> None:
"""Process new build settings from the settings dialog.""" """Process new build settings from the settings dialog."""
@@ -141,12 +141,6 @@ def testManuscript_Builds(qtbot: QtBot, nwGUI: GuiMain, projPath: Path):
assert build.name == "Test Build" assert build.name == "Test Build"
assert manus.buildList.count() == 1 assert manus.buildList.count() == 1
# Changing language should also update project language
manus.buildLanguage.setCurrentData("de_DE", "de_DE")
assert SHARED.project.data.language == "de_DE"
manus.buildLanguage.setCurrentData("en_GB", "en_GB")
assert SHARED.project.data.language == "en_GB"
# Close the dialog should also close the child dialogs # Close the dialog should also close the child dialogs
manus.btnClose.click() manus.btnClose.click()
if isinstance(bSettings, GuiBuildSettings): if isinstance(bSettings, GuiBuildSettings):