当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QListWidgetItem方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QListWidgetItem方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QListWidgetItem方法的具体用法?Python QtGui.QListWidgetItem怎么用?Python QtGui.QListWidgetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


在下文中一共展示了QtGui.QListWidgetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scan_project

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def scan_project(self, project):
        if project == "ALL":
            self.scan()
            return
        self.ecu_scan.clear()
        self.ecu_scan.scan(self.progressstatus, self.infostatus, project)
        self.ecu_scan.scan_kwp(self.progressstatus, self.infostatus, project)

        for ecu in self.ecu_scan.ecus.keys():
            self.ecunamemap[ecu] = self.ecu_scan.ecus[ecu].name
            item = widgets.QListWidgetItem(ecu)
            if '.xml' in self.ecu_scan.ecus[ecu].href.lower():
                item.setForeground(core.Qt.yellow)
            else:
                item.setForeground(core.Qt.green)
            self.treeview_ecu.addItem(item)

        for ecu in self.ecu_scan.approximate_ecus.keys():
            self.ecunamemap[ecu] = self.ecu_scan.approximate_ecus[ecu].name
            item = widgets.QListWidgetItem(ecu)
            item.setForeground(core.Qt.red)
            self.treeview_ecu.addItem(item) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:24,代码来源:ddt4all.py

示例2: rescan_ports

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def rescan_ports(self):
        ports = elm.get_available_ports()
        if ports == None:
            self.listview.clear()
            self.ports = {}
            self.portcount = 0
            return

        if len(ports) == self.portcount:
            return

        self.listview.clear()
        self.ports = {}
        self.portcount = len(ports)
        for p in ports:
            item = widgets.QListWidgetItem(self.listview)
            itemname = p[0] + "[" + p[1] + "]"
            item.setText(itemname)
            self.ports[itemname] = (p[0], p[1])

        self.timer.start(1000) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:23,代码来源:ddt4all.py

示例3: updateReceivers

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def updateReceivers(self):
        if list(set(discovery.airplayReceivers) - set(self.oldReceiverList)) != []:
            # The new list has items oldReceiverList doesn't!
            for item in list(set(discovery.airplayReceivers) - set(self.oldReceiverList)):
                self.oldReceiverList.append(item)
                print("Adding device: " + item)
                # Convert item to string to remove the excess info
                item = QtGui.QListWidgetItem(str(item).replace("._airplay._tcp.local.", ""))
                self.deviceSelectList.addItem(item)
        if list(set(self.oldReceiverList) - set(discovery.airplayReceivers)) != []:
            # Items have been removed from the list!
            for item in list(set(self.oldReceiverList) - set(discovery.airplayReceivers)):
                self.oldReceiverList.remove(item)
                print("Removed device: " + item)
                items = self.deviceSelectList.findItems(item, QtCore.Qt.MatchExactly)
                for x in items:
                    self.deviceSelectList.takeItem(self.deviceSelectList.row(x)) 
开发者ID:openairplay,项目名称:openairplay,代码行数:19,代码来源:main.py

示例4: importedItemSelected

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def importedItemSelected(self, item):
        """
        importedItemSelected(QtGui.QListWidgetItem item)

            A callback command that selects the object in the scene
            when the corresponding item is selected in the list
            of imported assets.
        """

        node = str(item.text())

        if cmds.objExists(node):
        
            cmds.select(node, r=True)
            
            # Since we stored the Asset object with each list item
            # we now have access to it and could do something with it
            # such as offering to swap out assets, etc.
            # Lets just print it.
            print "Asset was just selected:"
            print item.asset 
开发者ID:justinfx,项目名称:tutorials,代码行数:23,代码来源:assetImporterWin.py

