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: def showBuildManuscriptDialog(self) -> None:
"""Open the build manuscript dialog.""" """Open the build manuscript dialog."""
if SHARED.hasProject: if SHARED.hasProject:
if (dialog := SHARED.findTopLevelWidget(GuiManuscript)) is None: dialog = GuiManuscript(self)
dialog = GuiManuscript(self)
dialog.activateDialog() dialog.activateDialog()
dialog.loadContent() dialog.loadContent()
return return
@@ -819,8 +818,7 @@ class GuiMain(QMainWindow):
def showWritingStatsDialog(self) -> None: def showWritingStatsDialog(self) -> None:
"""Open the session stats dialog.""" """Open the session stats dialog."""
if SHARED.hasProject: if SHARED.hasProject:
if (dialog := SHARED.findTopLevelWidget(GuiWritingStats)) is None: dialog = GuiWritingStats(self)
dialog = GuiWritingStats(self)
dialog.activateDialog() dialog.activateDialog()
dialog.populateGUI() dialog.populateGUI()
return return
+3 -2
View File
@@ -246,6 +246,7 @@ class GuiManuscript(NToolDialog):
self._updateBuildsList() self._updateBuildsList()
if selected in self._buildMap: if selected in self._buildMap:
self.buildList.setCurrentItem(self._buildMap[selected]) self.buildList.setCurrentItem(self._buildMap[selected])
QTimer.singleShot(200, self._generatePreview)
return return
@@ -363,8 +364,8 @@ class GuiManuscript(NToolDialog):
def _buildManuscript(self) -> None: def _buildManuscript(self) -> None:
"""Open the build dialog and build the manuscript.""" """Open the build dialog and build the manuscript."""
if build := self._getSelectedBuild(): if build := self._getSelectedBuild():
dlgBuild = GuiManuscriptBuild(self, build) dialog = GuiManuscriptBuild(self, build)
dlgBuild.exec() dialog.exec()
# After the build is done, save build settings changes # After the build is done, save build settings changes
if build.changed: if build.changed: