Python PyQt5.QtGui 模块,QStandardItem() 实例源码

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

项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def init_widget(self):
        self.setWindowTitle("Hello World")
        widget_laytout = QBoxLayout(QBoxLayout.LeftToRight)

        group = QGroupBox()
        box = QBoxLayout(QBoxLayout.TopToBottom)
        group.setLayout(box)
        group.setTitle("Buttons")
        widget_laytout.addWidget(group)

        fruits = ["Buttons in GroupBox", "TextBox in GroupBox", "Label in GroupBox", "TextEdit"]
        view = QListView(self)
        model = QStandardItemModel()
        for f in fruits:
            model.appendRow(QStandardItem(f))
        view.setModel(model)
        box.addWidget(view)

        self.stk_w.addWidget(Widget_1())
        self.stk_w.addWidget(Widget_2())
        self.stk_w.addWidget(Widget_3())
        self.stk_w.addWidget(QTextEdit())

        widget_laytout.addWidget(self.stk_w)
        self.setLayout(widget_laytout)

        # ??? ?? ??
        view.clicked.connect(self.slot_clicked_item)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def AddShapeRowLayer(self, shape, parent_item):
        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/shape.png"))
        item_col_0 = QStandardItem(icon, "")
        item_col_0.setData(QVariantShape(shape), SHAPE_OBJECT)  # store a ref in our treeView element
        item_col_1 = QStandardItem(shape.type)
        item_col_2 = QStandardItem(str(shape.nr))
        item_col_3 = QStandardItem()
        parent_item.appendRow([item_col_0, item_col_1, item_col_2, item_col_3])

        # Deal with the checkboxes (shape enabled or disabled / send shape to TSP optimizer)
        item_col_0.setCheckState(QtCore.Qt.Unchecked if shape.isDisabled() else QtCore.Qt.Checked)
        item_col_3.setCheckState(QtCore.Qt.Checked if shape.isToolPathOptimized() else QtCore.Qt.Unchecked)

        flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable
        if shape.allowedToChange:
            flags |= QtCore.Qt.ItemIsEnabled
        item_col_0.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
        item_col_1.setFlags(flags)
        item_col_2.setFlags(flags)
        item_col_3.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def AddCustomGCodeRowLayer(self, custom_gcode, parent_item, push_row=None):
        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/custom.png"))
        item_col_0 = QStandardItem(icon, "")  # will only display a checkbox + an icon that will never be disabled
        item_col_0.setData(QtCore.QVariant(custom_gcode), CUSTOM_GCODE_OBJECT)  # store a ref to the custom gcode in our treeView element
        item_col_1 = QStandardItem(custom_gcode.name)
        item_col_2 = QStandardItem(str(custom_gcode.nr))
        item_col_3 = QStandardItem()
        if push_row:
            parent_item.insertRow(push_row, [item_col_0, item_col_1, item_col_2, item_col_3])
        else:
            parent_item.appendRow([item_col_0, item_col_1, item_col_2, item_col_3])

        # Deal with the checkboxes (shape enabled or disabled / send shape to TSP optimizer)
        item_col_0.setCheckState(QtCore.Qt.Unchecked if custom_gcode.isDisabled() else QtCore.Qt.Checked)

        flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
        item_col_0.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
        item_col_1.setFlags(flags)
        item_col_2.setFlags(flags)
        item_col_3.setFlags(flags)
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def updateTalents(self):
        if self.currentFertName != "":
            self.model.clear()
            for el in Wolke.Char.fertigkeiten[self.currentFertName].gekaufteTalente:
                if el.startswith("Gebräuche: "):
                    talStr = el[11:]
                elif el.startswith("Mythen: "):
                    talStr = el[8:]
                elif el.startswith("Überleben: "):
                    talStr = el[11:]
                else:
                    talStr = el
                item = QtGui.QStandardItem(talStr)
                item.setEditable(False)
                self.model.appendRow(item)
            self.updateTalentRow()
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def updateTalents(self):
        if self.currentFertName != "":
            self.model.clear()
            for el in Wolke.Char.übernatürlicheFertigkeiten[self.currentFertName].gekaufteTalente:
                if el.startswith("Gebräuche: "):
                    talStr = el[11:]
                elif el.startswith("Mythen: "):
                    talStr = el[8:]
                elif el.startswith("Überleben: "):
                    talStr = el[11:]
                else:
                    talStr = el
                if el in Wolke.DB.talente:
                    if el in Wolke.Char.talenteVariable:
                        costStr = " (" + str(Wolke.Char.talenteVariable[el]) + " EP)"    
                    else:
                        costStr = " (" + str(Wolke.DB.talente[el].kosten) + " EP)"
                else:
                    costStr = ""
                item = QtGui.QStandardItem(talStr + costStr)
                item.setEditable(False)
                self.model.appendRow(item)
            self.updateTalentRow()
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def add_nodeset(self):
        path, ok = QFileDialog.getOpenFileName(self.view, caption="Import OPC UA XML Node Set", filter="XML Files (*.xml *.XML)", directory=".")
        if not ok:
            return None
        name = os.path.basename(path)
        if name in self.nodesets:
            return
        try:
            self.server_mgr.import_xml(path)
        except Exception as ex:
            self.error.emit(ex)
            raise

        item = QStandardItem(name)
        self.model.appendRow([item])
        self.nodesets.append(name)
        self.view.expandAll()
        self.nodeset_added.emit(path)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupModel(self):
        self.model = QStandardItemModel(5, 3, self)
        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        ages = ("20", "31", "32", "19", "26")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(ages[row])
            self.model.setItem(row, 2, item)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupModel(self):
        items = ("Home", "Work", "Other")
        self.typeModel = QStringListModel(items, self)

        self.model = QStandardItemModel(5, 3, self)

        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        types = ("0", "1", "2", "0", "2")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(types[row])
            self.model.setItem(row, 2, item)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def setupModel(self):
        self.model = QStandardItemModel(5, 3, self)
        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        ages = ("20", "31", "32", "19", "26")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(ages[row])
            self.model.setItem(row, 2, item)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def setupModel(self):
        items = ("Home", "Work", "Other")
        self.typeModel = QStringListModel(items, self)

        self.model = QStandardItemModel(5, 3, self)

        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        types = ("0", "1", "2", "0", "2")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(types[row])
            self.model.setItem(row, 2, item)