示例5: createWidget_recent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def createWidget_recent(self,listWidget,uin,flag):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',str(uin)+':'+str(flag))
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView_recent[uin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView_recent[uin].setGeometry(QtCore.QRect(1, 1, 60, 60))
        if flag==0:
            self.graphicsView_recent[uin].setScene(self.createImg('user',uin))
            title=self.userdict[uin]['nickname']
        if flag==1:
            title=self.groupdict[uin]['name']
            self.graphicsView_recent[uin].setScene(self.createImg('group',uin))
        if flag==2:
            title=self.discussdict[uin]['name']
            self.graphicsView_recent[uin].setScene(self.createImg('discuss',uin))
        self.graphicsView_recent[uin].resize(50,50)
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        self.lbl_title.setText(_translate("Main", title, None))
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:25,代码来源:guiMainQQ.py

示例6: createWidget

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def createWidget(self,listWidget, title,markname,uin):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',uin)
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView[uin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView[uin].setGeometry(QtCore.QRect(1, 1, 38, 38))
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        if markname != 'None':
            title=markname+'('+title+')'
        self.lbl_title.setText(_translate("Main", title, None))
        self.lbl_comment = QtGui.QLabel(self.widget)
        self.lbl_comment.setGeometry(QtCore.QRect(60, 30, 181, 18))
        info=self.userdict.get(uin)
        if info['online']:
            self.lbl_comment.setText(_translate("Main", '[在线]', None))
        else:
            self.lbl_comment.setText(_translate("Main", '[离线]', None))
        self.lbl_comment.setFont(self.font3)
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:25,代码来源:guiMainQQ.py

示例7: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def __init__(self, iface, toolbar, parent=None):
        CartoDBPluginUserDialog.__init__(self, toolbar, parent)

        self.iface = iface

        self.ui = Ui_Upload()
        self.ui.setupUi(self)

        self.ui.bar = QgsMessageBar()
        self.ui.bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.ui.verticalLayout.insertWidget(0, self.ui.bar)

        self.ui.uploadBT.clicked.connect(self.upload)
        self.ui.cancelBT.clicked.connect(self.reject)
        self.ui.layersList.itemSelectionChanged.connect(self.validateButtons)

        layers = QgsMapLayerRegistry.instance().mapLayers()

        # TODO Implement add to project
        # self.ui.convertCH.hide()
        self.ui.overideCH.hide()

        self.ui.layersList.clear()
        self.ui.uploadBar.setValue(0)
        self.ui.uploadBar.hide()
        self.ui.uploadingLB.hide()
        for id_ly, ly in layers.iteritems():
            qDebug('Layer id {}'.format(stripAccents(id_ly)))
            if ly.type() == QgsMapLayer.VectorLayer and not isinstance(ly, CartoDBLayer):
                item = QListWidgetItem(self.ui.layersList)
                widget = CartoDBLayerListItem(ly.name(), ly, getSize(ly), ly.dataProvider().featureCount())
                item.setSizeHint(widget.sizeHint())
                self.ui.layersList.setItemWidget(item, widget) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:35,代码来源:Upload.py

示例8: updateList

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def updateList(self, visualizations):
        self.ui.tablesList.clear()
        for visualization in visualizations:
            item = QListWidgetItem(self.ui.tablesList)

            owner = None
            owner = visualization['permission']['owner']['username']

            widget = CartoDBDatasetsListItem(
                visualization['name'], owner, visualization['table']['size'], visualization['table']['row_count'],
                shared=(owner != self.currentUser), multiuser=self.currentMultiuser)
            # item.setText(visualization['name'])
            readonly = False
            # qDebug('Vis:' + json.dumps(visualization, sort_keys=True, indent=2, separators=(',', ': ')))
            if visualization['permission'] is not None and owner != self.currentUser and \
               visualization['permission']['acl'] is not None:
                for acl in visualization['permission']['acl']:
                    if acl['type'] == 'user' and 'username' in acl['entity'] and acl['entity']['username'] == self.currentUser and \
                       acl['access'] == 'r':
                        readonly = True
                        break

            widget.readonly = readonly
            if readonly:
                widget.setTextColor('#999999')

            item.setSizeHint(widget.sizeHint())
            # item.setIcon(QIcon(":/plugins/qgis-cartodb/images/icons/layers.png"))
            self.ui.tablesList.setItemWidget(item, widget) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:31,代码来源:Main.py

示例9: newEcu

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def newEcu(self):
        filename_tuple = widgets.QFileDialog.getSaveFileName(self, _("Save ECU (keep '.json' extension)"), "./json/myecu.json",
                                                   "*.json")
        if qt5:
            filename = str(filename_tuple[0])
        else:
            filename = str(filename_tuple)

        if filename == '':
            return

        basename = os.path.basename(utf8(filename))
        filename = os.path.join("./json", basename)
        ecufile = ecu.Ecu_file(None)
        layout = open(filename + ".layout", "w")
        layout.write('{"screens": {}, "categories":{"Category":[]} }')
        layout.close()

        targets = open(filename + ".targets", "w")
        targets.write('[]')
        targets.close()

        layout = open(filename, "w")
        layout.write(ecufile.dumpJson())
        layout.close()

        item = widgets.QListWidgetItem(basename)
        self.treeview_ecu.addItem(item) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:30,代码来源:ddt4all.py

示例10: loadEcu

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def loadEcu(self, name):
        vehicle_file = "vehicles/" + name + ".ecu"
        jsonfile = open(vehicle_file, "r")
        eculist = json.loads(jsonfile.read())
        jsonfile.close()

        self.treeview_ecu.clear()
        self.treeview_params.clear()
        if self.paramview:
            self.paramview.init(None)

        for ecu in eculist:
            item = widgets.QListWidgetItem(ecu[0])
            self.ecunamemap[ecu[0]] = ecu[1]
            self.treeview_ecu.addItem(item) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:17,代码来源:ddt4all.py

示例11: createDeviceListGroupBox

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def createDeviceListGroupBox(self):
        self.deviceListGroupBox = QtGui.QGroupBox("Airplay to")

        self.deviceSelectList = QtGui.QListWidget()
        deviceSelectListNoDisplayItem = QtGui.QListWidgetItem("No display.")
        self.deviceSelectList.addItem(deviceSelectListNoDisplayItem)

        # layout
        deviceListLayout = QtGui.QHBoxLayout()
        deviceListLayout.addWidget(self.deviceSelectList)
        self.deviceListGroupBox.setLayout(deviceListLayout) 
开发者ID:openairplay,项目名称:openairplay,代码行数:13,代码来源:main.py

示例12: refreshImported

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def refreshImported(self):
        """
        refreshImported()

            A callback command the refreshes the list of already
            imported assets in the scene. 
            The "Refresh Imported" button calls this when clicked.
        """
        
        self.importedList.clear()

        for item in self.importer.findImported():

            listItem = QtGui.QListWidgetItem()
            listItem.setText(item[0])

            # in python, we can add arbitrary attributes onto these
            # objects for storage, unless of course the class specifically
            # prevents it. If you had a lot more custom stuff to store
            # and process, you would probably want to subclass your own
            # custom ListWidgetItem. But for now, we can just store
            # the Asset on the List item. We will be able to get this
            # back when we look up list items later.
            listItem.asset = item[1]

            self.importedList.addItem(listItem) 
开发者ID:justinfx,项目名称:tutorials,代码行数:28,代码来源:assetImporterWin.py

示例13: create_gadget_item

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def create_gadget_item(self, block):
        item = qg.QListWidgetItem()
        item.setData(qc.Qt.UserRole, block)
        item.setData(qc.Qt.DisplayRole, block.content())
        item.setData(qc.Qt.ToolTipRole, block.get_query())
        if block.is_editable():
            item.setFlags(item.flags() | qc.Qt.ItemIsEditable)
        else:
            item.setFlags(item.flags() | ~qc.Qt.ItemIsEditable)

        return item 
开发者ID:orppra,项目名称:ropa,代码行数:13,代码来源:list_widget_controller.py

示例14: create_script_item

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def create_script_item(self, block):
        item = qg.QListWidgetItem()
        item.setData(qc.Qt.UserRole, block)
        item.setData(qc.Qt.DisplayRole, block.content())
        item.setFlags(item.flags() | qc.Qt.ItemIsEditable)
        return item 
开发者ID:orppra,项目名称:ropa,代码行数:8,代码来源:list_widget_controller.py

示例15: createWidget_group

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QListWidgetItem [as 别名]
def createWidget_group(self,listWidget,title,guin,flag):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',guin)
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView_group[guin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView_group[guin].setGeometry(QtCore.QRect(1, 1, 60, 60))
        self.graphicsView_group[guin].setScene(self.createImg(flag,guin))
        self.graphicsView_group[guin].resize(50,50)
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        self.lbl_title.setText(_translate("Main", title, None))
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:17,代码来源:guiMainQQ.py


注:本文中的PyQt4.QtGui.QListWidgetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。