Skip to content

Commit

Permalink
more fixes from edge [skip-edge]
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Jan 9, 2024
1 parent 19dfc91 commit f60630a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Tools/HolocronToolset/src/toolset/gui/windows/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def displayFile(self, filepath: os.PathLike | str) -> None:
filepath = Path.pathify(filepath)
try:
text = decode_bytes_with_fallbacks(BinaryReader.load_file(filepath))
html = markdown.markdown(text, extensions=["tables", "fenced_code", "codehilite"]) if filepath.endswith(".md") else text
html = markdown.markdown(text, extensions=["tables", "fenced_code", "codehilite"]) if filepath.suffix.lower() == ".md" else text
self.ui.textDisplay.setHtml(html)
except OSError:
QMessageBox(
Expand Down
20 changes: 15 additions & 5 deletions Tools/HolocronToolset/src/toolset/gui/windows/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,26 @@ def onOverrideFileUpdated(self, changedFile: str, eventType: str) -> None:
def onOverrideChanged(self, newDirectory: str) -> None:
self.ui.overrideWidget.setResources(self.active.override_resources(newDirectory))

def onOverrideReload(self, file: str) -> None:
def onOverrideReload(self, file: str):
file_path = Path(file)
if not file_path.name:
print(f"Cannot reload '{file}': no file loaded")
return
if not file_path.is_relative_to(self.active.override_path()):
print(f"{file_path!s} is not relative to the override folder, cannot reload")
print(f"{file_path} is not relative to the override folder, cannot reload")
return
self.active.reload_override_file(file_path)
self.ui.overrideWidget.setResources(self.active.override_resources(str(file_path.parent)))
if file_path.is_file():
self.active.reload_override_file(file_path)
folder_path = file_path.parent
else:
folder_path = file_path
self.ui.overrideWidget.setResources(
self.active.override_resources(
Path._fix_path_formatting(str(folder_path.relative_to(self.active.override_path())).replace(str(self.active.override_path()), ""))
if folder_path not in self.active.override_path().parents
else "."
)
)

def onOverrideRefresh(self) -> None:
self.refreshOverrideList()
Expand Down Expand Up @@ -333,7 +343,7 @@ def dragEnterEvent(self, e: QtGui.QDragEnterEvent | None) -> None:
if e.mimeData().hasUrls():
for url in e.mimeData().urls():
with suppress(Exception):
_resref, restype = ResourceIdentifier.from_path(url.toLocalFile()).validate()
_resref, _restype = ResourceIdentifier.from_path(url.toLocalFile()).validate()
e.accept()

# endregion
Expand Down

0 comments on commit f60630a

Please sign in to comment.