项目:ETS2Autopilot    作者:BrunoTh    | 项目源码 | 文件源码
def fill_sequence_list(self):
        """
        Fill sequence_list with data.
        """
        data = Data()
        sequence_list = self.ui.sequence_list

        model = QStandardItemModel(sequence_list)
        sequences = data.get_sequence_list()
        if len(sequences) > 0:
            for sequence in sequences:
                note = ""
                if sequence[4] is not None:
                    note = " - %s" % sequence[4]
                item = QStandardItem("%s%s" % (sequence[1], note))
                item.setEditable(False)
                item.setData(str(sequence[0]), QtCore.Qt.UserRole)
                model.insertRow(0, item)
        sequence_list.setModel(model)
项目:ETS2Autopilot    作者:BrunoTh    | 项目源码 | 文件源码
def fill_image_list(self):
        """
        Fill list_image with data.
        """
        data = Data()
        list_images = self.ui.list_images

        model = QStandardItemModel(list_images)
        images = data.get_image_list(self.sequence_id)
        if len(images) > 0:
            for image in images:
                item = QStandardItem("%s - %s" % (image[1], functions.get_indicator(image[5])))
                item.setEditable(False)
                item.setData(str(image[0]), QtCore.Qt.UserRole)
                model.appendRow(item)
        list_images.setModel(model)
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def _focus_match(self, idx, start, end):
        self._api.subs.selected_indexes = [idx]
        mispelt_word = self._api.subs.lines[idx].text[start:end]

        cursor = self._main_window.editor.center.text_edit.textCursor()
        cursor.setPosition(start)
        cursor.setPosition(end, QtGui.QTextCursor.KeepAnchor)
        self._main_window.editor.center.text_edit.setTextCursor(cursor)

        self._mispelt_text_edit.setText(mispelt_word)

        self._suggestions_list_view.model().clear()
        for suggestion in self._dictionary.suggest(mispelt_word):
            item = QtGui.QStandardItem(suggestion)
            item.setEditable(False)
            self._suggestions_list_view.model().appendRow(item)
