本文整理汇总了Python中PyQt4.QtCore.Qt.Checked方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Checked方法的具体用法?Python Qt.Checked怎么用?Python Qt.Checked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Checked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reloadPlayers
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def reloadPlayers(self, *args):
self.players = []
for p in self.controller.available.keys():
ignored = (p in self.controller.ignored) and Qt.Checked or Qt.Unchecked
self.players.append([PlayerModelState.AVAILABLE,
p, self.getPlayerStat(p, 'ping'),
'', ignored,
self.getPlayerStat(p, 'cc'), ''])
for p, p2 in self.controller.playing.items():
ignored = (p in self.controller.ignored) and Qt.Checked or Qt.Unchecked
self.players.append([PlayerModelState.PLAYING,
p, self.getPlayerStat(p, 'ping'),
p2, ignored,
self.getPlayerStat(p, 'cc'),
self.getPlayerStat(p2, 'cc')])
for p in self.controller.awayfromkb.keys():
ignored = (p in self.controller.ignored) and Qt.Checked or Qt.Unchecked
self.players.append([PlayerModelState.AFK,
p, self.getPlayerStat(p, 'ping'),
'', ignored,
self.getPlayerStat(p, 'cc'), ''])
self.sort(self.lastSort, self.lastSortOrder)
# idx1 = self.createIndex(0, 0)
# idx2 = self.createIndex(len(self.players) - 1, PlayerModel.N_DISPLAY_COLS-1)
# self.dataChanged.emit(idx1, idx2)
示例2: set_columns
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def set_columns(self):
"""
Check columns from the configuration.
:return:
:rtype:
.. versionadded:: 1.7.5
"""
model = self.column_code_view.model()
for row in range(model.rowCount()):
col_item = model.item(row, 0)
if col_item.data() in self._columns:
col_idx = self._columns.index(col_item.data())
separator = self._column_separators[col_idx]
separator_item = QStandardItem(self.separators[separator])
model.setItem(row, 1, separator_item)
separator_item.setData(separator)
col_item.setCheckState(Qt.Checked)
示例3: add_columns
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def add_columns(self):
"""
Set the columns.
.. versionadded:: 1.7.5
"""
self._columns[:] = []
model = self.column_code_view.model()
row_data = []
for row in range(model.rowCount()):
item = model.item(row)
if item.checkState() == Qt.Checked:
id_idx = model.index(row, 0)
row_data.append(id_idx.data(Qt.UserRole + 1))
self._columns = row_data
示例4: add_column_separators
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def add_column_separators(self):
"""
Set column separators.
.. versionadded:: 1.7.5
"""
self._column_separators[:] = []
model = self.column_code_view.model()
row_data = []
for row in range(model.rowCount()):
item = model.item(row)
if item.checkState() == Qt.Checked:
id_idx = model.index(row, 1)
separator = id_idx.data(Qt.UserRole + 1)
if separator is None:
separator = ''
row_data.append(separator)
self._column_separators = row_data
示例5: selectedMappings
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def selectedMappings(self):
"""
Return a dictionary of field names and their corresponding display values.
"""
selectedAttrs = OrderedDict()
for i in range(self._attrModel.rowCount()):
displayNameItem = self._attrModel.item(i,0)
if displayNameItem.checkState() == Qt.Checked:
attrNameItem = self._attrModel.item(i,1)
selectedAttrs[attrNameItem.text()] = displayNameItem.text()
return selectedAttrs
示例6: setData
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def setData(self, modelIndex, value, role=None):
row = modelIndex.row()
col = modelIndex.column()
if role == Qt.CheckStateRole and col == PlayerModel.IGNORE:
self.players[row][col] = value
# noinspection PyUnresolvedReferences
self.dataChanged.emit(modelIndex, modelIndex)
player = self.players[row][PlayerModel.PLAYER]
if value == Qt.Checked:
self.controller.addIgnore(player)
else:
self.controller.removeIgnore(player)
return True
示例7: __init__
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def __init__(self, parent, name, children, hz=50):
super(LogGroup, self).__init__(parent)
self.name = name
self.setFlags(self.flags() | Qt.ItemIsEditable | Qt.ItemIsUserCheckable)
# Keep track of if all/none of the children are active
self.cAll = True
self.cNone = True
self.validHZ = list(OrderedDict.fromkeys([round(100/floor(100/x),2) for x in range(1,100)]))
self.hzTarget = hz
# Monitor the incoming frequency
self.fm = None
self.fmOn = True
# log config
self.lg = None
# Show text
QtGui.QTreeWidgetItem.setData(self, 0, Qt.DisplayRole, QVariant(name))
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")
QtGui.QTreeWidgetItem.setData(self, 3, Qt.DisplayRole, QVariant(0))
#QtGui.QTreeWidgetItem.setData(self, 4, Qt.CheckStateRole, Qt.Unchecked)
self.readSettings()
# Initialise Children
for c in sorted(children.keys()):
self.addChild(LogItem(self, children[c]))
self.c = 0
# Now everything is initialised except the logging
# Start logging if active
if self.checkState(0) == Qt.Checked:
self.requestLog()
示例8: logStartedCB
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def logStartedCB(self, on):
""" Called when we actually start logging """
self.c+=1
#print "counter[%s]"%self.name, self.c
#if self.c % 2 == 1:
# return
if on:
rospy.loginfo( "[%d: %s @ %.2fhz] LogCB STARTED" % (self.lg.id, self.name, self.hzTarget))
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Checked)
QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "On")
self.setAllState(Qt.Checked, activeOnly=True)
else:
rospy.loginfo( "[%s] LogCB STOPPED" % ( self.name))
#print "[%s]LogCB ENDED(%d) " % (self.name, self.c)
#if self.allSelected():
# self.setAllState(Qt.Unchecked)
##else:
## self.setAllState(Qt.Checked, activeOnly=True)
#QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
#QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")
# def logAddedCB(self, l):
# """ Called when log added """
# print "LogCB added"
# QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Checked)
# QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Added")
示例9: stopLog
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def stopLog(self):
""" User request halt """
#print "Requested log stop"
if self.lg:
self.lg.delete() #Invokes logStarted(False)
self.lg = None
if self.allSelected():
self.setAllState(Qt.Unchecked)
#else:
# self.setAllState(Qt.Checked, activeOnly=True)
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")
self.treeWidget().sig_logStatus.emit(self.name, -1)
self.fm = None
示例10: errorLog
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def errorLog(self, block, msg):
""" When a log error occurs """
#print "Log error: %s:", msg
QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Err: %s"%msg)
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
if self.allSelected():
self.setAllState(Qt.Unchecked)
else:
self.setAllState(Qt.Checked, activeOnly=True)
self.fm = None
示例11: setState
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def setState(self, chkState=Qt.Checked):
""" Sets the checkbox to on/off without calling the setData CB """
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, chkState)
示例12: readSettings
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def readSettings(self):
""" Read the HZ and selected things to log from previous session """
settings = QSettings("omwdunkley", "flieROS")
# Read if checked
onQv = settings.value("log_"+self.log.group+"."+self.log.name+"_on", QVariant(Qt.Unchecked))
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onQv if onQv.toInt()[0]!=Qt.PartiallyChecked else Qt.Checked) #Default to checked
示例13: setCheckBoxVulnerableChecked
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def setCheckBoxVulnerableChecked(self, checked=True):
"""
This function changes checkbox's state
:param checked: True or False
:return: None
"""
if checked:
self.checkBoxVulnerable.setCheckState(Qt.Checked)
else:
self.checkBoxVulnerable.setCheckState(Qt.Unchecked)
示例14: data
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def data(self, index, role = Qt.DisplayRole):
if not index.isValid():
return None
if role not in [Qt.DisplayRole, Qt.ToolTipRole, Qt.EditRole]:
return None
data = None
c = index.column()
if c == 0:
if self.utxo_script:
data = self.utxo_script.get_human()
elif c == 1:
if self.tx:
data = b2x(self.tx.serialize())
elif c == 2:
data = self.inIdx
elif c == 3:
data = sighash_types_by_value[self.sighash_type]
elif c == 4:
if role == Qt.CheckStateRole:
data = Qt.Checked if self.anyone_can_pay else Qt.Unchecked
else:
data = self.anyone_can_pay
elif c == self.SigHashName:
data = sig_hash_name(self.sighash_type | SIGHASH_ANYONECANPAY if self.anyone_can_pay else self.sighash_type)
elif c == self.SigHashExplanation:
data = sig_hash_explanation(self.sighash_type | SIGHASH_ANYONECANPAY if self.anyone_can_pay else self.sighash_type)
return data
示例15: setData
# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import Checked [as 别名]
def setData(self, column, role, value):
""" Only allow changing of the check state and the hz """
# GROUP ON/OFF
preValue = self.checkState(0)
if role == Qt.CheckStateRole and column == 0 and preValue != value:
# Check box changed, allow and trigger
#print "\n\nCONFIG CHANGED\n"
if preValue==Qt.PartiallyChecked:
#print "User clicked: Waiting for log callback, cannot change config now"
pass
elif value==Qt.Checked:
#print "User clicked: request logging"
self.requestLog()
elif value==Qt.Unchecked:
#print "User clicked: request delete logging"
self.stopLog()
# HZ CHANGED
if column == 2:
#hz = min(max(value.toInt()[0],1),100)
hz = self.getValidHZ(value.toFloat()[0])
preHz = self.data(column, Qt.DisplayRole).toFloat()[0]
#print "\n\nHZ CHANGED\n"
if hz!=preHz:
if preValue==Qt.PartiallyChecked:
pass
#print "Waiting for log callback, cannot change hz now"
elif preValue==Qt.Checked:
#print "hz changed from %.2f to %.2f while logging, replace log" % (preHz, hz)
QtGui.QTreeWidgetItem.setData(self, column, role, hz)
self.hzTarget = hz
self.requestLog()
elif preValue==Qt.Unchecked:
#print "hz changed from %.2f to %.2f, not logging yet" % (preHz, hz)
QtGui.QTreeWidgetItem.setData(self, column, role, hz)
self.hzTarget = hz