Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release 6.0.0: Show 404 message instead of regen #3131

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
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
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
Loading