diff --git a/brownie/_gui/report.py b/brownie/_gui/report.py index 563351803..c0a55a7a7 100755 --- a/brownie/_gui/report.py +++ b/brownie/_gui/report.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -from pathlib import Path +import warnings from .bases import SelectBox @@ -58,8 +58,11 @@ def _select(self, event): return report = self.root.active_report[value][contract] for path, (start, stop, color, msg) in [(k, x) for k, v in report.items() for x in v]: - label = Path(path).name - self.note.mark(label, color, start, stop, msg) + label = self.root.pathMap[path] + try: + self.note.mark(label, color, start, stop, msg) + except StopIteration: + warnings.warn(f"Report contains data for an unknown contract: {label}") def toggle_off(self): self.root.highlight_key = None diff --git a/brownie/_gui/root.py b/brownie/_gui/root.py index fb654af2a..9cc7fd952 100755 --- a/brownie/_gui/root.py +++ b/brownie/_gui/root.py @@ -72,8 +72,9 @@ def set_active_contract(self, contract_name): self.main.note.set_active(build_json["sourcePath"]) self.main.oplist.set_opcodes(build_json["pcMap"]) self.pcMap = dict((str(k), v) for k, v in build_json["pcMap"].items()) + self.pathMap = build_json["allSourcePaths"] for value in (v for v in self.pcMap.values() if "path" in v): - value["path"] = build_json["allSourcePaths"][value["path"]] + value["path"] = self.pathMap[value["path"]] def destroy(self): super().destroy()