Skip to content

Commit

Permalink
Entity Tree: Fix right-click on non-URL node to show contextual menu
Browse files Browse the repository at this point in the history
Fixes #94
  • Loading branch information
davidfstr committed Jan 28, 2024
1 parent 1cf1ad7 commit 105e7f5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/crystal/browser/entitytree.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@ def on_right_click(self, event, node_view: NodeView) -> None:
menu.Append(_ID_CLEAR_PREFIX, 'Clear Default URL Prefix')
else:
menu.Append(_ID_SET_PREFIX, 'Set As Default URL Prefix')
else:
menu.Append(_ID_SET_PREFIX, 'Set As Default URL Prefix')
menu.Enable(_ID_SET_PREFIX, False)

# Show popup menu
if menu.GetMenuItemCount() > 0:
if os.environ.get('CRYSTAL_RUNNING_TESTS', 'False') == 'False':
self.peer.PopupMenu(menu, event.GetPoint())
else:
print('(Suppressing popup menu while CRYSTAL_RUNNING_TESTS=True)')
assert menu.GetMenuItemCount() > 0
if os.environ.get('CRYSTAL_RUNNING_TESTS', 'False') == 'False':
self.peer.PopupMenu(menu, event.GetPoint())
else:
print('(Suppressing popup menu while CRYSTAL_RUNNING_TESTS=True)')
menu.Destroy()

def _on_popup_menuitem_selected(self, event):
Expand Down

0 comments on commit 105e7f5

Please sign in to comment.