项目:fomod-designer    作者:GandaG    | 项目源码 | 文件源码
def update_set_flags(self):
        for button in self.findChildren((QCheckBox, QRadioButton), "preview_button"):
            if button.isChecked():
                for flag in button.property("flag_list"):
                    flag_label = QStandardItem(flag.label)
                    flag_value = QStandardItem(flag.value)
                    flag_plugin = QStandardItem(button.text())
                    existing_flag = self.model_flags.findItems(flag.label)
                    if existing_flag:
                        previous_flag_row = existing_flag[0].row()
                        self.model_flags.removeRow(previous_flag_row)
                        self.model_flags.insertRow(previous_flag_row, [flag_label, flag_value, flag_plugin])
                    else:
                        self.model_flags.appendRow([flag_label, flag_value, flag_plugin])

        self.list_flags.header().resizeSections(QHeaderView.Stretch)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def setupModel(self):
        self.model = QStandardItemModel(5, 3, self)
        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        ages = ("20", "31", "32", "19", "26")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(ages[row])
            self.model.setItem(row, 2, item)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def setupModel(self):
        items = ("Home", "Work", "Other")
        self.typeModel = QStringListModel(items, self)

        self.model = QStandardItemModel(5, 3, self)

        names = ("Alice", "Bob", "Carol", "Donald", "Emma")
        addresses = ("<qt>123 Main Street<br/>Market Town</qt>",
                     "<qt>PO Box 32<br/>Mail Handling Service"
                     "<br/>Service City</qt>",
                     "<qt>The Lighthouse<br/>Remote Island</qt>",
                     "<qt>47338 Park Avenue<br/>Big City</qt>",
                     "<qt>Research Station<br/>Base Camp<br/>Big Mountain</qt>")
        types = ("0", "1", "2", "0", "2")

        for row, name in enumerate(names):
            item = QStandardItem(name)
            self.model.setItem(row, 0, item)
            item = QStandardItem(addresses[row])
            self.model.setItem(row, 1, item)
            item = QStandardItem(types[row])
            self.model.setItem(row, 2, item)
项目:EMFT    作者:132nd-etcher    | 项目源码 | 文件源码
def appendRow(self, output_folder_name: str):  # noqa: N802
        item = QStandardItem(output_folder_name)
        super(OutputFoldersModel, self).appendRow(item)
项目:EMFT    作者:132nd-etcher    | 项目源码 | 文件源码
def appendRow(self, output_folder_name: str):  # noqa: N802
        item = QStandardItem(output_folder_name)
        super(AutoProfileModel, self).appendRow(item)
项目:EMFT    作者:132nd-etcher    | 项目源码 | 文件源码
def appendRow(self, branch_name: str):  # noqa: N802
        item = QStandardItem(branch_name)
        super(BranchesModel, self).appendRow(item)
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def type(self):
        return QtGui.QStandardItem.UserType + 4
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def data(self, role=Qt.Qt.DisplayRole):
        if role == Qt.Qt.DisplayRole:
            return self._name
        if role == Qt.Qt.ToolTipRole:
            return self._name
        if role == Qt.Qt.FontRole:
            return QtGui.QStandardItem.data(self, role=role)
        else:
            return super().data(role=role)
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def type(self):
        return QtGui.QStandardItem.UserType + 6
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def type(self):
        return QtGui.QStandardItem.UserType + 7
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def type(self):
        return QtGui.QStandardItem.UserType + 1
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def type(self):
        return QtGui.QStandardItem.UserType + 3
