本文整理汇总了Python中MOSES.getPiggyBankKeys方法的典型用法代码示例。如果您正苦于以下问题:Python MOSES.getPiggyBankKeys方法的具体用法?Python MOSES.getPiggyBankKeys怎么用?Python MOSES.getPiggyBankKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOSES
的用法示例。
在下文中一共展示了MOSES.getPiggyBankKeys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getPiggyBankKeys [as 别名]
def __init__(self):
super(PiggyBank, self).__init__()
self.setStyleSheet("gridline-color: rgb(0, 0, 0)")
header_labels = MOSES.getPiggyBankKeys()
self.setColumnCount(len(header_labels))
self.setHorizontalHeaderLabels(header_labels)
self.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.verticalHeader().setStretchLastSection(False)
self.verticalHeader().setVisible(True)
self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.horizontalHeader().setStretchLastSection(True)
self.horizontalHeader().setVisible(True)
示例2: displayData
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getPiggyBankKeys [as 别名]
def displayData(self):
#print "Displaying piggybank data!"
self.setSortingEnabled(False)
self.setRowCount(0)
row_index = 0
header_labels = MOSES.getPiggyBankKeys()
self.setColumnCount(len(header_labels))
for row in self.data_list:
#print "Printing:"
#print row
#print type(row)
#print "Row %d" % row_index #debug
if len(row) > 0:
column_index = 0
self.insertRow(row_index)
#get the keys from the PiggyBank Key list.
for key in header_labels: #each row is a dictionary.
cell_item = QtGui.QTableWidgetItem(str(row[key]))
text_color = QtGui.QColor(0, 0, 0)
if self.targets_data[row_index] == 0:
cell_color = QtGui.QColor(255, 0, 0, 250) #Transparent red.
elif self.targets_data[row_index] == -1:
cell_color = QtGui.QColor(0, 0, 0, 10)
text_color = QtGui.QColor(255, 0, 0)
else:
cell_color = QtGui.QColor(255, 255, 255, 0) #invisible white.
cell_item.setBackgroundColor(cell_color)
cell_item.setTextColor(text_color)
self.setItem(row_index,column_index,cell_item)
column_index += 1
row_index += 1
self.resizeColumnsToContents()
self.resizeRowsToContents()
self.setHorizontalHeaderLabels(header_labels)
self.setSortingEnabled(True)
self.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.verticalHeader().setStretchLastSection(False)
self.verticalHeader().setVisible(True)
self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.horizontalHeader().setStretchLastSection(True)
self.horizontalHeader().setVisible(True)