示例#1
0
 def expandEditorTree(self, connectionItem):
     iter = QTreeWidgetItemIterator(connectionItem)
     val = iter.value()
     while val:
         val.setExpanded(True)
         iter += 1
         val = iter.value()
示例#2
0
 def setCurrentTreeItemByData(self, data):
     it = QTreeWidgetItemIterator(self.ui.treeWidget)
     while it.value():
         if it.value().data(0, Qt.UserRole) == data:
             self.ui.treeWidget.setCurrentItem(it.value())
             return True
         it += 1
     return False
示例#3
0
    def passTerminBtn(self):
        if int(self.terminsTreeWidget.currentItem().text(2)) == int(
                self.terminsPerPageComboBos.currentText()):
            self.show_termins_in_list(self.currentPage + 1)
            it = QTreeWidgetItemIterator(self.terminsTreeWidget)
            it.value()
            it += 1
            self.terminsTreeWidget.setCurrentItem(it.value())
            it.value().setSelected(True)
            return

        it = QTreeWidgetItemIterator(self.terminsTreeWidget)
        i = 0
        while it.value():
            if i == int(self.terminsTreeWidget.currentItem().text(2)):
                it += 1
                self.terminsTreeWidget.setCurrentItem(it.value())
                it.value().setSelected(True)
                return
            it += 1
            i += 1
示例#4
0
    def go_to_termin_on_position(self, position):
        print(position)
        if position == int(self.terminsPerPageComboBos.currentText()):
            self.show_termins_in_list(self.currentPage + 1)
            it = QTreeWidgetItemIterator(self.terminsTreeWidget)
            it.value()
            it += 1
            self.terminsTreeWidget.setCurrentItem(it.value())
            it.value().setSelected(True)
            return

        it = QTreeWidgetItemIterator(self.terminsTreeWidget)
        i = 0
        while it.value():
            if i == position:
                if self.showLinkedCheck.isChecked():
                    it += 1
                self.terminsTreeWidget.setCurrentItem(it.value())
                it.value().setSelected(True)
                return
            it += 1
            i += 1
示例#5
0
    def get_rules(self):
        """ Returns a list of the checked off rules """
        rules = []

        iterator = QTreeWidgetItemIterator(self)
        item = iterator.value()
        while item:
            if item.checkState(0) == Qt.Checked and item.rule:
                rules.append(item.rule)
            iterator += 1
            item = iterator.value()

        return rules
示例#6
0
    def check_all(self, check=True):
        """ Checks or uncheck all

        Args:
            check: true if check, false if uncheck
        """
        status = Qt.Checked if check else Qt.Unchecked
        iterator = QTreeWidgetItemIterator(self)
        item = iterator.value()
        while item:
            item.setCheckState(0, status)
            iterator += 1
            item = iterator.value()
示例#7
0
 def on_remove_testcase(self):
     """
     slot function for remove test case button
     :return:
     """
     info = u'是否删除所选测试用例(已存储的用例文件请手动删除)!!!'
     if QMessageBox.Yes == QMessageBox.question(self, u'询问', info, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes):
         items = QTreeWidgetItemIterator(self.testcase_tree)
         while items.value():
             if items.value().checkState(0) == Qt.Checked:
                 self.test_cases.pop(str(items.value().text(0)))
                 self.testcase_tree.takeTopLevelItem(self.testcase_tree.indexOfTopLevelItem(items.value()))
                 continue
             items += 1
示例#8
0
    def whoosh_index(self):
        it = QTreeWidgetItemIterator(self.notesTree,
                                     QTreeWidgetItemIterator.All)
        print("Starting complete indexing.")
        #writer = self.ix.writer()
        writer = AsyncWriter(self.ix)
        while it.value():
            treeItem = it.value()
            name = self.notesTree.itemToPage(treeItem)
            path = os.path.join(self.notesTree.pageToFile(name)).replace(
                os.sep, '/')
            print(path)
            fileobj = open(path, 'r', encoding='utf-8')
            content = fileobj.read()
            fileobj.close()
            if METADATA_CHECKER.match(
                    content) and 'meta' in self.settings.extensions:
                no_metadata_content = METADATA_CHECKER.sub("",
                                                           content,
                                                           count=1).lstrip()
                self.settings.md.reset().convert(content)
                writer.update_document(
                    path=name,
                    title=parseTitle(content, name),
                    content=no_metadata_content,
                    tags=','.join(self.settings.md.Meta.get('tags',
                                                            [])).strip())
            else:
                writer.add_document(path=name,
                                    title=parseTitle(content, name),
                                    content=content,
                                    tags='')

            it += 1
        writer.commit()
        print("Finished completely reindexing.")