项目:mnelab    作者:cbrnr    | 项目源码 | 文件源码
def __init__(self, parent, info, title="Channel Properties"):
        super().__init__(parent)
        self.setWindowTitle(title)

        self.model = QStandardItemModel(info["nchan"], 4)
        self.model.setHorizontalHeaderLabels(["#", "Label", "Type", "Bad"])
        for index, ch in enumerate(info["chs"]):
            item = QStandardItem()
            item.setData(index, Qt.DisplayRole)
            item.setFlags(item.flags() & ~Qt.ItemIsEditable)
            self.model.setItem(index, 0, item)
            self.model.setItem(index, 1, QStandardItem(ch["ch_name"]))
            kind = channel_type(info, index).upper()
            self.model.setItem(index, 2, QStandardItem(str(kind)))
            bad = QStandardItem()
            bad.setData(ch["ch_name"] in info["bads"], Qt.UserRole)
            bad.setCheckable(True)
            bad.setEditable(False)
            checked = ch["ch_name"] in info["bads"]
            bad.setCheckState(Qt.Checked if checked else Qt.Unchecked)
            self.model.setItem(index, 3, bad)

        self.model.itemChanged.connect(bad_changed)
        self.proxymodel = MySortFilterProxyModel()
        self.proxymodel.setSourceModel(self.model)

        self.view = QTableView()
        self.view.setModel(self.proxymodel)
        self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self.view))
        self.view.setEditTriggers(QAbstractItemView.AllEditTriggers)
        self.view.verticalHeader().setVisible(False)
        self.view.horizontalHeader().setStretchLastSection(True)
        self.view.setShowGrid(False)
        self.view.setSelectionMode(QAbstractItemView.NoSelection)
        self.view.setSortingEnabled(True)
        self.view.sortByColumn(0, Qt.AscendingOrder)
        self.view.resizeColumnsToContents()
        # for i in range(self.model.rowCount()):
        #         self.view.openPersistentEditor(self.model.index(i, 2))

        vbox = QVBoxLayout(self)
        vbox.addWidget(self.view)
        self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        vbox.addWidget(self.buttonbox)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)

        self.resize(400, 650)
项目:ida_strcluster    作者:Comsecuris    | 项目源码 | 文件源码
def __init__(self, s, ea):
        super(QtGui.QStandardItem, self).__init__(s)
        self.ea = ea
项目:acbDecrypter    作者:Rieksee    | 项目源码 | 文件源码
def read_file(self, file):
        if file is None:
            return
        with open(file, 'r') as f:
            for line in f:
                lis = line.split(' : ')
                if len(lis) != 2:
                    continue
                key = (lis[1], lis[0])
                self.keys.append(key)
        self.ui.model = QtGui.QStandardItemModel(self.ui.listView)
        for key in self.keys:
            item = QtGui.QStandardItem(key[0].rstrip('\n'))
            self.ui.model.appendRow(item)
        self.ui.listView.setModel(self.ui.model)
项目:acbDecrypter    作者:Rieksee    | 项目源码 | 文件源码
def read_file(self, file):
        with open(file, 'r') as f:
            for line in f:
                lis = line.split(' : ')
                if len(lis) != 2:
                    continue
                key = (lis[1], lis[0])
                self.keys.append(key)
        self.ui.model = QtGui.QStandardItemModel(self.ui.listView)
        for key in self.keys:
            item = QtGui.QStandardItem(key[0].rstrip('\n'))
            self.ui.model.appendRow(item)
        self.ui.listView.setModel(self.ui.model)
项目:BiocImageBuilder    作者:Bioconductor-notebooks    | 项目源码 | 文件源码
def LoadBiocPakageList(self):
        # loading
        item = QStandardItem(" >>> Loading bioconductor package list <<< ")
        self.model_package.appendRow(item)
        self.lstPackages.setModel(self.package_list_proxy)
        self.lstPackages.resizeColumnsToContents()

        self.loadpackage_thread = BiocPackageList()
        self.loadpackage_thread.load_completed.connect(self.ThreadEvent_OnLoadBiocPackageCompleted)
        self.loadpackage_thread.start()
