Skip to content

Commit

Permalink
Merge pull request #3131 from SasView/mac-help-files-fix
Browse files Browse the repository at this point in the history
Release 6.0.0: Show 404 message instead of regen
  • Loading branch information
krzywon authored Oct 24, 2024
2 parents 4cc7904 + 0d887e0 commit 2e519c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 7 additions & 4 deletions src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1888,10 +1888,8 @@ def onHelp(self):
"""
Show the "Fitting" section of help
"""
regen_in_progress = False
help_location = self.getHelpLocation(HELP_DIRECTORY_LOCATION)
if regen_in_progress is False:
self.parent.showHelp(help_location)
self.parent.showHelp(help_location)

def getHelpLocation(self, tree_base) -> Path:
# Actual file will depend on the current tab
Expand All @@ -1901,7 +1899,12 @@ def getHelpLocation(self, tree_base) -> Path:
match tab_id:
case 0:
# Look at the model and if set, pull out its help page
if self.kernel_module is not None and hasattr(self.kernel_module, 'name'):
# TODO: Disable plugin model documentation generation until issues can be resolved
plugin_names = [name for name, enabled in self.master_category_dict[CATEGORY_CUSTOM]]
if (self.kernel_module is not None
and hasattr(self.kernel_module, 'name')
and self.kernel_module.id not in plugin_names
and not re.match("[A-Za-z0-9_-]+[+*@][A-Za-z0-9_-]+", self.kernel_module.id)):
tree_location = tree_base / "user" / "models"
return tree_location / f"{self.kernel_module.id}.html"
else:
Expand Down
12 changes: 6 additions & 6 deletions src/sas/qtgui/Utilities/DocViewWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ def regenerateIfNeeded(self):
self.regenerateHtml(self.source.name)

# Test to see if HTML does not exist or is older than python file
elif self.newer(self.source, url_str):
self.regenerateHtml(self.source.name)
elif not os.path.exists(url_str):
self.load404()
# Regenerate RST then HTML if no model file found OR if HTML is older than equivalent .py

elif "index" in url_str:
# Regenerate if HTML is older than RST -- for index.html, which gets passed in differently because it is located in a different folder
regen_string = rst_path / str(self.source.name).replace(".html", ".rst")
# Test to see if HTML does not exist or is older than python file
if self.newer(regen_string, self.source.absolute()):
self.regenerateHtml(regen_string)
if not os.path.exists(self.source.absolute()):
self.load404()

else:
# Regenerate if HTML is older than RST
Expand All @@ -199,8 +199,8 @@ def regenerateIfNeeded(self):
html_path = html_path / model_local_path.split('#')[0] # Remove jump links
regen_string = rst_path / model_local_path.replace('.html', '.rst').split('#')[0] #Remove jump links
# Test to see if HTML does not exist or is older than python file
if self.newer(regen_string, html_path):
self.regenerateHtml(regen_string)
if not os.path.exists(html_path):
self.load404()

if self.regen_in_progress is False:
self.loadHtml() #loads the html file specified in the source url to the QWebViewer
Expand Down

0 comments on commit 2e519c4

Please sign in to comment.