def copy_tree(self): """Copy the tree to the clipboard.""" items = [] inval_index = QModelIndex() it = QTreeWidgetItemIterator(self) prev_depth = 0 while it.value(): depth = 0 item = it.value() parent = item.parent() while parent: depth += 1 parent = parent.parent() if depth < prev_depth: items.extend([" |"*depth, "\n"]) if depth: items.extend([" |"*depth, "--", item.text(0), "\n"]) else: items.extend([item.text(0), "\n"]) prev_depth = depth it += 1 QApplication.clipboard().setText("".join(items))
def accept(self): torrentPriorities = {"Low": 0, "Normal": 127, "High": 255} filePriorities = {"Low": 1, "Normal": 4, "High": 7} it = QTreeWidgetItemIterator(self.treeView, QTreeWidgetItemIterator.NoChildren) itemsInfo = {} while it.value(): currentItem = it.value() if currentItem.checkState(0) == Qt.Unchecked: priority = 0 else: priority = filePriorities[currentItem.text(2)] itemsInfo[self.getFullPath(currentItem)] = priority it += 1 paths = [f.path for f in self.torrentInfo.files()] self.prioritiesList = [itemsInfo[p] for p in paths] comboBoxIndex = self.priorityComboBox.currentIndex() self.priority = torrentPriorities[self.priorityComboBox.itemText( comboBoxIndex)] self.hide() self.dataReady.emit(self.getData()) super().accept()
def btnHome_Click(self): CSRWidgets.changeCentralWidget(self, CSRWidgets.createDesignButtons(self,'default')) self.availableItems.clear() itSku = QTreeWidgetItemIterator(self.garmentTree) ################################################################################# while itSku.value(): if itSku.value().parent() != None: itSku.value().setExpanded(False) itSku += 1
def _set_dependencies(self): """ Set the dependency information. """ project = self.project editor = self._stdlib_edit required_modules, required_libraries = project.get_stdlib_requirements() blocked = editor.blockSignals(True) it = QTreeWidgetItemIterator(editor) itm = it.value() while itm is not None: external = required_modules.get(itm._name) expanded = False if external is None: state = Qt.Unchecked elif external: state = Qt.Checked expanded = True else: state = Qt.PartiallyChecked itm.setCheckState(0, state) # Make sure every explicitly checked item is visible. if expanded: parent = itm.parent() while parent is not None: parent.setExpanded(True) parent = parent.parent() it += 1 itm = it.value() editor.blockSignals(blocked) model = self._extlib_edit.model() # Note that we can't simply block the model's signals as this would # interfere with the model/view interactions. self._ignore_extlib_changes = True for extlib in external_libraries_metadata: if extlib.name in required_libraries: for idx, itm in enumerate(extlib._items): itm.setFlags( Qt.ItemIsEnabled|Qt.ItemIsEditable if idx != 0 else Qt.ItemIsEnabled) else: for itm in extlib._items: itm.setFlags(Qt.NoItemFlags) self._ignore_extlib_changes = False
def _get_items(self): """ Return an iterator over the tree widget items. """ it = QTreeWidgetItemIterator(self._package_edit) if self._show_root: it += 1 itm = it.value() while itm is not None: yield itm it += 1 itm = it.value()
def convert(self): if self.root is None: return # 遍历所有转换叶子节点 it = QTreeWidgetItemIterator(self.root) while it.value(): node = it.value() if node.childCount() == 0: if node.checkState(0) == Qt.Checked: # print("convert...", node.resData["Name"]) pass it += 1
def select_res_group(self, groups): if self.root is None: return # 遍历所有转换叶子节点 it = QTreeWidgetItemIterator(self.root) while it.value(): node = it.value() if node.childCount() == 0: if int(node.resData["BinStyles"]) in groups: node.setCheckState(0, Qt.Checked) else: node.setCheckState(0, Qt.Unchecked) it += 1
def loadGarmentInfo(self,sku_code,garment_type,garment_name,design_name): #print(garment_type) #Query the database to get all garments available for this particular SKU. garm = mysql_db.garmentInfo(self, sku_code, garment_type) columnList = ["Design", "Size","Price", "Qty",""] #Set tree header/title stuff self.garmentTree.setHeaderLabels(columnList) self.garmentTree.setColumnCount(5) self.garmentTree.header().resizeSection(0, 280) self.garmentTree.header().resizeSection(1, 75) self.garmentTree.header().resizeSection(2, 45) self.garmentTree.header().resizeSection(3, 30) self.garmentTree.header().resizeSection(4, 10) #If there are no nodes in this tree yet, create the first one if self.garmentTree.topLevelItemCount() == 0: #print("NEW PARENT NODE") CSRWidgets.lblTotal = {} nm = QTreeWidgetItem(self.garmentTree) nm.setText(0, self.orderVars) nm.setBackground(0, QColor(180,180,180,127)) nm.setBackground(1, QColor(180,180,180,127)) nm.setBackground(2, QColor(180,180,180,127)) nm.setBackground(3, QColor(180,180,180,127)) nm.setBackground(4, QColor(180,180,180,127)) nm.setFont(0, QFont("Helvetica",16,QFont.Bold)) sku = QTreeWidgetItem(nm) sku.setText(0, sku_code) sku.setBackground(0, QColor(180,180,180,127)) sku.setBackground(1, QColor(180,180,180,127)) sku.setBackground(2, QColor(180,180,180,127)) sku.setBackground(3, QColor(180,180,180,127)) sku.setBackground(4, QColor(180,180,180,127)) sku.setFont(0, QFont("Helvetica",12,QFont.Bold)) #If the garment name does not exist we want to create a node for it. garmName = QTreeWidgetItem(sku) garmName.setText(0, garment_name) garmName.setText(3, "") garmName.setFont(0,QFont("Helvetica",10,QFont.Bold)) garmName.setFont(3,QFont("Helvetica",10,QFont.Bold)) garmName.setBackground(0, QColor(230,230,230,127)) garmName.setBackground(1, QColor(230,230,230,127)) garmName.setBackground(2, QColor(230,230,230,127)) garmName.setBackground(3, QColor(230,230,230,127)) garmName.setBackground(4, QColor(230,230,230,127)) removeName = QToolButton(self) removeName.setIcon(QIcon("Icon/close-widget.png")) removeName.setIconSize(QSize(14,14)) removeName.setAutoRaise(True) removeName.clicked.connect(lambda: CSRWidgets.remove_widget(self)) removeSku = QToolButton(self) removeSku.setIcon(QIcon("icon/close-widget.png")) removeSku.setIconSize(QSize(14, 14)) removeSku.setAutoRaise(True) removeSku.clicked.connect(lambda: CSRWidgets.remove_widget(self)) removeGarment = QToolButton(self) removeGarment.setIcon(QIcon("icon/close-widget.png")) removeGarment.setIconSize(QSize(14, 14)) removeGarment.setAutoRaise(True) removeGarment.clicked.connect(lambda: CSRWidgets.remove_widget(self)) CSRWidgets.lblTotal[str(sku_code + garment_name)] = QLabel() CSRWidgets.lblTotal[str(sku_code + garment_name)].setMaximumWidth(30) CSRWidgets.lblTotal[str(sku_code + garment_name)].setFont(QFont("Helvetica",10,QFont.Bold)) self.garmentTree.setItemWidget(nm, 4, removeName) self.garmentTree.setItemWidget(sku, 4, removeSku) self.garmentTree.setItemWidget(garmName, 4, removeGarment) self.garmentTree.setItemWidget(garmName, 3, CSRWidgets.lblTotal[str(sku_code + garment_name)]) CSRWidgets.le = {} #Create all the garment types for the first node for i in garm: kiddo = QTreeWidgetItem(garmName) kiddo.setText(0, i[1]) kiddo.setText(2, str(i[3])) kiddo.setText(1, i[2]) kiddo.setText(3,"") kiddo.setFont(3, QFont("Helvetica",10,QFont.Bold) ) kiddo.setText(4,"-") nm.setExpanded(True) sku.setExpanded(True) garmName.setExpanded(True) kiddo.setExpanded(True) #print(le.objectName()) #If items already exist in the tree, do stuff depending on what sku/garment was clicked. else: name_match = 0 sku_match = 0 itSku = QTreeWidgetItemIterator(self.garmentTree) #iterate through all tree items and see if anything matches the SKU we selected. while itSku.value(): if itSku.value().text(0) == self.orderVars: name_match = 1 #print("NAME MATCHED!!!") #If the SKU we selected exists somewhere in the tree, set variable to indicate that. if itSku.value().text(0) == sku_code and itSku.value().parent().text(0) == self.orderVars: sku_match = 1 #print("SKU MATCHED!!!") #Collapse all non-parent nodes so we can selectively open the nodes we are currently working on below. if itSku.value().parent() != None: itSku.value().setExpanded(False) itSku += 1 if name_match == 1: #print("NAME MATCHED!!!!!!!!") #if the SKU we've selected already exists in the tree, check to see if the garment we've selected exists also if sku_match == 1: #print("SKU MATCHED!!!") garm_match = 0 #print("already", sku_code) #Create an iterator to iterate through all the elements in the tree. itGarment = QTreeWidgetItemIterator(self.garmentTree) #Open up iterator while itGarment.value(): #If BOTH the SKU and garment already exist in the tree, just expand it while collapsing all other items. if itGarment.value().text(0) == garment_name and itGarment.value().parent().text(0) == sku_code and itGarment.value().parent().parent().text(0) == self.orderVars: #itGarment.value().parent().setExpanded(True) #itGarment.value().setExpanded(True) garm_match = 1 itGarment.value().parent().parent().setExpanded(True) itGarment.value().parent().setExpanded(True) itGarment.value().setExpanded(True) itGarment += 1 #If the selected garment does NOT exist in the tree for this SKU, create it. if garm_match == 0: #create tree iterator itSizes = QTreeWidgetItemIterator(self.garmentTree) while itSizes.value(): #When the iterator hits the correct SKU, create the new garment node that doesn't exist yet. if itSizes.value().text(0) == sku_code and itSizes.value().parent().text(0) == self.orderVars: #If the garment name does not exist we want to create a node for it. garmName = QTreeWidgetItem(itSizes.value()) garmName.setText(0, garment_name) garmName.setText(3, "") garmName.setFont(0,QFont("Helvetica",10,QFont.Bold)) garmName.setFont(3,QFont("Helvetica",10,QFont.Bold)) garmName.setBackground(0, QColor(230,230,230,127)) garmName.setBackground(1, QColor(230,230,230,127)) garmName.setBackground(2, QColor(230,230,230,127)) garmName.setBackground(3, QColor(230,230,230,127)) garmName.setBackground(4, QColor(230,230,230,127)) removeGarment = QToolButton(self) removeGarment.setIcon(QIcon("icon/close-widget.png")) removeGarment.setIconSize(QSize(14, 14)) removeGarment.setAutoRaise(True) removeGarment.clicked.connect(lambda: CSRWidgets.remove_widget(self)) CSRWidgets.lblTotal[str(sku_code + garment_name)] = QLabel(self.garmentTree) CSRWidgets.lblTotal[str(sku_code + garment_name)].setMaximumWidth(30) CSRWidgets.lblTotal[str(sku_code + garment_name)].setFont(QFont("Helvetica",10,QFont.Bold)) self.garmentTree.setItemWidget(garmName, 4, removeGarment) self.garmentTree.setItemWidget(garmName, 3, CSRWidgets.lblTotal[str(sku_code + garment_name)]) #Create all the garment types for the node #CSRWidgets.le = {} for i in garm: kiddo = QTreeWidgetItem(garmName) kiddo.setText(0, i[1]) kiddo.setText(2, str(i[3])) kiddo.setText(1, i[2]) kiddo.setText(3,"") kiddo.setFont(3, QFont("Helvetica",10,QFont.Bold) ) kiddo.setText(4,"-") itSizes.value().setExpanded(True) garmName.setExpanded(True) kiddo.setExpanded(True) itSizes += 1 #If the SKU does NOT exist in the tree yet, but others already do, create this particular SKU. else: #print("SAME NAME, DIFFERENT SKU!!!!! SKU = " + sku_code + " -- Name = " + self.orderVars) iterNewSku = QTreeWidgetItemIterator(self.garmentTree) while iterNewSku.value(): if iterNewSku.value().childCount() > 0: if iterNewSku.value().text(0) == self.orderVars: sku = QTreeWidgetItem(iterNewSku.value()) sku.setText(0, sku_code) sku.setBackground(0, QColor(180,180,180,127)) sku.setBackground(1, QColor(180,180,180,127)) sku.setBackground(2, QColor(180,180,180,127)) sku.setBackground(3, QColor(180,180,180,127)) sku.setBackground(4, QColor(180,180,180,127)) sku.setFont(0, QFont("Helvetica",12,QFont.Bold) ) removeSku = QToolButton(self) removeSku.setIcon(QIcon("icon/close-widget.png")) removeSku.setIconSize(QSize(14, 14)) removeSku.setAutoRaise(True) removeSku.clicked.connect(lambda: CSRWidgets.remove_widget(self)) garmName = QTreeWidgetItem(sku) garmName.setText(0, garment_name) garmName.setText(3, "") garmName.setFont(0,QFont("Helvetica",10,QFont.Bold)) garmName.setFont(3,QFont("Helvetica",10,QFont.Bold)) garmName.setBackground(0, QColor(230,230,230,127)) garmName.setBackground(1, QColor(230,230,230,127)) garmName.setBackground(2, QColor(230,230,230,127)) garmName.setBackground(3, QColor(230,230,230,127)) garmName.setBackground(4, QColor(230,230,230,127)) removeGarment = QToolButton(self) removeGarment.setIcon(QIcon("icon/close-widget.png")) removeGarment.setIconSize(QSize(14, 14)) removeGarment.setAutoRaise(True) removeGarment.clicked.connect(lambda: CSRWidgets.remove_widget(self)) CSRWidgets.lblTotal[str(sku_code + garment_name)] = QLabel(self.garmentTree) CSRWidgets.lblTotal[str(sku_code + garment_name)].setMaximumWidth(30) CSRWidgets.lblTotal[str(sku_code + garment_name)].setFont(QFont("Helvetica",10,QFont.Bold)) self.garmentTree.setItemWidget(sku, 4, removeSku) self.garmentTree.setItemWidget(garmName, 4, removeGarment) self.garmentTree.setItemWidget(garmName, 3, CSRWidgets.lblTotal[str(sku_code + garment_name)]) #CSRWidgets.le = {} #Create all the garment types for the first node for i in garm: kiddo = QTreeWidgetItem(garmName) kiddo.setText(0, i[1]) kiddo.setText(2, str(i[3])) kiddo.setText(1, i[2]) kiddo.setText(3,"") kiddo.setFont(3, QFont("Helvetica",10,QFont.Bold)) kiddo.setText(4,"-") #nm.setExpanded(True) sku.setExpanded(True) garmName.setExpanded(True) kiddo.setExpanded(True) iterNewSku += 1 else: #print("NEW NAME") CSRWidgets.lblTotal = {} nm = QTreeWidgetItem(self.garmentTree) nm.setText(0, self.orderVars) nm.setBackground(0, QColor(180,180,180,127)) nm.setBackground(1, QColor(180,180,180,127)) nm.setBackground(2, QColor(180,180,180,127)) nm.setBackground(3, QColor(180,180,180,127)) nm.setBackground(4, QColor(180,180,180,127)) nm.setFont(0, QFont("Helvetica",16,QFont.Bold)) sku = QTreeWidgetItem(nm) sku.setText(0, sku_code) sku.setBackground(0, QColor(180,180,180,127)) sku.setBackground(1, QColor(180,180,180,127)) sku.setBackground(2, QColor(180,180,180,127)) sku.setBackground(3, QColor(180,180,180,127)) sku.setBackground(4, QColor(180,180,180,127)) sku.setFont(0, QFont("Helvetica",12,QFont.Bold)) #If the garment name does not exist we want to create a node for it. garmName = QTreeWidgetItem(sku) garmName.setText(0, garment_name) garmName.setText(3, "") garmName.setFont(0,QFont("Helvetica",10,QFont.Bold)) garmName.setFont(3,QFont("Helvetica",10,QFont.Bold)) garmName.setBackground(0, QColor(230,230,230,127)) garmName.setBackground(1, QColor(230,230,230,127)) garmName.setBackground(2, QColor(230,230,230,127)) garmName.setBackground(3, QColor(230,230,230,127)) garmName.setBackground(4, QColor(230,230,230,127)) removeName = QToolButton(self) removeName.setIcon(QIcon("Icon/close-widget.png")) removeName.setIconSize(QSize(14,14)) removeName.setAutoRaise(True) removeName.clicked.connect(lambda: CSRWidgets.remove_widget(self)) removeSku = QToolButton(self) removeSku.setIcon(QIcon("icon/close-widget.png")) removeSku.setIconSize(QSize(14, 14)) removeSku.setAutoRaise(True) removeSku.clicked.connect(lambda: CSRWidgets.remove_widget(self)) removeGarment = QToolButton(self) removeGarment.setIcon(QIcon("icon/close-widget.png")) removeGarment.setIconSize(QSize(14, 14)) removeGarment.setAutoRaise(True) removeGarment.clicked.connect(lambda: CSRWidgets.remove_widget(self)) CSRWidgets.lblTotal[str(sku_code + garment_name)] = QLabel() CSRWidgets.lblTotal[str(sku_code + garment_name)].setMaximumWidth(30) CSRWidgets.lblTotal[str(sku_code + garment_name)].setFont(QFont("Helvetica",10,QFont.Bold)) self.garmentTree.setItemWidget(nm, 4, removeName) self.garmentTree.setItemWidget(sku, 4, removeSku) self.garmentTree.setItemWidget(garmName, 4, removeGarment) self.garmentTree.setItemWidget(garmName, 3, CSRWidgets.lblTotal[str(sku_code + garment_name)]) CSRWidgets.le = {} #Create all the garment types for the first node for i in garm: kiddo = QTreeWidgetItem(garmName) kiddo.setText(0, i[1]) kiddo.setText(2, str(i[3])) kiddo.setText(1, i[2]) kiddo.setText(3,"") kiddo.setFont(3, QFont("Helvetica",10,QFont.Bold) ) kiddo.setText(4,"-") nm.setExpanded(True) sku.setExpanded(True) garmName.setExpanded(True) kiddo.setExpanded(True) #print(le.objectName()) self.treeDock.show() self.viewMenu.addAction(self.treeDock.toggleViewAction()) self.treeDock.setWidget(self.garmentTree) self.addDockWidget(Qt.RightDockWidgetArea, self.treeDock)
def inject_prnr(self): '''向PR号树中,注入PRNR订单''' str_prnr_order = self.textEdit.toPlainText() str_prnr_order = str_prnr_order.strip(' ') str_prnr_order = str_prnr_order.strip(',') lst_prnr_oder = [] if len(str_prnr_order): str_prnr_order = str_prnr_order.upper() if ', ' in str_prnr_order: lst_prnr_oder = str_prnr_order.split(', ') elif ',' in str_prnr_order: lst_prnr_oder = str_prnr_order.split(',') elif ' ' in str_prnr_order: lst_prnr_oder = str_prnr_order.split(' ') elif len(str_prnr_order) == 3: #只有一个PR号 lst_prnr_oder.append(str_prnr_order) if len(lst_prnr_oder): # 清除 PR 树中已经选中的所有项目 iterator = QTreeWidgetItemIterator(self.botleft) while iterator.value(): item = iterator.value() item.setCheckState(0, Qt.Unchecked) iterator.__iadd__(1) # 安装PR订单重新勾选PR树 for pr in lst_prnr_oder: iterator = QTreeWidgetItemIterator(self.botleft) while iterator.value(): item = iterator.value() if (item.text(0) == pr) and (item.childCount() == 0): item.setCheckState(0, Qt.Checked) break iterator.__iadd__(1)
def get_treeitem(self, qtreewidget): it = QTreeWidgetItemIterator(qtreewidget) while it.value(): yield it.value() it += 1
def __init__(self, *args): QTreeWidgetItemIterator.__init__(self, *args)
def handle_shift_data(self): Tr = float(self.editT.text()) chem = self.cbmaterial.currentText() msg = "Selected T=%g\nSelected material=%s\n"%(Tr, chem) msg += "Do you want to shift all Tables in the current Dataset " msg += "to the chosen temperature using the WLF parameters for the chosen material?" ans = QMessageBox.question( self, "Shift all data", msg, buttons=(QMessageBox.Yes | QMessageBox.No), ) if ans != QMessageBox.Yes: return # Calculate shift factors B1 = self.parameters["B1"].value B2 = self.parameters["B2"].value logalpha = self.parameters["logalpha"].value alpha = np.power(10.0, logalpha) CTg = self.parameters["CTg"].value iso = self.isofrictional.isChecked() vert = self.verticalshift.isChecked() # Get current dataset ds = self.parent_application.DataSettabWidget.currentWidget() if not ds: return # Loop over files for f in ds.files: # Get file Current Temperature Tf = f.file_parameters["T"] Mw = f.file_parameters["Mw"] if "iso" in f.file_parameters: iso_file = (f.file_parameters["iso"].upper() == "TRUE") elif "isof" in f.file_parameters: iso_file = (f.file_parameters["isof"].upper() == "TRUE") else: iso_file=False if iso and not iso_file: B2corrected = B2 + CTg / Mw # - 68.7 * dx12 Trcorrected = Tr - CTg / Mw # + 68.7 * dx12 else: B2corrected = B2 Trcorrected = Tr aT = np.power(10.0, -B1 * (Tf - Trcorrected) / (B2corrected + Trcorrected) / (B2corrected + Tf)) if vert: bT = (1 + alpha * Tf) * (Tr + 273.15) / (1 + alpha * Tr) / (Tf + 273.15) else: bT = 1 # Loop over file type columns for i, c in enumerate(f.file_type.col_names): if c in ["t", "time"]: # Shift horizontally to the left f.data_table.data[:, i] = f.data_table.data[:, i]/aT elif c in ["w"]: # Shift horizontally to the right f.data_table.data[:, i] = f.data_table.data[:, i]*aT elif c in ["G'", "G''", "Gt", "sigma_xy", "N1", "sigma"]: # Shift vertically up f.data_table.data[:, i] = f.data_table.data[:, i]*bT # Change file parameter T to target Temperature f.file_parameters["T"] = Tr it = QTreeWidgetItemIterator(ds.DataSettreeWidget) while it.value(): if (it.value().text(0)==f.file_name_short): for i in range(ds.DataSettreeWidget.columnCount()): if "T" == ds.DataSettreeWidget.headerItem().text(i): it.value().setText(i, str(f.file_parameters["T"])) it+=1; self.do_plot()
def reset_selection(tree): iterator = QTreeWidgetItemIterator(tree, QTreeWidgetItemIterator.Checked) while iterator.value(): item = iterator.value() item.setCheckState(0, Qt.Unchecked) # column, state iterator += 1
def updateOrderDetails(self): # If there is already a garment tree we want to clear out the old lists we do this to catch in an error # in case this function get's called before there is a tree build or grown, ha ha. if self.garmentTree: lstItems = [] # Open a iterator to iterate through the tree (again) and build a list of lists of items in the tree to be added to the table. itOrders = QTreeWidgetItemIterator(self.garmentTree) while itOrders.value(): if itOrders.value() != None: # Below makes sure that there are values for both the price and the quantity. if itOrders.value().text(3) != "" and itOrders.value().text(2) != "": # This makes sure that we are at the correct level in the tree so we do try to add what shouldn't be added if itOrders.value().parent().parent().parent() != None: txtItems = [] txtItems = [itOrders.value().parent().parent().parent().text(0), itOrders.value().parent().parent().text(0), itOrders.value().parent().text(0), itOrders.value().text(0), itOrders.value().text(1), str(format(float(itOrders.value().text(2)) * float(itOrders.value().text(3)), '.2f')), itOrders.value().text(3)] lstItems.append(txtItems) itOrders += 1 # A check to make sure the iterator picked up items from the list. if len(lstItems) > 0: # Build the table to hold the information from the tree. CSRWidgets.tblOrderDetails.setRowCount(len(lstItems)) CSRWidgets.tblOrderDetails.setColumnCount(7) CSRWidgets.tblOrderDetails.setAlternatingRowColors(True) lstHeader = ["Name", "Design", "Category", "Type", "Size", "Price", "Qty" ] CSRWidgets.tblOrderDetails.setHorizontalHeaderLabels(lstHeader) #CSRWidgets.tblOrderDetails.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) CSRWidgets.tblOrderDetails.setWordWrap(False) # Another check to make sure the list is there and has data, then we go through it and add data to the table. if lstItems: for i, row in enumerate(lstItems): for j, col in enumerate(row): item = QTableWidgetItem(col) item.setFlags(Qt.ItemIsEditable) CSRWidgets.tblOrderDetails.setItem(i, j, item) CSRWidgets.tblOrderDetails.resizeColumnsToContents() #self.vBox.addWidget(CSRWidgets.tblOrderDetails) CSRWidgets.tblOrderDetails.show() testBox = CSRWidgets.totalBox(self) self.winGrid.addWidget(testBox, 2, 1, 1, 1) #print("hit update orders") else: CSRWidgets.tblOrderDetails.hide()
def items(self): iterator = QTreeWidgetItemIterator(self.ui.plugins, QTreeWidgetItemIterator.All) while iterator.value(): item = iterator.value() iterator += 1 yield item
def actionClick(self, txt): if not txt: return p = ''.join((r'.*', txt, r'.*')) obj = re.compile(p) cursor = QTreeWidgetItemIterator(self.treeWidget) while cursor.value(): item = cursor.value() if item is not self.treeWidget._rootItem: item.setExpanded(False) item.setSelected(False) cursor = cursor.__iadd__(1) cursor = QTreeWidgetItemIterator(self.treeWidget) while cursor.value(): item = cursor.value() if item is self.treeWidget._rootItem: cursor = cursor.__iadd__(1) continue if item.parent() is self.treeWidget._rootItem: cursor = cursor.__iadd__(1) continue itemtext = item.text(0) if obj.match(itemtext): self.ChangeParentExpanded(item) item.setSelected(True) cursor = cursor.__iadd__(1)