项目:BiocImageBuilder    作者:Bioconductor-notebooks    | 项目源码 | 文件源码
def ThreadEvent_OnLoadBiocPackageCompleted(self, packagelist):
        self.model_package.removeRows(0, self.model_package.rowCount())
        for pkg in packagelist:
            itemName = QStandardItem(pkg['Name'])
            itemName.setCheckable(True)
            itemTitle = QStandardItem(pkg['Title'])
            self.model_package.appendRow([itemName, itemTitle])

        # Apply the model to the list view
        self.lstPackages.setModel(self.package_list_proxy)
        #self.lstPackages.resizeColumnToContents(0)
        self.lstPackages.setColumnWidth(0, 190)
        self.lstPackages.setColumnWidth(1, 130)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def buildEntitiesTree(self, entities_list):
        """
        This method populates the Entities (blocks) QTreeView with
        all the elements contained in the entities_list
        Method must be called each time a new .dxf file is loaded.
        options
        @param entities_list: list of the layers and shapes (created in the main)
        """

        self.entities_list = entities_list
        if self.entity_item_model:
            self.entity_item_model.clear()  # Remove any existing item_model
        self.entity_item_model = QStandardItemModel()
        self.entity_item_model.setHorizontalHeaderItem(0, QStandardItem(self.tr("[en]")))
        self.entity_item_model.setHorizontalHeaderItem(1, QStandardItem(self.tr("Name")))
        self.entity_item_model.setHorizontalHeaderItem(2, QStandardItem(self.tr("Nr")))
        self.entity_item_model.setHorizontalHeaderItem(3, QStandardItem(self.tr("Type")))
        self.entity_item_model.setHorizontalHeaderItem(4, QStandardItem(self.tr("Base point")))
        self.entity_item_model.setHorizontalHeaderItem(5, QStandardItem(self.tr("Scale")))
        self.entity_item_model.setHorizontalHeaderItem(6, QStandardItem(self.tr("Rotation")))
        modele_root_element = self.entity_item_model.invisibleRootItem()

        self.buildEntitiesSubTree(modele_root_element, entities_list)

        # Signal to get events when a checkbox state changes (enable or disable shapes)
        self.entity_item_model.itemChanged.connect(self.on_itemChanged)

        self.ui.entitiesTreeView.setModel(self.entity_item_model)

        self.ui.entitiesTreeView.expandToDepth(0)

        for i in range(6):
            self.ui.entitiesTreeView.resizeColumnToContents(i)
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def updateGUI(self):
        self.model.clear()
        if self.ui.showTalente.isChecked():
            for itm in self.datenbank.talente:
                item = QtGui.QStandardItem(itm + " : Talent")
                item.setEditable(False)
                self.model.appendRow(item)
        if self.ui.showVorteile.isChecked():
            for itm in self.datenbank.vorteile:
                item = QtGui.QStandardItem(itm + " : Vorteil")
                item.setEditable(False)
                self.model.appendRow(item) 
        if self.ui.showFertigkeiten.isChecked():
            for itm in self.datenbank.fertigkeiten:
                item = QtGui.QStandardItem(itm + " : Fertigkeit")
                item.setEditable(False)
                self.model.appendRow(item) 
        if self.ui.showUebernatuerlicheFertigkeiten.isChecked():
            for itm in self.datenbank.übernatürlicheFertigkeiten:
                item = QtGui.QStandardItem(itm + " : Übernatürliche Fertigkeit")
                item.setEditable(False)
                self.model.appendRow(item) 
        if self.ui.showWaffen.isChecked():
            for itm in self.datenbank.waffen:
                item = QtGui.QStandardItem(itm + " : Waffe")
                item.setEditable(False)
                self.model.appendRow(item) 
        self.ui.listDatenbank.setModel(self.model)
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def set_server_mgr(self, server_mgr):
        self.server_mgr = server_mgr
        self.nodesets = []
        self.model.clear()
        self.model.setHorizontalHeaderLabels(['Node Sets'])
        item = QStandardItem("Opc.Ua.NodeSet2.xml")
        item.setFlags(Qt.NoItemFlags)
        self.model.appendRow([item])
        self.view.expandAll()
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def add_namespace(self):
        uries = self.node.get_value()
        newidx = len(uries)
        it = self.model.item(0, 0)
        uri_it = QStandardItem("")
        it.appendRow([QStandardItem(), QStandardItem(str(newidx)), uri_it])
        idx = self.model.indexFromItem(uri_it)
        self.view.edit(idx)
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def show_array(self):
        self.model.setHorizontalHeaderLabels(['Browse Name', 'Index', 'Value'])

        name_item = QStandardItem(self.node.get_browse_name().Name)
        self.model.appendRow([name_item, QStandardItem(""), QStandardItem()])
        it = self.model.item(0, 0)
        val = self.node.get_value()
        for idx, url in enumerate(val):
            it.appendRow([QStandardItem(), QStandardItem(str(idx)), QStandardItem(url)])
        self.view.expandAll()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def add_item(self):
        self.model.appendRow(QStandardItem('Hello , world!!'))
