Skip to content

Commit

Permalink
Tree right click fix (#34)
Browse files Browse the repository at this point in the history
* Fixes #33: When right clicking a tree element, its content is displayed

* Collapsing an element now makes sure that the selection matches the content panel
  • Loading branch information
Futsch1 authored Dec 29, 2020
1 parent 793780f commit 72be315
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion asn1editor/wxPython/TreeView.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ def __init__(self, parent):
self.collapse = self.Append(wx.NewId(), 'Collapse')
self.collapse_all = self.Append(wx.NewId(), 'Collapse all')

self.item_selected(e)

menu = RightClickMenu(self.__tree_ctrl.GetTopLevelParent())
menu.Bind(wx.EVT_MENU, lambda _: self.__tree_ctrl.ExpandAllChildren(e.GetItem()), menu.expand)
menu.Bind(wx.EVT_MENU, lambda _: self.__tree_ctrl.ExpandAll(), menu.expand_all)
menu.Bind(wx.EVT_MENU, lambda _: self.__tree_ctrl.CollapseAllChildren(e.GetItem()), menu.collapse)
menu.Bind(wx.EVT_MENU, lambda _: (self.__tree_ctrl.CollapseAllChildren(e.GetItem()),
self.__show_view(self.__tree_ctrl.GetItemData(self.__tree_ctrl.GetSelection()))), menu.collapse)
menu.Bind(wx.EVT_MENU, lambda _: (self.__tree_ctrl.CollapseAll(), self.__show_view(None)), menu.collapse_all)
self.__tree_ctrl.GetTopLevelParent().PopupMenu(menu, e.GetPoint())

Expand Down

0 comments on commit 72be315

Please sign in to comment.