Python qtpy.QtWidgets.QTreeWidgetItem() Examples

The following are 15 code examples of qtpy.QtWidgets.QTreeWidgetItem(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qtpy.QtWidgets , or try the search function .
Example #1
Source File: main.py    From TuChart with MIT License 6 votes vote down vote up
def init_treeWidget(self, list1, series):
        self.ui.treeWidget.clear()
        for j in list1:
            parent = QTreeWidgetItem(self.ui.treeWidget)  #populate treewidget with names
            parent.setText(0,j)
            var = series.loc[series["c_name"] == j]
            list2 = var["code"].tolist()
            name = var["name"].tolist()
            #var = showcollection(i) #Display database items
            for idx,val in enumerate(list2):
                child = QTreeWidgetItem(parent)
                child.setText(0, name[idx]+"-"+val)
                #for i in Drag:
                    #grandson = QTreeWidgetItem(child)     #Commented out because increases program response time
                    #grandson.setText(0, i)
        #self.ui.treeWidget.itemDoubleClicked.connect(self.onClickItem) #Display Collection items 
Example #2
Source File: main.py    From TuChart with MIT License 6 votes vote down vote up
def init_treeWidget(self, list1, series):
        self.ui.treeWidget.clear()
        for j in list1:
            parent = QTreeWidgetItem(self.ui.treeWidget)  #populate treewidget with names
            parent.setText(0,j)
            var = series.loc[series["c_name"] == j]
            list2 = var["code"].tolist()
            name = var["name"].tolist()
            #var = showcollection(i) #Display database items
            for idx,val in enumerate(list2):
                child = QTreeWidgetItem(parent)
                child.setText(0, name[idx]+"-"+str(val))
                #for i in Drag:
                    #grandson = QTreeWidgetItem(child)     #Commented out because increases program response time
                    #grandson.setText(0, i)
        #self.ui.treeWidget.itemDoubleClicked.connect(self.onClickItem) #Display Collection items 
Example #3
Source File: main.py    From TuChart with MIT License 6 votes vote down vote up
def init_treeWidget(self, list1, series):
        self.ui.treeWidget.clear()
        for j in list1:
            parent = QTreeWidgetItem(self.ui.treeWidget)  #populate treewidget with names
            parent.setText(0,j)
            var = series.loc[series["c_name"] == j]
            list2 = var["code"].tolist()
            name = var["name"].tolist()
            #var = showcollection(i) #Display database items
            for idx,val in enumerate(list2):
                child = QTreeWidgetItem(parent)
                child.setText(0, name[idx]+"-"+str(val))
                #for i in Drag:
                    #grandson = QTreeWidgetItem(child)     #Commented out because increases program response time
                    #grandson.setText(0, i)
        #self.ui.treeWidget.itemDoubleClicked.connect(self.onClickItem) #Display Collection items 
Example #4
Source File: startup_widget.py    From pyrpl with GNU General Public License v3.0 6 votes vote down vote up
def add_device(self, hostname, token):
        self.ips_and_macs.append((hostname, token))
        item = QtWidgets.QTreeWidgetItem()
        item.setText(0, hostname)
        item.setText(1, token)
        self.items.append(item)
        self.tree.addTopLevelItem(item)
        self.tree.resizeColumnToContents(0)
        self.tree.resizeColumnToContents(1)
        # if only one non-fake device is available
        if len(self.ips_and_macs) == 2 and self.hostname == '' or \
                self.hostname == hostname:
            self.hostname = hostname
            self.tree.clearSelection()
            item.setSelected(True)
        return item 
Example #5
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def code_sort_tree(self, companies):
        self.ui.treeWidget.clear()
        sorted_comps = companies.sort_values(["code"])
        code_list = sorted_comps["code"].tolist()
        name_list = sorted_comps["name"].tolist()
        shares_parent = QTreeWidgetItem(self.ui.treeWidget)
        shares_parent.setText(0, "个股行情")
        for idx, val in enumerate(code_list):
            child = QTreeWidgetItem(shares_parent)
            child.setText(0, name_list[idx] + "-" + str(val))
        self.ui.treeWidget.expandToDepth(0) 
Example #6
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def search_comp(self, companies):
        self.ui.treeWidget.clear()
        text = self.ui.search_lineEdit.text()
        filtered_codes = companies[companies['code'].str.contains(text)]
        filtered_names = companies[companies['name'].str.contains(text)]
        filtered_comps = filtered_codes.append(filtered_names)
        code_list = filtered_comps["code"].tolist()
        name_list = filtered_comps["name"].tolist()
        parent = QTreeWidgetItem(self.ui.treeWidget)
        parent.setText(0, "搜索结果")
        for idx, val in enumerate(code_list):
            child = QTreeWidgetItem(parent)
            child.setText(0, name_list[idx] + "-" + str(val))
        self.ui.treeWidget.expandToDepth(0) 
Example #7
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def methodSelected(self, action, collec):
        # print(action.text()) #Choice
        # if (self.ui.treewidget.count() == 5):
        #   self.ui.label.setText("Maximum number of queries")
        #   return
        # self.ui.label.setText("")
        Choice = action.text()
        Stock = collec
        # print(collec)  #Stock Name
        # print(db_origin)  #DataBase name
        # list1 = [self.tr(Stock+"-"+Choice+"-"+db_origin)]
        # self.ui.treewidget.addItems(list1)
        parent = QTreeWidgetItem(self.ui.treeWidget_2)
        parent.setText(0, Stock+ "-" + Choice) 
Example #8
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def search_comp(self, companies):
        self.ui.treeWidget.clear()
        text = self.ui.search_lineEdit.text()
        filtered_codes = companies[companies['code'].str.contains(text)]
        filtered_names = companies[companies['name'].str.contains(text)]
        filtered_comps = filtered_codes.append(filtered_names)
        code_list = filtered_comps["code"].tolist()
        name_list = filtered_comps["name"].tolist()
        parent = QTreeWidgetItem(self.ui.treeWidget)
        parent.setText(0, "搜索结果")
        for idx, val in enumerate(code_list):
            child = QTreeWidgetItem(parent)
            child.setText(0, name_list[idx] + "-" + str(val))
        self.ui.treeWidget.expandToDepth(0) 
Example #9
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def methodSelected(self, action, collec):
        # print(action.text()) #Choice
        # if (self.ui.treewidget.count() == 5):
        #   self.ui.label.setText("Maximum number of queries")
        #   return
        # self.ui.label.setText("")
        Choice = action.text()
        Stock = collec
        # print(collec)  #Stock Name
        # print(db_origin)  #DataBase name
        # list1 = [self.tr(Stock+"-"+Choice+"-"+db_origin)]
        # self.ui.treewidget.addItems(list1)
        parent = QTreeWidgetItem(self.ui.treeWidget_2)
        parent.setText(0, Stock.decode("utf-8") + "-" + Choice) 
Example #10
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def code_sort_tree(self, companies):
        self.ui.treeWidget.clear()
        sorted_comps = companies.sort_values(["code"])
        code_list = sorted_comps["code"].tolist()
        name_list = sorted_comps["name"].tolist()
        shares_parent = QTreeWidgetItem(self.ui.treeWidget)
        shares_parent.setText(0, "个股行情")
        for idx, val in enumerate(code_list):
            child = QTreeWidgetItem(shares_parent)
            child.setText(0, name_list[idx] + "-" + str(val))
        self.ui.treeWidget.expandToDepth(0) 
Example #11
Source File: main.py    From TuChart with MIT License 5 votes vote down vote up
def search_comp(self, companies):
        self.ui.treeWidget.clear()
        text = self.ui.search_lineEdit.text()
        filtered_codes = companies[companies['code'].str.contains(text)]
        filtered_names = companies[companies['name'].str.contains(text)]
        filtered_comps = filtered_codes.append(filtered_names)
        code_list = filtered_comps["code"].tolist()
        name_list = filtered_comps["name"].tolist()
        parent = QTreeWidgetItem(self.ui.treeWidget)
        parent.setText(0, "搜索结果")
        for idx, val in enumerate(code_list):
            child = QTreeWidgetItem(parent)
            child.setText(0, name_list[idx] + "-" + str(val))
        self.ui.treeWidget.expandToDepth(0) 
Example #12
Source File: mainwindow.py    From qtmodern with MIT License 5 votes vote down vote up
def load_project_structure(self, startpath, tree):
        for element in listdir(startpath):
            path_info = startpath + "/" + element
            parent_itm = QTreeWidgetItem(tree, [basename(element)])
            if isdir(path_info):
                self.load_project_structure(path_info, parent_itm) 
Example #13
Source File: wdiag.py    From pyCGNS with GNU Lesser General Public License v2.1 5 votes vote down vote up
def addPathEntry(self, parent, path, state, top=False):
        it = QTreeWidgetItem(parent, (path,))
        ft = QFont(OCTXT._Table_Font)
        if top:
            ft.setBold(True)
        it.setFont(0, ft)
        if state == CGM.CHECK_FAIL:
            it.setIcon(0, self.IC(QW.I_C_SFL))
        if state == CGM.CHECK_WARN:
            it.setIcon(0, self.IC(QW.I_C_SWR))
        return it 
Example #14
Source File: wdiag.py    From pyCGNS with GNU Lesser General Public License v2.1 5 votes vote down vote up
def addDiagEntry(self, parent, diag, top=False):
        dit = QTreeWidgetItem(parent, (self._data.message(diag),))
        ft = QFont(OCTXT._Table_Font)
        if top:
            ft.setBold(True)
        dit.setFont(0, ft)
        if diag.level == CGM.CHECK_FAIL:
            dit.setIcon(0, self.IC(QW.I_C_SFL))
        if diag.level == CGM.CHECK_WARN:
            dit.setIcon(0, self.IC(QW.I_C_SWR))
        if diag.key not in self._filterItems:
            self._filterItems[diag.key] = [dit]
        else:
            self._filterItems[diag.key].insert(0, dit)
        return dit 
Example #15
Source File: thread.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, jobs: Sequence[QTreeWidgetItem], degenerate: int, parent: QWidget):
        super(GraphThread, self).__init__(parent)
        self.jobs = jobs
        self.degenerate = degenerate