项目:LoL-Expert    作者:Mioced    | 项目源码 | 文件源码
def Update_Server_Status(self, data):
        self.status_model.clear()

        for status in data:
            loc = ""
            for locale in status[ServerLocales]:
                loc += "%s, " % locale

            game = QtGui.QStandardItem(status[ServerServices][0]["status"])
            game.setForeground(QtGui.QBrush(QtGui.QColor(28, 196, 2)) if status[ServerServices][0]["status"] == "online" else QtGui.QBrush(QtGui.QColor(255, 0, 0)))

            store = QtGui.QStandardItem(status[ServerServices][1]["status"])
            store.setForeground(QtGui.QBrush(QtGui.QColor(28, 196, 2)) if status[ServerServices][1]["status"] == "online" else QtGui.QBrush(QtGui.QColor(255, 0, 0)))

            website = QtGui.QStandardItem(status[ServerServices][2]["status"])
            website.setForeground(QtGui.QBrush(QtGui.QColor(28, 196, 2)) if status[ServerServices][2]["status"] == "online" else QtGui.QBrush(QtGui.QColor(255, 0, 0)))

            client = QtGui.QStandardItem(status[ServerServices][3]["status"])
            client.setForeground(QtGui.QBrush(QtGui.QColor(28, 196, 2)) if status[ServerServices][3]["status"] == "online" else QtGui.QBrush(QtGui.QColor(255, 0, 0)))

            client_update = QtGui.QStandardItem(status[ServerServices][4]["status"])
            client_update.setForeground(QtGui.QBrush(QtGui.QColor(28, 196, 2)) if status[ServerServices][4]["status"] == "online" else QtGui.QBrush(QtGui.QColor(255, 0, 0)))

            self.status_model.appendRow([QtGui.QStandardItem(status[ServerName]), 
                                        QtGui.QStandardItem(status[ServerHostName]), 
                                        QtGui.QStandardItem(status[ServerSlug]),
                                        game,
                                        store,
                                        website,
                                        client,
                                        client_update,
                                        QtGui.QStandardItem(loc)
                                    ])

        self.status_model.setHorizontalHeaderLabels(["Name", "Host Name", "Slug", "Game", "Store", "Website", "Client", "Client Update", "Locales"])

        self.serversView.resizeColumnsToContents()
        self.serversView.resizeRowsToContents()

        self.UpdateStatus("<b>Servers Status</b> added to UI successfully.")
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self, data=None, parent=None):
        QStandardItemModel.__init__(self, parent)
        for i, d in enumerate(data):
            col_1 = QStandardItem(d["name"])
            col_2 = QStandardItem(d["image"])
            col_3 = QStandardItem(d["color"])
            self.setItem(i, 0, col_1)
            self.setItem(i, 1, col_2)
            self.setItem(i, 2, col_3)
        self.setHorizontalHeaderLabels(["Name", "Image", "Color"])
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self, data=None, parent=None):
        QStandardItemModel.__init__(self, parent)
        for i, d in enumerate(data):
            item = QStandardItem(d["name"])
            item.setData(d["image"], Qt.DecorationRole)
            self.setItem(i, 0, item)
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self, data=None, parent=None):
        QStandardItemModel.__init__(self, parent)
        for i, d in enumerate(data):
            self.setItem(i, 0, QStandardItem(d))
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)
        self.setWindowTitle("ItemView QListView")
        self.setFixedHeight(100)

        fruits = ["banana", "apple", "melon", "pear"]

        view = QListView(self)
        model = QStandardItemModel()
        for f in fruits:
            model.appendRow(QStandardItem(f))
        view.setModel(model)
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self, data):
        QStandardItemModel.__init__(self)
        self._data = data
        for j, d in enumerate(data):
            item = QStandardItem(d["type"])
            for obj in d["objects"]:
                child = QStandardItem(obj)
                child.setData(d["picture"], Qt.DecorationRole)  # Role ??? ? ?? ??? ? ??? ??
                item.appendRow(child)
            self.setItem(j, 0, item)
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self, data):
        QStandardItemModel.__init__(self)

        d = data[0]  # Fruit
        item = QStandardItem(d["type"])
        child = QStandardItem(d["objects"][0])  # Apple
        item.appendRow(child)
        child = QStandardItem(d["objects"][1])  # Banana
        item.appendRow(child)
        self.setItem(0, 0, item)

        d = data[1]  # Vegetable
        item = QStandardItem(d["type"])
        child = QStandardItem(d["objects"][0])  # Carrot
        item.appendRow(child)
        child = QStandardItem(d["objects"][1])  # Tomato
        item.appendRow(child)
        self.setItem(1, 0, item)

        # for ?? ???? ???? ??
        # for j, _type in enumerate(data):
        #   item = QStandardItem(_type["type"])
        #   for obj in _type["objects"]:
        #       child = QStandardItem(obj)
        #       item.appendRow(child)
        #   self.setItem(j, 0, item)
项目:solar-sails    作者:metrasynth    | 项目源码 | 文件源码
def add_path(self, path):
        if path not in self._paths:
            self._paths.append(path)
            item = QStandardItem(path)
            self.appendRow(item)
            self._save_settings()
项目:solar-sails    作者:metrasynth    | 项目源码 | 文件源码
def _load_settings(self):
        App.settings.beginGroup('sunvox')
        try:
            paths = App.settings.value('workspace_paths')
            if paths is not None:
                self._paths = paths
                self.clear()
                for path in paths:
                    self.appendRow(QStandardItem(path))
        finally:
            App.settings.endGroup()
项目:Pesterchum-Discord    作者:henry232323    | 项目源码 | 文件源码
def remove(self):
        selected = self.blockedList.selectedItems()
        if selected:
            item = selected[0]
            index = self.blockedList.indexFromItem(item)
            self.blockedList.takeItem(index.row())
            user = item.text()
            self.app.blocked.remove(user)
            if user in self.app.friends.keys():
                treeitem = QStandardItem(user)
                treeitem.setText(user)
                treeitem.setIcon(QIcon(self.app.theme["path"] + "/offline.png"))
                self.app.gui.friendsModel.appendRow(treeitem)
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def _show_attr(self, attr, dv):
        if attr == ua.AttributeIds.DataType:
            string = data_type_to_string(dv.Value.Value)
        elif attr in (ua.AttributeIds.AccessLevel,
                      ua.AttributeIds.UserAccessLevel,
                      ua.AttributeIds.WriteMask,
                      ua.AttributeIds.UserWriteMask,
                      ua.AttributeIds.EventNotifier):
            string = enum_to_string(attr, dv.Value.Value)
        else:
            string = val_to_string(dv.Value.Value)
        name_item = QStandardItem(attr.name)
        vitem = QStandardItem(string)
        vitem.setData(AttributeData(attr, dv.Value.Value, dv.Value.VariantType), Qt.UserRole)
        self.model.appendRow([name_item, vitem, QStandardItem(dv.Value.VariantType.name)])
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def _show_value_attr(self, attr, dv):
        name_item = QStandardItem("Value")
        vitem = QStandardItem()
        items = self._show_val(name_item, None, "Value", dv.Value.Value, dv.Value.VariantType)
        items[1].setData(AttributeData(attr, dv.Value.Value, dv.Value.VariantType), Qt.UserRole)
        row = [name_item, vitem, QStandardItem(dv.Value.VariantType.name)]
        self.model.appendRow(row)
        self._show_timestamps(name_item, dv)
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def _show_val(self, parent, obj, name, val, vtype):
        name_item = QStandardItem(name)
        vitem = QStandardItem()
        vitem.setText(val_to_string(val))
        vitem.setData(MemberData(obj, name, val, vtype), Qt.UserRole)
        row = [name_item, vitem, QStandardItem(vtype.name)]
        # if we have a list or extension object we display children
        if isinstance(val, list):
            row[2].setText("List of " + vtype.name)
            self._show_list(name_item, val, vtype)
        elif vtype == ua.VariantType.ExtensionObject:
            self._show_ext_obj(name_item, val)
        parent.appendRow(row)
        return row