Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

2855: Fix model save error #2864

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading