本文整理汇总了Python中PyQt4.Qt.QTableWidgetItem.setFont方法的典型用法代码示例。如果您正苦于以下问题:Python QTableWidgetItem.setFont方法的具体用法?Python QTableWidgetItem.setFont怎么用?Python QTableWidgetItem.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem.setFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _addNewDescriptorTableRow
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setFont [as 别名]
def _addNewDescriptorTableRow(self, name, descriptor):
"""
Adds a new row to the descriptor table.
"""
row = self.descriptorsTable.rowCount()
self.descriptorsTable.insertRow(row)
item_widget = QTableWidgetItem(name)
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsEditable)
item_widget.setTextAlignment(Qt.AlignLeft)
self.descriptorsTable.setItem(row, 0, item_widget)
self.descriptorsTable.resizeColumnToContents(0)
s = self._makeProperAAString(descriptor)
item_widget = QTableWidgetItem(s)
item_widget.setFont(self.descriptorfont)
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsEditable)
item_widget.setTextAlignment(Qt.AlignLeft)
self.descriptorsTable.setItem(row, 1, item_widget)
self.descriptorsTable.setColumnWidth(1,
self.descriptorsTable.width()-self.descriptorsTable.columnWidth(0)-20)
self.descriptorsTable.setRowHeight(row, 16)
示例2: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setFont [as 别名]
def _fillSequenceTable(self):
"""
"""
self.setComboBox = QComboBox()
for chunk in self.win.assy.molecules:
if chunk.isProteinChunk():
aa_list = chunk.protein.get_amino_acids()
aa_list_len = len(aa_list)
self.sequenceTable.setRowCount(aa_list_len)
for index in range(aa_list_len):
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
item_widget.setCheckState(Qt.Checked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 0, item_widget)
item_widget = QTableWidgetItem(str(index+1))
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 1, item_widget)
item_widget = QTableWidgetItem("Any")
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 2, item_widget)
aa_string = self._get_mutation_descriptor(
self._get_aa_for_index(index))
item_widget = QTableWidgetItem(aa_string)
item_widget.setFont(self.descriptorfont)
self.sequenceTable.setItem(index, 3, item_widget)
self.sequenceTable.setRowHeight(index, 16)
self.win.connect(self.sequenceTable,
SIGNAL("cellClicked(int, int)"),
self._sequenceTableCellChanged)
self.sequenceTable.resizeColumnsToContents()
self.sequenceTable.setColumnWidth(0, 35)
self.sequenceTable.setColumnWidth(2, 80)
示例3: _fillSequenceTable
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setFont [as 别名]
def _fillSequenceTable(self):
"""
Fills in the sequence table.
"""
if not self.current_protein:
return
else:
currentProteinChunk = self.current_protein
self.editingItem = True
aa_list = currentProteinChunk.protein.get_amino_acids()
aa_list_len = len(aa_list)
self.sequenceTable.setRowCount(aa_list_len)
for index in range(aa_list_len):
# Selection checkbox column
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
item_widget.setCheckState(Qt.Checked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 0, item_widget)
# Amino acid index column
item_widget = QTableWidgetItem(str(index+1))
item_widget.setFont(self.labelfont)
item_widget.setFlags(
Qt.ItemIsSelectable |
Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 1, item_widget)
# Mutation descriptor name column
aa = self._get_aa_for_index(index)
item_widget = QTableWidgetItem(self._get_descriptor_name(aa))
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled)
item_widget.setTextAlignment(Qt.AlignCenter)
self.sequenceTable.setItem(index, 2, item_widget)
# Backrub checkbox column
item_widget = QTableWidgetItem("")
item_widget.setFont(self.labelfont)
if aa.get_backrub_mode():
item_widget.setCheckState(Qt.Checked)
else:
item_widget.setCheckState(Qt.Unchecked)
item_widget.setTextAlignment(Qt.AlignLeft)
item_widget.setSizeHint(QSize(20,12))
item_widget.setFlags(Qt.ItemIsSelectable |
Qt.ItemIsEnabled |
Qt.ItemIsUserCheckable)
self.sequenceTable.setItem(index, 3, item_widget)
# Mutation descriptor column
aa_string = self._get_mutation_descriptor(aa)
item_widget = QTableWidgetItem(aa_string)
item_widget.setFont(self.descriptorfont)
self.sequenceTable.setItem(index, 4, item_widget)
self.sequenceTable.setRowHeight(index, 16)
self.editingItem = False
self.sequenceTable.resizeColumnsToContents()
self.sequenceTable.setColumnWidth(0, 35)
self.sequenceTable.setColumnWidth(2, 80)
self.sequenceTable.setColumnWidth(3, 35)
return
示例4: _loadGroupBox1
# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setFont [as 别名]
def _loadGroupBox1(self, pmGroupBox):
"""
Load widgets in group box.
"""
self.labelfont = QFont("Helvetica", 12)
self.descriptorfont = QFont("Courier New", 12)
self.headerdata = ['', 'ID', 'Set', 'Descriptor']
self.set_names = ["Any", "Same", "Locked", "Polar", "Apolar"]
self.rosetta_set_names = ["ALLAA", "NATRO", "NATAA", "POLAR", "APOLA"]
self.descriptor_list = ["GAVILMFWCSTYNQDEHKRP",
"____________________",
"____________________",
"________CSTYNQDEHKR_",
"GAVILMFW___________P"]
self.descriptorsTable = PM_TableWidget( pmGroupBox)
self.descriptorsTable.setFixedHeight(100)
self.descriptorsTable.setRowCount(len(self.set_names))
self.descriptorsTable.setColumnCount(2)
self.descriptorsTable.verticalHeader().setVisible(False)
self.descriptorsTable.horizontalHeader().setVisible(False)
for index in range(len(self.set_names)):
item_widget = QTableWidgetItem(self.set_names[index])
item_widget.setFont(self.labelfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
item_widget.setTextAlignment(Qt.AlignCenter)
self.descriptorsTable.setItem(index, 0, item_widget)
item_widget = QTableWidgetItem(self.descriptor_list[index])
item_widget.setFont(self.descriptorfont)
item_widget.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
item_widget.setTextAlignment(Qt.AlignCenter)
self.descriptorsTable.setItem(index, 1, item_widget)
self.descriptorsTable.setRowHeight(index, 16)
pass
self.descriptorsTable.resizeColumnsToContents()
self.applyDescriptorPushButton = PM_PushButton( pmGroupBox,
text = "Apply",
setAsDefault = True)
self.selectAllPushButton = PM_PushButton( pmGroupBox,
text = "All",
setAsDefault = True)
self.selectNonePushButton = PM_PushButton( pmGroupBox,
text = "None",
setAsDefault = True)
self.selectInvertPushButton = PM_PushButton( pmGroupBox,
text = "Invert",
setAsDefault = True)
self.win.connect(self.applyDescriptorPushButton,
SIGNAL("clicked()"),
self._applyDescriptor)
self.win.connect(self.selectAllPushButton,
SIGNAL("clicked()"),
self._selectAll)
self.win.connect(self.selectNonePushButton,
SIGNAL("clicked()"),
self._selectNone)
self.win.connect(self.selectInvertPushButton,
SIGNAL("clicked()"),
self._invertSelection)
buttonList = [('PM_PushButton', self.applyDescriptorPushButton, 0, 0),
('QSpacerItem', 5, 5, 1, 0),
('PM_PushButton', self.selectAllPushButton, 2, 0),
('PM_PushButton', self.selectNonePushButton, 3, 0),
('PM_PushButton', self.selectInvertPushButton, 4, 0)]
self.buttonGrid = PM_WidgetGrid( pmGroupBox,
widgetList = buttonList)
self.recenterViewCheckBox = \
PM_CheckBox( pmGroupBox,
text = "Re-center view",
setAsDefault = True,
state = Qt.Checked)
self.sequenceTable = PM_TableWidget( pmGroupBox)
#self.sequenceTable.setModel(self.tableModel)
self.sequenceTable.resizeColumnsToContents()
self.sequenceTable.verticalHeader().setVisible(False)
#self.sequenceTable.setRowCount(0)
self.sequenceTable.setColumnCount(4)
self.checkbox = QCheckBox()
#.........这里部分代码省略.........