Fix a potential segfault issue in main gui and add auto-build on open manuscript tool

This commit is contained in:
Veronica Berglyd Olsen
2024-05-25 22:43:09 +02:00
parent f11ea8d07e
commit aceb344856
2 changed files with 5 additions and 6 deletions
+2 -4
View File
@@ -800,8 +800,7 @@ class GuiMain(QMainWindow):
def showBuildManuscriptDialog(self) -> None:
"""Open the build manuscript dialog."""
if SHARED.hasProject:
if (dialog := SHARED.findTopLevelWidget(GuiManuscript)) is None:
dialog = GuiManuscript(self)
dialog = GuiManuscript(self)
dialog.activateDialog()
dialog.loadContent()
return
@@ -819,8 +818,7 @@ class GuiMain(QMainWindow):
def showWritingStatsDialog(self) -> None:
"""Open the session stats dialog."""
if SHARED.hasProject:
if (dialog := SHARED.findTopLevelWidget(GuiWritingStats)) is None:
dialog = GuiWritingStats(self)
dialog = GuiWritingStats(self)
dialog.activateDialog()
dialog.populateGUI()
return
+3 -2
View File
@@ -246,6 +246,7 @@ class GuiManuscript(NToolDialog):
self._updateBuildsList()
if selected in self._buildMap:
self.buildList.setCurrentItem(self._buildMap[selected])
QTimer.singleShot(200, self._generatePreview)
return
@@ -363,8 +364,8 @@ class GuiManuscript(NToolDialog):
def _buildManuscript(self) -> None:
"""Open the build dialog and build the manuscript."""
if build := self._getSelectedBuild():
dlgBuild = GuiManuscriptBuild(self, build)
dlgBuild.exec()
dialog = GuiManuscriptBuild(self, build)
dialog.exec()
# After the build is done, save build settings changes
if build.changed: