本文整理汇总了Python中PySide.QtGui.QListWidgetItem方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QListWidgetItem方法的具体用法?Python QtGui.QListWidgetItem怎么用?Python QtGui.QListWidgetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QListWidgetItem方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_step
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def add_step(self):
"""
Loads `PARAMS` from task object, adds base parameters to :py:attr:`.steps` list
"""
task_type = self.task_list.currentItem().text()
new_item = QtGui.QListWidgetItem()
new_item.setText(task_type)
task_params = copy.deepcopy(tasks.TASK_LIST[task_type].PARAMS)
# Add params that are non-task specific
# Name of task type
task_params['task_type'] = {'type':'label','value':task_type}
# Prepend name of step shittily
task_params_temp = odict()
task_params_temp['step_name'] = {'type':'str', 'tag':'Step Name', 'value':task_type}
task_params_temp.update(task_params)
task_params.clear()
task_params.update(task_params_temp)
# add graduation field
task_params['graduation'] = {'type':'graduation', 'tag':'Graduation Criterion', 'value':{}}
self.steps.append(task_params)
self.step_list.addItem(new_item)
self.step_list.setCurrentItem(new_item)
示例2: signature_selected
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def signature_selected(self, item):
self.subsignatures_list.clear()
for ea, color in self.previous_colors:
idc.SetColor(ea, idc.CIC_ITEM, color)
self.previous_colors = []
self.match_label.setText("")
if item.parsed_signature is None:
pass
else:
if isinstance(item.parsed_signature, LdbSignature):
for i, subsig in enumerate(item.parsed_signature.subsignatures):
item2 = QtWidgets.QListWidgetItem("% 2d %s:%s" % (i, str(subsig.offset), subsig.clamav_signature))
item2.subsignature_name = "$subsig_%02x" % i
self.subsignatures_list.addItem(item2)
elif isinstance(item.parsed_signature, NdbSignature):
self.match_label.setText("No match")
print_console("Signature selected: %s" % item.text())
self.yara_scanner.scan(item.yara_rule)
示例3: _avoid_system_name
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def _avoid_system_name(self, sys_name):
if sys_name:
if sys_name not in self.avoidance_list():
QtGui.QListWidgetItem(sys_name, self.listWidget_avoid)
self._avoid_message("Added", MainWindow.MSG_OK)
else:
self._avoid_message("Already in list!", MainWindow.MSG_ERROR)
else:
self._avoid_message("Invalid system name :(", MainWindow.MSG_ERROR)
示例4: set_controls
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def set_controls(self, updated_files):
for to_update in updated_files:
item = QListWidgetItem('[%s] %s' % to_update)
item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
#if to_update[0] == "U":
# item.setCheckState(Qt.Unchecked)
#else:
item.setCheckState(Qt.Checked)
self.ui.listFiles.addItem(item)
示例5: rowsource
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def rowsource(self, source):
self._source = source
table = DB._get_table_info(source).table
for record in table:
self.addItem(QtGui.QListWidgetItem(_str(record[0])))
示例6: onParentSelected
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def onParentSelected(self):
# clear the selection in the GUI window
Gui.Selection.clearSelection()
# build the LCS table
self.attLCStable = []
# the current text in the combo-box is the link's name...
if self.parentList.currentIndex() > 0:
parentName = self.parentTable[ self.parentList.currentIndex() ].Name
parentPart = self.activeDoc.getObject( parentName )
if parentPart:
# we get the LCS from the linked part
self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
# linked part & doc
dText = parentPart.LinkedObject.Document.Name +'#'
# if the linked part has been renamed by the user
pText = Asm4.nameLabel( parentPart.LinkedObject )
self.parentDoc.setText( dText + pText )
# highlight the selected part:
Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
# something wrong
else:
return
# build the list
self.attLCSlist.clear()
for lcs in self.attLCStable:
newItem = QtGui.QListWidgetItem()
newItem.setText(Asm4.nameLabel(lcs))
newItem.setIcon( lcs.ViewObject.Icon )
self.attLCSlist.addItem( newItem )
#self.attLCStable.append(lcs)
return
# A target Datum has been clicked in the list
示例7: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def __init__(self, constraintSystem):
self.constraintSystem = constraintSystem
self.form = FreeCADGui.PySideUic.loadUi( ':/assembly2/ui/degreesOfFreedomAnimation.ui' )
self.form.setWindowIcon(QtGui.QIcon( ':/assembly2/icons/degreesOfFreedomAnimation.svg' ) )
self.form.groupBox_DOF.setTitle('%i Degrees-of-freedom:' % len(constraintSystem.degreesOfFreedom))
for i, d in enumerate(constraintSystem.degreesOfFreedom):
item = QtGui.QListWidgetItem('%i. %s' % (i+1, str(d)[1:-1].replace('DegreeOfFreedom ','')), self.form.listWidget_DOF)
if i == 0: item.setSelected(True)
self.form.pushButton_animateSelected.clicked.connect(self.animateSelected)
self.form.pushButton_animateAll.clicked.connect(self.animateAll)
self.form.pushButton_set_as_default.clicked.connect( self.setDefaults )
self.setIntialValues()
示例8: refreshObjectList
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def refreshObjectList(self):
self.onionObjects_list.clear()
for obj in self.mOnionObjectSet:
listWidget = OnionListObject()
listWidget.object_label.setText(obj.nodeName())
listWidget.object_remove_btn.clicked.connect(lambda b_obj = obj: self.removeOnionObject(b_obj))
listItem = QtGui.QListWidgetItem()
listItem.setSizeHint(listWidget.sizeHint())
self.onionObjects_list.addItem(listItem)
self.onionObjects_list.setItemWidget(listItem, listWidget)
#
示例9: refreshAbsoluteList
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def refreshAbsoluteList(self):
# remove any entries that don't exist anymore
framesInList = []
for i in reversed(xrange(self.absolute_list.count())):
frame = self.absolute_list.item(i).data(QtCore.Qt.UserRole)
framesInList.append(frame)
if frame not in self.mAbsoluteOnionSet:
self.absolute_list.takeItem(i)
# add any missing entry
for frame in self.mAbsoluteOnionSet:
if frame not in framesInList:
listWidget = OnionListFrame()
listWidget.frame_number.setText(str(int(frame)))
listWidget.frame_opacity_slider.setValue(onionCore.viewRenderOverrideInstance.getAbsoluteOpacity(int(frame)))
listWidget.addRemoveButton()
listWidget.frame_visibility_btn.setChecked(onionCore.viewRenderOverrideInstance.absoluteOnionExists(int(frame)))
listWidget.frame_remove_btn.clicked.connect(lambda b_frame = frame: self.removeAbsoluteFrame(b_frame))
listWidget.frame_visibility_btn.clicked.connect(self.toggleAbsoluteFrame)
listWidget.frame_opacity_slider.sliderMoved.connect(self.setAbsoluteOpacity)
listItem = QtGui.QListWidgetItem()
listItem.setData(QtCore.Qt.UserRole, int(frame))
listItem.setSizeHint(listWidget.sizeHint())
# insert item at correct position
correctRow = 0
for i in xrange(self.absolute_list.count()):
if frame < self.absolute_list.item(i).data(QtCore.Qt.UserRole):
break
correctRow = i+1
self.absolute_list.insertItem(correctRow, listItem)
self.absolute_list.setItemWidget(listItem, listWidget)
# ---------------------------
# CONNECTIONS
#
示例10: _add_signature
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def _add_signature(self, sig):
signature = parse_signature(sig)
if signature is None:
idaapi.warning("Error parsing signature")
return False
signature.target_type = 0 #Don't check for PE header
item = QtWidgets.QListWidgetItem(sig)
item.parsed_signature = signature
item.yara_rule = self.yara_scanner.compile(self.yara_scanner.convert(signature))
if isinstance(signature, LdbSignature):
pass
self.signatures_list.addItem(item)
return True
示例11: onParentList
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def onParentList(self):
# clear the LCS list
self.attLCSlist.clear()
self.attLCStable = []
# clear the selection in the GUI window
Gui.Selection.clearSelection()
# keep the fastener selected
Gui.Selection.addSelection( self.activeDoc.Name, 'Model', self.selectedFastener.Name+'.')
# the current text in the combo-box is the link's name...
# ... or it's 'Parent Assembly' then the parent is the 'Model' root App::Part
if self.parentList.currentText() == 'Parent Assembly':
parentName = 'Parent Assembly'
parentPart = self.activeDoc.getObject( 'Model' )
# we get the LCS directly in the root App::Part 'Model'
self.attLCStable = Asm4.getPartLCS( parentPart )
self.parentDoc.setText( parentPart.Document.Name+'#'+Asm4.nameLabel(parentPart) )
# if something is selected
elif self.parentList.currentIndex() > 1:
parentName = self.parentTable[ self.parentList.currentIndex() ].Name
parentPart = self.activeDoc.getObject( parentName )
if parentPart:
# we get the LCS from the linked part
self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
# linked part & doc
dText = parentPart.LinkedObject.Document.Name +'#'
# if the linked part has been renamed by the user
pText = Asm4.nameLabel( parentPart.LinkedObject )
self.parentDoc.setText( dText + pText )
# highlight the selected part:
Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
# something wrong
else:
return
# build the list
self.attLCSlist.clear()
for lcs in self.attLCStable:
newItem = QtGui.QListWidgetItem()
newItem.setText(Asm4.nameLabel(lcs))
newItem.setIcon( lcs.ViewObject.Icon )
self.attLCSlist.addItem( newItem )
#self.attLCStable.append(lcs)
return
# An LCS has been clicked in 1 of the 2 lists, we highlight both LCS |
示例12: onParentSelected
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def onParentSelected(self):
# clear the selection in the GUI window
Gui.Selection.clearSelection()
# build the LCS table
self.attLCStable = []
# the current text in the combo-box is the link's name...
# ... or it's 'Parent Assembly' then the parent is the 'Model' root App::Part
if self.parentList.currentText() == 'Parent Assembly':
parentName = 'Parent Assembly'
parentPart = self.parentAssembly
# we get the LCS directly in the root App::Part 'Model'
self.attLCStable = Asm4.getPartLCS( parentPart )
self.parentDoc.setText( parentPart.Document.Name+'#'+Asm4.nameLabel(parentPart) )
# if something is selected
elif self.parentList.currentIndex() > 1:
parentName = self.parentTable[ self.parentList.currentIndex() ].Name
parentPart = self.activeDoc.getObject( parentName )
if parentPart:
# we get the LCS from the linked part
self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
# linked part & doc
dText = parentPart.LinkedObject.Document.Name +'#'
# if the linked part has been renamed by the user
pText = Asm4.nameLabel( parentPart.LinkedObject )
self.parentDoc.setText( dText + pText )
# highlight the selected part:
Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
# something wrong
else:
return
# build the list
self.attLCSlist.clear()
for lcs in self.attLCStable:
newItem = QtGui.QListWidgetItem()
newItem.setText(Asm4.nameLabel(lcs))
newItem.setIcon( lcs.ViewObject.Icon )
self.attLCSlist.addItem( newItem )
#self.attLCStable.append(lcs)
return
# Rotations
示例13: PopulateWidget
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidgetItem [as 别名]
def PopulateWidget(self):
signatures_widget = QtWidgets.QFrame()
layout = QtWidgets.QVBoxLayout()
layout.addWidget(QtWidgets.QLabel('Signatures'))
self.signatures_list = QtWidgets.QListWidget()
layout.addWidget(self.signatures_list)
signatures_widget.setLayout(layout)
container2 = QtWidgets.QGridLayout()
container2.addWidget(signatures_widget, 0, 0)
subsignatures_widget = QtWidgets.QFrame()
layout = QtWidgets.QVBoxLayout()
self.subsignatures_list = QtWidgets.QListWidget()
layout.addWidget(QtWidgets.QLabel("LDB subsignatures"))
layout.addWidget(self.subsignatures_list)
subsignatures_widget.setLayout(layout)
container2.addWidget(subsignatures_widget, 0, 1)
#subsignatures_widget.hide()
container3 = QtWidgets.QVBoxLayout()
container3.addLayout(container2)
self.match_label = QtWidgets.QLabel()
container3.addWidget(self.match_label)
self.signature_line_edit = QtWidgets.QLineEdit()
container3.addWidget(self.signature_line_edit)
container4 = QtWidgets.QHBoxLayout()
container3.addLayout(container4)
add_signature_button = QtWidgets.QPushButton("Add signature")
remove_signature_button = QtWidgets.QPushButton("Remove signature")
container4.addWidget(add_signature_button)
container4.addWidget(remove_signature_button)
self.signature_line_edit.returnPressed.connect(self.add_signature)
add_signature_button.clicked.connect(self.add_signature)
remove_signature_button.clicked.connect(self.remove_signature)
self.signatures_list.itemActivated.connect(self.signature_selected)
self.subsignatures_list.itemActivated.connect(self.subsignature_selected)
item = QtWidgets.QListWidgetItem("Clear selection")
item.parsed_signature = None
self.signatures_list.addItem(item)
self.setLayout(container3)