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

fix: gui - highlight source code when selecting opcode #1512

Merged

Conversation

kacperzuk
Copy link
Contributor

What I did

I fixed the following exception that happens when clicking opcode in right pane:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/kaz/.local/pipx/venvs/eth-brownie/lib/python3.9/site-packages/brownie/_gui/opcodes.py", line 121, in _select_bind
    note.set_active(pcMap["path"])
  File "/home/kaz/.local/pipx/venvs/eth-brownie/lib/python3.9/site-packages/brownie/_gui/source.py", line 84, in set_active
    self.select(self.get_frame(label))
  File "/home/kaz/.local/pipx/venvs/eth-brownie/lib/python3.9/site-packages/brownie/_gui/source.py", line 50, in get_frame
    return next(i for i in self._frames if i._label == label)
StopIteration

How I did it

Opcode on-click callback (_select_bind in opcodes.py) passes pcMap["path"] (which is an integer index) to SourceNoteBook.set_active to show source code. SourceNoteBook.set_active expects a label to be passed though, which is a string path to source file. I've changed the _select_bind to pass proper label instead of index.

How to verify it

I believe GUI has no tests, so you need to run it manually and click an opcode.

Checklist

  • [N] I have confirmed that my PR passes all linting checks - No, I'm getting mypy issues unrelated to my changes.
  • [N] I have included test cases - No, this it not a new feature, it's a fix.
  • [N] I have updated the documentation - ditto.
  • [N] I have added an entry to the changelog. - No, what's the guideline here? It's not described in CONTRIBUTING.md

@iamdefinitelyahuman iamdefinitelyahuman merged commit 2a727cf into eth-brownie:master May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants