Python PySide.QtGui 模块,QTreeWidgetItem() 实例源码

我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用PySide.QtGui.QTreeWidgetItem()

项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def refreshList(self, dbFilter=None):
        self.clear()
        listHeader = self.headerItem()

        data = "rowid,"
        for i in range(1,listHeader.columnCount()):
            data += listHeader.text(i)
            if i<listHeader.columnCount()-1:
                data += ","

        conn = sqlite3.connect(self.database)
        conn.row_factory = sqlite3.Row
        if dbFilter == None:
            jobList = conn.execute("SELECT %s FROM %s"%(data,self.listType)).fetchall()
        else:
            jobList = conn.execute("SELECT %s FROM %s WHERE %s"%(data,self.listType,dbFilter)).fetchall()

        for item in jobList:
            t = QtGui.QTreeWidgetItem(self)
            for i,h in enumerate(jobList[0].keys()):
                try:
                    t.setText(i,str(item[h]))
                except:
                    pass
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def DataToTree(self, tree, cur_node, data, filter=''):
        node_info = data[0]
        node_info_child = data[1]
        [cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
        target = re.compile(filter, re.IGNORECASE)
        for sub_data in node_info_child:
            if filter == '':
                new_node = QtWidgets.QTreeWidgetItem()
                cur_node.addChild(new_node)
                self.DataToTree(tree, new_node, sub_data)
            else:
                if not target.search(sub_data[0][0]) and not self.DataChildCheck(sub_data[1], filter):
                    pass
                else:
                    new_node = QtWidgets.QTreeWidgetItem()
                    cur_node.addChild(new_node)
                    new_node.setExpanded(1)
                    self.DataToTree(tree, new_node, sub_data, filter)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def DataToTree_old_2LevelSearch(self, tree, cur_node, data, filter=''):
        node_info = data[0]
        node_info_child = data[1]
        [cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
        target = re.compile(filter, re.IGNORECASE)
        for sub_data in node_info_child:
            if filter == '':
                new_node = QtWidgets.QTreeWidgetItem()
                cur_node.addChild(new_node)
                self.DataToTree(tree, new_node, sub_data)
            else:
                if not target.search(sub_data[0][0]) and len(sub_data[1]) == 0:
                    #print(sub_data[0][0]) print(sub_data[1])
                    pass    
                else:
                    new_node = QtWidgets.QTreeWidgetItem()
                    cur_node.addChild(new_node)
                    new_node.setExpanded(1)
                    self.DataToTree(tree, new_node, sub_data, filter)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def DataToTree(self, tree, cur_node, data, filter=''):
        node_info = data[0]
        node_info_child = data[1]
        [cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
        target = re.compile(filter, re.IGNORECASE)
        for sub_data in node_info_child:
            if filter == '':
                new_node = QtWidgets.QTreeWidgetItem()
                cur_node.addChild(new_node)
                self.DataToTree(tree, new_node, sub_data)
            else:
                if not target.search(sub_data[0][0]) and not self.DataChildCheck(sub_data[1], filter):
                    pass
                else:
                    new_node = QtWidgets.QTreeWidgetItem()
                    cur_node.addChild(new_node)
                    new_node.setExpanded(1)
                    self.DataToTree(tree, new_node, sub_data, filter)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def DataToTree_old_2LevelSearch(self, tree, cur_node, data, filter=''):
        node_info = data[0]
        node_info_child = data[1]
        [cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
        target = re.compile(filter, re.IGNORECASE)
        for sub_data in node_info_child:
            if filter == '':
                new_node = QtWidgets.QTreeWidgetItem()
                cur_node.addChild(new_node)
                self.DataToTree(tree, new_node, sub_data)
            else:
                if not target.search(sub_data[0][0]) and len(sub_data[1]) == 0:
                    #print(sub_data[0][0]) print(sub_data[1])
                    pass    
                else:
                    new_node = QtWidgets.QTreeWidgetItem()
                    cur_node.addChild(new_node)
                    new_node.setExpanded(1)
                    self.DataToTree(tree, new_node, sub_data, filter)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def DataToTree(self, tree, cur_node, data, filter=''):
        node_info = data[0]
        node_info_child = data[1]
        [cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
        target = re.compile(filter, re.IGNORECASE)
        for sub_data in node_info_child:
            if filter == '':
                new_node = QtWidgets.QTreeWidgetItem()
                cur_node.addChild(new_node)
                self.DataToTree(tree, new_node, sub_data)
            else:
                if not target.search(sub_data[0][0]) and not self.DataChildCheck(sub_data[1], filter):
                    pass
                else:
                    new_node = QtWidgets.QTreeWidgetItem()
                    cur_node.addChild(new_node)
                    new_node.setExpanded(1)
                    self.DataToTree(tree, new_node, sub_data, filter)
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def fill(self, classes):
        '''Parse all the paths (['Lcom/sogeti/example/myclass/MyActivity$1;', ...])
           and build a tree using the QTreeWidgetItem insertion method.'''

        root_path_node = ({}, self)
        for c in sorted(classes, key=lambda c: c.name):
            sig = Signature(c)
            path_node = root_path_node
            # Namespaces
            for path in sig.class_path:
                if path not in path_node[0]:
                    path_node[0][path] = ({},
                            QtGui.QTreeWidgetItem(path_node[1]))
                    path_node[0][path][1].setText(0, path)
                path_node = path_node[0][path]
            # Class
            path_node[0][path] = ({},
                    QtGui.QTreeWidgetItem(path_node[1]))
            path_node[0][path][1].setText(0, sig.class_name)
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def item2path(self, item, column=0):
        '''Browse all parents from QTreeWidgetItem item
           in order to rebuild the complete path
           Return both complete path (ex: "Landroid/support/AccessibilityServiceInfoCompat$1;")
           and path_elts (ex: [u'Landroid', u'support', u'AccessibilityServiceInfoCompat$1;'])
        '''

        path_elts = []
        while item is not None:
#            print item.text(column)
            path_elts.append(item.text(column))
            item = item.parent()
        path_elts.reverse()
        path = ".".join(path_elts)
        path = classdot2class(path)
        return path, path_elts
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def fill(self, classes):
        '''Parse all the paths (['Lcom/sogeti/example/myclass/MyActivity$1;', ...])
           and build a tree using the QTreeWidgetItem insertion method.'''

        root_path_node = ({}, self)
        for c in sorted(classes, key=lambda c: c.name):
            sig = Signature(c)
            path_node = root_path_node
            # Namespaces
            for path in sig.class_path:
                if path not in path_node[0]:
                    path_node[0][path] = ({},
                            QtGui.QTreeWidgetItem(path_node[1]))
                    path_node[0][path][1].setText(0, path)
                path_node = path_node[0][path]
            # Class
            path_node[0][path] = ({},
                    QtGui.QTreeWidgetItem(path_node[1]))
            path_node[0][path][1].setText(0, sig.class_name)
项目:DroidWatcher    作者:suemi994    | 项目源码 | 文件源码
def item2path(self, item, column=0):
        '''Browse all parents from QTreeWidgetItem item
           in order to rebuild the complete path
           Return both complete path (ex: "Landroid/support/AccessibilityServiceInfoCompat$1;")
           and path_elts (ex: [u'Landroid', u'support', u'AccessibilityServiceInfoCompat$1;'])
        '''

        path_elts = []
        while item is not None:
#            print item.text(column)
            path_elts.append(item.text(column))
            item = item.parent()
        path_elts.reverse()
        path = ".".join(path_elts)
        path = classdot2class(path)
        return path, path_elts
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTree(self,*args):
        pathTree=buildTreeFromPaths(self.publishItems)
        #build Tree
        dicts=[[pathTree,self.publishesTree]]
        for dict,parent in dicts:
            for k in dict.keys():
                item=QtGui.QTreeWidgetItem()
                item.setText(0,k)
                if type(parent) is QtGui.QTreeWidget:
                    if not item.text(0)=='<files>':
                        self.publishesTree.insertTopLevelItem(0,item)
                if type(parent) is QtGui.QTreeWidgetItem:
                    if not item.text(0)=='<files>':
                        parent.addChild(item)
                if type(dict[k]) is collections.defaultdict:
                    dicts.append([dict[k],item])
                    #print "found dict",k
                if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                    for i in dict[k]:
                        #add frames to parent
                        parent.setText(1,i.split(" ")[-1])
        self.publishesTree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTree(self,*args):
        pathTree=buildTreeFromPaths(self.publishItems)
        #build Tree
        dicts=[[pathTree,self.publishesTree]]
        for dict,parent in dicts:
            for k in dict.keys():
                item=QtGui.QTreeWidgetItem()
                item.setText(0,k)
                if type(parent) is QtGui.QTreeWidget:
                    if not item.text(0)=='<files>':
                        self.publishesTree.insertTopLevelItem(0,item)
                if type(parent) is QtGui.QTreeWidgetItem:
                    if not item.text(0)=='<files>':
                        parent.addChild(item)
                if type(dict[k]) is collections.defaultdict:
                    dicts.append([dict[k],item])
                    #print "found dict",k
                if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                    for i in dict[k]:
                        #add frames to parent
                        parent.setText(1,i.split(" ")[-1])
        self.publishesTree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def modelsLoadCategories(self):
        ''' main items '''
        categories = {}
        # Without category
        mainItem = QtGui.QTreeWidgetItem([u'Models without category'])
        mainItem.setData(0, QtCore.Qt.UserRole, -1)
        mainItem.setData(0, QtCore.Qt.UserRole + 1, '')
        self.modelsTable.addTopLevelItem(mainItem)
        self.modelsTable.setFirstItemColumnSpanned(mainItem, True)
        categories[-1] = mainItem
        # omitted models
        mainItem = QtGui.QTreeWidgetItem([u'Omitted models'])
        mainItem.setData(0, QtCore.Qt.UserRole, -2)
        mainItem.setData(0, QtCore.Qt.UserRole + 1, -2)
        self.modelsTable.addTopLevelItem(mainItem)
        self.modelsTable.setFirstItemColumnSpanned(mainItem, True)
        categories[-2] = mainItem
        #
        for i in range(self.categoriesTable.rowCount()):
            if self.categoriesTable.cellWidget(i, 0).isChecked():
                oldCategoryID = int(self.categoriesTable.item(i, 1).text())

                if self.categoriesTable.cellWidget(i, 4).currentIndex() == 0:
                    mainItem = QtGui.QTreeWidgetItem(['{0} (New category)'.format(self.categoriesTable.item(i, 2).text())])
                    mainItem.setData(0, QtCore.Qt.UserRole, 'New')
                    mainItem.setData(0, QtCore.Qt.UserRole + 3, "<span style='font-weight:bold;'>New category '{0}' will be added.</span>".format(self.categoriesTable.item(i, 2).text()))  # info
                else:
                    categoryData = self.categoriesTable.cellWidget(i, 4).itemData(self.categoriesTable.cellWidget(i, 4).currentIndex())

                    mainItem = QtGui.QTreeWidgetItem(['{1} (New category {0})'.format(categoryData[1], self.categoriesTable.item(i, 2).text())])
                    mainItem.setData(0, QtCore.Qt.UserRole, 'Old')
                    mainItem.setData(0, QtCore.Qt.UserRole + 3, "<span style='font-weight:bold;'>All entries from old category '{1}' will be shifted to the new '{0}'.</span>".format(categoryData[1], self.categoriesTable.item(i, 2).text()))  # info

                mainItem.setData(0, QtCore.Qt.UserRole + 1, i)  # category row number
                self.modelsTable.addTopLevelItem(mainItem)
                self.modelsTable.setFirstItemColumnSpanned(mainItem, True)

                categories[oldCategoryID] = mainItem
        #
        return categories
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def reloadList(self):
        ''' reload list of packages from current lib '''
        self.sql.reloadList()
        self.clear()
        categories = {}

        for i, j in readCategories().items():
            mainItem = QtGui.QTreeWidgetItem([j[0], j[1]])
            mainItem.setData(0, QtCore.Qt.UserRole, i)
            mainItem.setData(0, QtCore.Qt.UserRole + 1, "C")
            self.addTopLevelItem(mainItem)

            categories[i] = mainItem

        for i in self.sql.packages():
            dane = self.sql.getValues(i)

            mainItem = QtGui.QTreeWidgetItem([dane["name"], dane["description"]])
            mainItem.setData(0, QtCore.Qt.UserRole, i)
            mainItem.setData(0, QtCore.Qt.UserRole + 1, "P")
            if self.checkItems:
                mainItem.setCheckState(0, QtCore.Qt.Unchecked)

            try:
                categories[int(dane["category"])].addChild(mainItem)
            except:
                self.addTopLevelItem(mainItem)

            if bool(eval(dane["socket"])[0]) == True:
                self.Sockets.append(["{0}".format(dane["name"]), i])

        self.sortItems(0, QtCore.Qt.AscendingOrder)
        self.resizeColumnToContents(0)
项目:android_malware_detection    作者:congyuandong    | 项目源码 | 文件源码
def fill(self):
        '''Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...])
           and build a tree using the QTreeWidgetItem insertion method.'''
        androconf.debug("Fill classes tree")

        for idx, filename, digest, classes in self.session.get_classes():
            for c in sorted(classes, key=lambda c: c.name):
                sig = Signature(c)
                path_node = self.root_path_node

                path = None
                if sig.class_path == []:
                    path = '.'
                    if path not in path_node[0]:
                        path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))
                        path_node[0][path][1].setText(0, path)
                    path_node = path_node[0][path]
                else:
                    # Namespaces
                    for path in sig.class_path:
                        if path not in path_node[0]:
                            path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))
                            path_node[0][path][1].setText(0, path)
                        path_node = path_node[0][path]

                # Class
                path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))

                class_name = sig.class_name

                if idx > 0:
                    class_name += "@%d" % idx

                c.current_title = class_name
                self._reverse_cache[path_node[0][path][1]] = (c,
                                                              filename,
                                                              digest)


                path_node[0][path][1].setText(0, class_name)
项目:android_malware_detection    作者:congyuandong    | 项目源码 | 文件源码
def fill(self):
        '''Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...])
           and build a tree using the QTreeWidgetItem insertion method.'''
        androconf.debug("Fill classes tree")

        for idx, filename, digest, classes in self.session.get_classes():
            for c in sorted(classes, key=lambda c: c.name):
                sig = Signature(c)
                path_node = self.root_path_node

                path = None
                if sig.class_path == []:
                    path = '.'
                    if path not in path_node[0]:
                        path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))
                        path_node[0][path][1].setText(0, path)
                    path_node = path_node[0][path]
                else:
                    # Namespaces
                    for path in sig.class_path:
                        if path not in path_node[0]:
                            path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))
                            path_node[0][path][1].setText(0, path)
                        path_node = path_node[0][path]

                # Class
                path_node[0][path] = ({}, QtGui.QTreeWidgetItem(path_node[1]))

                class_name = sig.class_name

                if idx > 0:
                    class_name += "@%d" % idx

                c.current_title = class_name
                self._reverse_cache[path_node[0][path][1]] = (c,
                                                              filename,
                                                              digest)


                path_node[0][path][1].setText(0, class_name)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def mousePressEvent(self,event):
        pos = event.pos()
        selectedItem = self.itemAt(pos)

        for item in self.selectedItems():
            item.setSelected(False)

        if type(selectedItem) == QtGui.QTreeWidgetItem:
            selectedItem.setSelected(True)

        if event.button() == QtCore.Qt.RightButton:
            pos = QtGui.QCursor.pos()
            menu = QtGui.QMenu("Jobs")
            menu.addAction("Open")
            menu.addAction("Properties")
            menu.addSeparator()
            menu.addAction("Restart")
            menu.addAction("Stop")
            menu.addAction("Kill")
            menu.addSeparator()
            menu.addAction("Restart all error tasks")
            menu.addAction("Kill all running tasks")
            menu.addSeparator()
            menu.addAction("Delete")
            menu.exec_(pos)

        else:

            if self.listType == "jobs":
                if type(selectedItem) == QtGui.QTreeWidgetItem:
                    conn = sqlite3.connect(self.database)
                    h = conn.execute("SELECT tasks FROM jobs WHERE rowid=%s"%(selectedItem.text(0))).fetchone()
                    conn.close()
                    dbFilter = ("rowid IN %s"%(h[0])).replace("[","(").replace("]",")")

                    self.connectedList.refreshList(dbFilter)
                else:
                    self.connectedList.refreshList("rowid=-1")
项目:KicadSolderTool    作者:pioupus    | 项目源码 | 文件源码
def __init__(self, parent, footprintlist):
        QtGui.QDialog.__init__(self, parent)
        self.owner = parent
        self.combo_param_name = QtGui.QComboBox();
        self.combo_param_name.setEditable(True)
        self.footprint_list = footprintlist
        self.list_widget = PartTreeWidget(self)
        self.list_widget.setColumnCount(4)
        self.btn_load_bom = QtGui.QPushButton("load Field from xml-BOM")
        self.gridlayout = QtGui.QGridLayout()
        self.label = QtGui.QLabel("Field name:")
        self.gridlayout.addWidget(self.label,0,0,1,0)
        self.gridlayout.addWidget(self.btn_load_bom,1,1)
        self.gridlayout.addWidget(self.combo_param_name,1,0)
        self.gridlayout.addWidget(self.list_widget,2,0,1,0)
        self.label.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Minimum)
        self.combo_param_name.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Minimum)
        self.list_widget.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding,QtGui.QSizePolicy.MinimumExpanding)
        self.param_names = []
        settings = QtCore.QSettings("./KicadSolderTool.ini",QtCore.QSettings.IniFormat)
        size = settings.beginReadArray("param_names")
        for i in range(size):
            settings.setArrayIndex(i)
            self.param_names.append(settings.value("key"))

        settings.endArray()
        self.combo_param_name.addItems(self.param_names)
        self.combo_param_name.setCurrentIndex(int(settings.value("recent_field_name",0)))

        self.setLayout(self.gridlayout)
        for footprint in self.footprint_list:        
            if footprint['bot']:
                caption = 'bot'
            else:
                caption = 'top'
            if footprint['other_side']:
                caption += "(also other side)"
            item = QtGui.QTreeWidgetItem(caption)
            item.setText(0,footprint['ref'])
            item.setText(1,caption)
            item.setText(2,footprint['val'])
            item.setCheckState(0,QtCore.Qt.Unchecked)   

            self.list_widget.addTopLevelItem(item)
        for i in range(self.list_widget.columnCount()):
            self.list_widget.resizeColumnToContents(i);
        self.setMinimumWidth(600)
        self.show()

        self.connect(self.list_widget, QtCore.SIGNAL("itemSelectionChanged()"), self.on_select)
        self.connect(self.btn_load_bom, QtCore.SIGNAL("clicked()"), self.on_load_bom)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def tabModels(self):
        tab = QtGui.QWidget()

        # table
        self.modelsTable = QtGui.QTreeWidget()
        #self.modelsTable.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
        self.modelsTable.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.modelsTable.setHeaderLabels([u'Name', u'Description', u'Paths', u'Softwares'])
        self.modelsTable.setStyleSheet('''
            QTreeWidget {border:0px solid #FFF;}
        ''')
        self.connect(self.modelsTable, QtCore.SIGNAL("itemPressed (QTreeWidgetItem*,int)"), self.showInfoF)
        # buttons
        selectAll = QtGui.QPushButton()
        selectAll.setFlat(True)
        selectAll.setToolTip('Select all')
        selectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png"))
        selectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(selectAll, QtCore.SIGNAL("clicked()"), self.selectAllModels)

        unselectAll = QtGui.QPushButton()
        unselectAll.setFlat(True)
        unselectAll.setToolTip('Deselect all')
        unselectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG"))
        unselectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(unselectAll, QtCore.SIGNAL("clicked()"), self.unselectAllModels)

        collapseAll = QtGui.QPushButton()
        collapseAll.setFlat(True)
        collapseAll.setToolTip('Collapse all')
        collapseAll.setIcon(QtGui.QIcon(":/data/img/collapse.png"))
        collapseAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(collapseAll, QtCore.SIGNAL("clicked()"), self.modelsTable.collapseAll)

        expandAll = QtGui.QPushButton()
        expandAll.setFlat(True)
        expandAll.setToolTip('Expand all')
        expandAll.setIcon(QtGui.QIcon(":/data/img/expand.png"))
        expandAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''')
        self.connect(expandAll, QtCore.SIGNAL("clicked()"), self.modelsTable.expandAll)
        # info
        self.showInfo = QtGui.QLabel('')
        self.showInfo.setStyleSheet('border:1px solid rgb(237, 237, 237); padding:5px 2px;')

        # main lay
        layTableButtons = QtGui.QHBoxLayout()
        layTableButtons.addWidget(selectAll)
        layTableButtons.addWidget(unselectAll)
        layTableButtons.addWidget(collapseAll)
        layTableButtons.addWidget(expandAll)
        layTableButtons.addStretch(10)

        lay = QtGui.QGridLayout(tab)
        lay.addLayout(layTableButtons, 0, 0, 1, 1)
        lay.addWidget(self.modelsTable, 1, 0, 1, 1)
        lay.addWidget(self.showInfo, 2, 0, 1, 1)
        lay.setRowStretch(1, 10)
        lay.setColumnStretch(0, 10)
        lay.setContentsMargins(5, 5, 5, 5)

        return tab
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def open(self):
        obj = FreeCAD.ActiveDocument.Objects

        nr = 0
        for i in obj:
            if hasattr(i, "Placement"):
                #top
                a = QtGui.QTreeWidgetItem()
                a.setText(0, i.Label)
                a.setCheckState(0, QtCore.Qt.Unchecked)
                a.setData(0, QtCore.Qt.UserRole, i.Name)
                try:
                    a.setIcon(0, i.ViewObject.Icon)
                except AttributeError:
                    pass
                a.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)

                dostepneWarstwy = QtGui.QComboBox()
                dostepneWarstwy.addItems(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
                dostepneWarstwy.setCurrentIndex(1)
                dostepneWarstwy.setMaximumWidth(60)
                globals()["zm_g_%s" % nr] = dostepneWarstwy  # workaround bug from pyside

                self.form.tableTop.addTopLevelItem(a)
                self.form.tableTop.setItemWidget(a, 1, globals()["zm_g_%s" % nr])

                # bottom
                a = QtGui.QTreeWidgetItem()
                a.setText(0, i.Label)
                a.setCheckState(0, QtCore.Qt.Unchecked)
                a.setData(0, QtCore.Qt.UserRole, i.Name)
                try:
                    a.setIcon(0, i.ViewObject.Icon)
                except AttributeError:
                    pass
                a.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)

                dostepneWarstwy = QtGui.QComboBox()
                dostepneWarstwy.addItems(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
                dostepneWarstwy.setCurrentIndex(1)
                dostepneWarstwy.setMaximumWidth(60)
                globals()["zm_d_%s" % nr] = dostepneWarstwy  # workaround bug from pyside

                self.form.tableBottom.addTopLevelItem(a)
                self.form.tableBottom.setItemWidget(a, 1, globals()["zm_d_%s" % nr])

                ##
                nr += 1

        self.form.tableTop.resizeColumnToContents(1)
        self.form.tableBottom.resizeColumnToContents(1)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def buildTreeA(self,*args):
        if self.selShot and self.selScript:
            tree=''
            if self.bottomTab.currentIndex()==0:
                tree=self.RendersInTreeA
            if self.bottomTab.currentIndex()==1:
                tree=self.RendersOutTreeA
            if self.bottomTab.currentIndex()<2:    
                tree.clear()

                projectPath=self.template_nukeScriptPath.replace("shotNum",self.selShot)
                nukeFile=projectPath+"/"+self.selScript
                seqs=getNukeScriptSeqs(nukeFile,self.searchDir3D)
                #remove incoming from paths
                pathsOnly=[]
                for seq in seqs:
                    #only list beauty files
                    #if "beauty" in seq:
                    pathsOnly.append(filterPath(seq,self.searchDir3D))

                pathTree=buildTreeFromPaths(pathsOnly)
                #build Tree
                dicts=[[pathTree,tree]]
                for dict,parent in dicts:
                    for k in dict.keys():
                        item=QtGui.QTreeWidgetItem()
                        item.setText(0,k)
                        if type(parent) is QtGui.QTreeWidget:
                            if not item.text(0)=='<files>':
                                tree.insertTopLevelItem(0,item)
                        if type(parent) is QtGui.QTreeWidgetItem:
                            if not item.text(0)=='<files>':
                                parent.addChild(item)
                        if type(dict[k]) is collections.defaultdict:
                            dicts.append([dict[k],item])
                            #print "found dict",k
                        if type(dict[k]) is list and type(parent) is not QtGui.QTreeWidget:
                            for i in dict[k]:
                                item=QtGui.QTreeWidgetItem()
                                item.setText(0,i)
                                parent.addChild(item)
                tree.sortItems(0,QtCore.Qt.AscendingOrder)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="E:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="D:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)