Skip to content

Commit

Permalink
Merge pull request #2864 from SasView/2855-save-cusotm-model-error
Browse files Browse the repository at this point in the history
The noted fixes that are still needed have been recorded in issue #2869. This PR now has both a mac and PC testing and review and approvals so going ahead and merging
  • Loading branch information
butlerpd authored May 3, 2024
2 parents 5ead04c + 87ff8c1 commit 199dbfa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/sas/qtgui/Utilities/TabbedModelEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, parent=None, edit_only=False, model=False, load_file=None):
# globals
self.filename = ""
self.is_python = True
self.is_documentation = False
self.window_title = self.windowTitle()
self.edit_only = edit_only
self.load_file = load_file.lstrip("//") if load_file else None
Expand Down Expand Up @@ -149,6 +150,7 @@ def onLoad(self, at_launch=False):
else:
filename = MAIN_DOC_SRC / self.load_file.replace(".html", ".rst")
self.is_python = False
self.is_documentation = True
else:
plugin_location = models.find_plugins_dir()
filename = QtWidgets.QFileDialog.getOpenFileName(
Expand Down Expand Up @@ -192,7 +194,7 @@ def loadFile(self, filename):
self.tabWidget.setTabText(0, display_name)

# Check the validity of loaded model if the model is python
if self.is_python is True:
if self.is_python:
error_line = self.checkModel(plugin_text)
if error_line > 0:
# select bad line
Expand Down Expand Up @@ -459,13 +461,17 @@ def updateFromEditor(self):
msg = str(filename) + " successfully saved."
self.parent.communicate.statusBarUpdateSignal.emit(msg)
logging.info(msg)
self.regenerateDocumentation()
if self.is_documentation:
self.regenerateDocumentation()

def regenerateDocumentation(self):
"""
Defer to subprocess the documentation regeneration process
"""
if self.parent.helpWindow:
# TODO: Move the doc regen methods out of the documentation window - this forces the window to remain open
# in order for the documentation regeneration process to run.
# The regen method is part of the documentation window. If the window is closed, the method no longer exists.
if hasattr(self.parent, 'helpWindow'):
self.parent.helpWindow.regenerateHtml(self.filename)

def canWriteModel(self, model=None, full_path=""):
Expand Down

0 comments on commit 199dbfa

Please sign in to comment.