TreeWidget使用总结

1.
self.tree.clear()
for i in range(len(eps_shot_info)):
    first = QtGui.QTreeWidgetItem(self.tree)
    first.setExpanded(True)
    for j in range(len(node)):
        filename = node[j].knob('file').value().split('/')[-1].split('.')[0]
        eps = filename.split('_')[1]
        shot = filename.split('_')[2]
        if eps_shot_info[i].keys()[0] == eps and eps_shot_info[i].values()[0] == shot:
            first.setText(0, str(node[j].knob('name').value()))
            first.setText(3, str(node[j].knob('first').value()))
            first.setText(4, str(node[j].knob('last').value()))
            break

    first.setText(1,eps_shot_info[i].keys()[0])
    first.setText(2,eps_shot_info[i].values()[0])

2.

for i in range(len(node)):
    filename = node[i].knob('file').value().split('/')[-1].split('.')[0]
    eps = filename.split('_')[1]
    shot = filename.split('_')[2]
    for j in range(len(self.NotCreateNodeLis)):
        if self.NotCreateNodeLis[j].values()[0] == shot:
            self.shot.SelectBackdropCreateShot(self.NotCreateNodeLis[j].keys()[0],self.NotCreateNodeLis[j].values()[0],node[i])
            # self.tree.topLevelItem(1).setText(3,'11')
            row = self.tree.topLevelItemCount()
            for h in range(row):
                if self.tree.topLevelItem(h).text(0) == node[i].knob('name').value():
                    self.tree.topLevelItem(h).setText(3, 'ok')
                    QtGui.QApplication.instance().processEvents()

你可能感兴趣的:(pyqt,pyqt)