Tree Element - no longer puts an entry for the Root node (mimics tkinter)
This commit is contained in:
parent
29eb1fe47b
commit
9ca72f32ed
|
@ -5393,19 +5393,22 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
# treeview.column(heading, width=width * CharWidthInPixels(), anchor=anchor)
|
# treeview.column(heading, width=width * CharWidthInPixels(), anchor=anchor)
|
||||||
def add_treeview_data(node, widget):
|
def add_treeview_data(node, widget):
|
||||||
# print(f'Inserting {node.key} under parent {node.parent}')
|
# print(f'Inserting {node.key} under parent {node.parent}')
|
||||||
child = QTreeWidgetItem(widget)
|
if node != element.TreeData.root_node:
|
||||||
if node.key != '':
|
child = QTreeWidgetItem(widget)
|
||||||
child.setText(0, str(node.text))
|
child.setText(0, str(node.text))
|
||||||
# child.setData(0,0,node.values)
|
else:
|
||||||
if type(node.icon) is bytes:
|
child = widget
|
||||||
ba = QtCore.QByteArray.fromBase64(node.icon)
|
# if node.key != '':
|
||||||
pixmap = QtGui.QPixmap()
|
# child.setData(0,0,node.values)
|
||||||
pixmap.loadFromData(ba)
|
if type(node.icon) is bytes:
|
||||||
qicon = QIcon(pixmap)
|
ba = QtCore.QByteArray.fromBase64(node.icon)
|
||||||
child.setIcon(0, qicon)
|
pixmap = QtGui.QPixmap()
|
||||||
elif node.icon is not None:
|
pixmap.loadFromData(ba)
|
||||||
qicon = QIcon(node.icon)
|
qicon = QIcon(pixmap)
|
||||||
child.setIcon(0, qicon)
|
child.setIcon(0, qicon)
|
||||||
|
elif node.icon is not None:
|
||||||
|
qicon = QIcon(node.icon)
|
||||||
|
child.setIcon(0, qicon)
|
||||||
|
|
||||||
for node in node.children:
|
for node in node.children:
|
||||||
add_treeview_data(node, child)
|
add_treeview_data(node, child)
|
||||||
|
|
Loading…
Reference in New Issue