本文整理汇总了Python中PySide.QtGui.QTableWidgetItem类的典型用法代码示例。如果您正苦于以下问题:Python QTableWidgetItem类的具体用法?Python QTableWidgetItem怎么用?Python QTableWidgetItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTableWidgetItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _patchBinary
def _patchBinary(self):
"""
Exports the current function code, ascii hex encoded
This is useful to import into tools like miasm and alike
"""
self._console_output("Patching the original binary...")
pl = patch_binary()
if not pl:
self._console_output("[!] No bytes to patch", err = True)
return
self.table.setColumnCount(3)
self.table.setHorizontalHeaderLabels(('File offset', 'Original', 'Patched'))
self.table_label.setText("Patched bytes exported to file")
self.table.clearContents()
self.table.setRowCount(0)
# Fill with contents
for idx, (fpos, o, p) in enumerate(pl):
self.table.insertRow(idx)
fpos_item = QTableWidgetItem("%x" % fpos)
fpos_item.setFlags(fpos_item.flags() ^ QtCore.Qt.ItemIsEditable)
orig_item = QTableWidgetItem("%x" % o)
patch_item = QTableWidgetItem("%x" % p)
self.table.setItem(idx, 0, fpos_item)
self.table.setItem(idx, 1, orig_item)
self.table.setItem(idx, 2, patch_item)
self._console_output("Done patching. Look in the same directory as the original for a .patched file")
示例2: _addTableItem
def _addTableItem(self, row, col, text=None):
tableItem = QTableWidgetItem()
if text is not None:
tableItem.setText(text)
self.table.setItem(row, col, tableItem)
return tableItem
示例3: append
def append(self, l):
r = self.rowCount()
self.insertRow(r)
for i, x in enumerate(l):
item = QTableWidgetItem("%s" % x)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
self.setItem(r, i, item)
示例4: set_abbreviations
def set_abbreviations(self, empire):
""" Clears the abbreviations table, then adds the abbreviations for the current
empire to it.
Arguments:
empire (lacuna.empire.MyEmpire): The empire whose abbreviations we'll show.
"""
self.init_for_data()
self.widget.setSortingEnabled(False)
row = 0
for n in sorted(empire.planet_names):
self.num_planets += 1
itm_name = QTableWidgetItem(n)
try:
itm_abbrv = QTableWidgetItem(self.parent.app.abbrv.get_abbrv(n))
except KeyError as e:
itm_abbrv = QTableWidgetItem("<None>")
fl = itm_name.flags()
fl &= ~Qt.ItemIsEditable
itm_name.setFlags(fl)
self.widget.insertRow(row)
self.widget.setItem(row, 0, itm_name)
self.widget.setItem(row, 1, itm_abbrv)
row += 1
self.widget.setSortingEnabled(True)
self.widget.itemChanged.connect(self.update)
self.resize(True)
示例5: _showMostReferenced
def _showMostReferenced(self):
"""
Shows the most referenced functions.
"""
self._console_output("Calculating most referenced functions...")
self.table_label.setText("Most referenced functions")
most_referenced = self.ba.most_referenced_functions()
self.table.setColumnCount(3)
self.table.setHorizontalHeaderLabels(("Address", "References", "Name"))
self.table.clearContents()
self.table.setRowCount(0)
idx = 0
# Fill with contents
for f_ea, (ref_nr, ref_name) in most_referenced:
self.table.insertRow(idx)
addr_item = QTableWidgetItem("%x" % f_ea)
addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
ref_item = cw.NumQTableWidgetItem("%d" % ref_nr)
name_item = QTableWidgetItem(ref_name)
self.table.setItem(idx, 0, addr_item)
self.table.setItem(idx, 1, ref_item)
self.table.setItem(idx, 2, name_item)
idx += 1
示例6: __init__
def __init__(self, updates, streetdb):
QDialog.__init__(self)
self.setupUi(self)
table = self.tableWidget
table.setRowCount(len(updates)+1)
table.setColumnCount(len(common.ATT))
self.setWindowTitle("Overview")
for i in range(len(common.ATT)):
item = QTableWidgetItem(common.ATT_HR[common.ATT[i]])
table.setItem(0, i, item)
for i, street in enumerate(updates):
changes = updates[street]
row = []
for z in range(len(common.ATT)):
found = False
att = common.ATT[z]
print(att)
for change in changes:
split = change.split(":")
if split[0] == att:
row.append(split[1])
found = True
if not found:
try:
row.append(streetdb[street][att])
except KeyError:
"""print("Error building diagram in Street:", street, " Attribute: ", att) ## Missing field"""
for x, update in enumerate(row):
item = QTableWidgetItem(update)
if "->" in update:
item.setForeground(Qt.red)
print(i+1, x, update)
table.setItem(i+1, x, item)
self.load_settings()
示例7: _markImmCompares
def _markImmCompares(self):
"""
Marks the immediate compares within the current function
"""
self.output_window.append("Marking all immediate compares...")
self.table_label.setText("Immediate compares within current function")
INS_COLOR = 0x2020c0
self.table.setColumnCount(2)
self.table.setHorizontalHeaderLabels(("Address", "Disassembly"))
self.table.clearContents()
self.table.setRowCount(0)
idx = 0
for cmp_ea, dis in self.ba.find_imm_compares():
self.table.insertRow(idx)
addr_item = QTableWidgetItem("%x" % cmp_ea)
addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
dis_item = cw.NumQTableWidgetItem("%s" % dis)
self.table.setItem(idx, 0, addr_item)
self.table.setItem(idx, 1, dis_item)
misc.set_ins_color(cmp_ea, INS_COLOR)
idx += 1
示例8: add_link
def add_link( self, url ):
"""
Adds a link to the link widget.
Only adds if its not already present.
"""
if url not in self.links:
self.links.add( url )
rowCounts = self.links_ui.rowCount()
nextRow = rowCounts + 1
nextPosition = rowCounts # row count is the length, but position is zero-based
self.links_ui.setRowCount( nextRow )
urlEntry = QTableWidgetItem( url )
statusEntry = QTableWidgetItem( '' )
statusEntry.setTextAlignment( Qt.AlignCenter )
urlEntry.setFlags( urlEntry.flags() & ~Qt.ItemIsEditable ) # not editable
statusEntry.setFlags( statusEntry.flags() & ~Qt.ItemIsEditable ) # not editable
self.links_ui.setItem( nextPosition, 0, urlEntry )
self.links_ui.setItem( nextPosition, 1, statusEntry )
# check if online
stream = Stream( url.split() )
stream.is_online( statusEntry )
示例9: _showConnectedIO
def _showConnectedIO(self):
"""
Shows a list of functions dealing with IO and
connected to the current function
"""
self._console_output("Calculating file & network IO...")
io_list = self.ba.input_to_function()
if not io_list:
self._console_output("[!] No (obvious) IO connecting to this function", err = True)
return
self.table.setColumnCount(2)
self.table.setHorizontalHeaderLabels(("Caller", "Name"))
self.table_label.setText("Connected IO")
self.table.clearContents()
self.table.setRowCount(0)
for idx, caller in enumerate(io_list):
self.table.insertRow(idx)
addr_item = QTableWidgetItem("%08x" % caller)
addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
name_item = QTableWidgetItem("%s" % misc.get_function_name(caller))
self.table.setItem(idx, 0, addr_item)
self.table.setItem(idx, 1, name_item)
示例10: _addObjectToTable
def _addObjectToTable(self, row, name, obj):
typeName = obj.typeName
print(typeName)
print(name)
tableItem = QTableWidgetItem(name)
tableItem.setCheckState(Qt.Checked)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['type'], QTableWidgetItem(typeName))
示例11: _addObjectToTable
def _addObjectToTable(self, row, name, checked=True):
tableItem = QTableWidgetItem(name)
if checked:
tableItem.setCheckState(Qt.Checked)
else:
tableItem.setCheckState(Qt.Unchecked)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem)
示例12: append_row
def append_row(self, cols, element_id=None):
rowCount = self.list.rowCount()
self.list.insertRow(rowCount)
for index, value in enumerate(cols):
col = QTableWidgetItem(value)
col.element_id = element_id
col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
self.list.setItem(rowCount, index, col)
示例13: _addObjectToTable
def _addObjectToTable(self, row, name, obj, checked=True):
typeName = obj.typeName
print 'adding to table: %s (%s)'%(name, typeName)
tableItem = QTableWidgetItem(name)
if checked:
tableItem.setCheckState(Qt.Checked)
else:
tableItem.setCheckState(Qt.Unchecked)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['landmarks'], tableItem)
示例14: _addObjectToTable
def _addObjectToTable(self, row, name, obj, checked=True):
typeName = obj.typeName
# print(typeName)
# print(name)
tableItem = QTableWidgetItem(name)
if checked:
tableItem.setCheckState(Qt.Checked)
else:
tableItem.setCheckState(Qt.Unchecked)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem)
self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['type'], QTableWidgetItem(typeName))
开发者ID:mapclient-plugins,项目名称:pointwiserigidregistrationstep,代码行数:12,代码来源:mayaviregistrationviewerwidget.py
示例15: readTableFromList
def readTableFromList(self, mytable, mylist):
"""
mylist contains triples of (name, value, modifyable)
"""
mytable.clear()
mytable.setRowCount(0)
for (ind, (name, string_value, modifyable, var_type)) in enumerate(
sorted(mylist, key=lambda x: x[0])):
# sort list to get a reproducible table
mytable.insertRow(ind)
mytable.setItem(ind, 0, QTableWidgetItem(name))
value_item = QTableWidgetItem(string_value)
if not modifyable:
value_item.setFlags(value_item.flags() & Qt.ItemIsEditable)
mytable.setItem(ind, 1, value_item)
type_item = QTableWidgetItem(str(var_type))
type_item.setFlags(type_item.flags() & Qt.ItemIsEditable)
mytable.setItem(ind, 2, type_item)
header = mytable.horizontalHeader()
try:
# this is Qt4
header.setResizeMode(0, QHeaderView.ResizeToContents)
header.setResizeMode(1, QHeaderView.Stretch)
except AttributeError:
# this is Qt5
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.Stretch)