Merge pull request #594 from MikeTheWatchGuy/Dev-latest

Update method for Tree Elements... gnats.. these users are like gnats
This commit is contained in:
MikeTheWatchGuy 2018-10-29 16:27:32 -04:00 committed by GitHub
commit 322214a4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -2558,6 +2558,27 @@ class Tree(Element):
if self.ParentForm.CurrentlyRunningMainloop:
self.ParentForm.TKroot.quit()
def add_treeview_data(self, node):
# print(f'Inserting {node.key} under parent {node.parent}')
if node.key != '':
self.TKTreeview.insert(node.parent, 'end', node.key, text=node.text, values=node.values,
open=self.ShowExpanded)
for node in node.children:
self.add_treeview_data(node)
def Update(self, values=None):
if values is None:
return
children = self.TKTreeview.get_children()
for i in children:
self.TKTreeview.detach(i)
self.TKTreeview.delete(i)
children = self.TKTreeview.get_children()
self.TreeData = values
self.add_treeview_data(self.TreeData.root_node)
self.SelectedRows = []
def __del__(self):
super().__del__()