From 351657c3d145c41c5af80b8df13dbb374c1df471 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 8 Jan 2022 15:19:49 +0800 Subject: [PATCH] bugfix --- kivyblocks/hirarchy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kivyblocks/hirarchy.py b/kivyblocks/hirarchy.py index a8b2944..59ad40f 100644 --- a/kivyblocks/hirarchy.py +++ b/kivyblocks/hirarchy.py @@ -69,7 +69,8 @@ class Hirarchy(ScrollPanel): print('selected node=', node) def node_selected(self, o, v): - self.dispatch('on_press', o.selected_node) + if selected_node: + self.dispatch('on_press', o.selected_node) def collapse_others(self, node): for n in self.tree.iterate_open_nodes(node=node.parent_node): @@ -137,6 +138,7 @@ class Menu(Hirarchy): super(Menu, self).__init__(**kw) def on_press(self, node): + self.selected_node = None data = {} dw = node.data.get('datawidget') if dw: