本文整理汇总了Python中PyQt4.QtGui.QListView.blockSignals方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.blockSignals方法的具体用法?Python QListView.blockSignals怎么用?Python QListView.blockSignals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.blockSignals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWSpiralogram
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import blockSignals [as 别名]
class OWSpiralogram(widget.OWWidget):
name = 'Spiralogram'
description = "Visualize time series' periodicity in a spiral heatmap."
icon = 'icons/Spiralogram.svg'
priority = 120
inputs = [("Time series", Table, 'set_data')]
outputs = [("Time series", Timeseries)]
settingsHandler = settings.DomainContextHandler()
ax1 = settings.ContextSetting('months of year')
ax2 = settings.ContextSetting('years')
agg_attr = settings.ContextSetting([])
agg_func = settings.ContextSetting(0)
graph_name = 'chart'
def __init__(self):
self.data = None
self.indices = []
box = gui.vBox(self.controlArea, 'Axes')
self.combo_ax2 = gui.comboBox(
box, self, 'ax2', label='Y axis:', callback=self.replot,
sendSelectedValue=True, orientation='horizontal')
self.combo_ax1 = gui.comboBox(
box, self, 'ax1', label='Radial:', callback=self.replot,
sendSelectedValue=True, orientation='horizontal')
box = gui.vBox(self.controlArea, 'Aggregation')
self.combo_func = gui.comboBox(
box, self, 'agg_func', label='Function:', orientation='horizontal',
callback=self.replot)
func_model = ListModel(AGG_FUNCTIONS, parent=self)
self.combo_func.setModel(func_model)
self.attrlist_model = VariableListModel(parent=self)
self.attrlist = QListView(selectionMode=QListView.SingleSelection)
self.attrlist.setModel(self.attrlist_model)
self.attrlist.selectionModel().selectionChanged.connect(
self.attrlist_selectionChanged)
box.layout().addWidget(self.attrlist)
gui.rubber(self.controlArea)
self.chart = chart = Spiralogram(self,
selection_callback=self.on_selection)
self.mainArea.layout().addWidget(chart)
def attrlist_selectionChanged(self):
self.agg_attr = [self.attrlist_model[i.row()]
for i in self.attrlist.selectionModel().selectedIndexes()]
self.replot()
def set_data(self, data):
self.data = data = None if data is None else Timeseries.from_data_table(data)
def init_combos():
for combo in (self.combo_ax1, self.combo_ax2):
combo.clear()
newmodel = []
if data is not None and data.time_variable is not None:
for i in Spiralogram.AxesCategories:
for combo in (self.combo_ax1, self.combo_ax2):
combo.addItem(_enum_str(i))
for var in data.domain if data is not None else []:
if (var.is_primitive() and
(var is not data.time_variable or
isinstance(var, TimeVariable) and data.time_delta is None)):
newmodel.append(var)
if var.is_discrete:
for combo in (self.combo_ax1, self.combo_ax2):
combo.addItem(gui.attributeIconDict[var], var.name)
self.attrlist_model.wrap(newmodel)
init_combos()
self.chart.clear()
if data is None:
self.commit()
return
self.closeContext()
self.ax2 = next((self.combo_ax2.itemText(i)
for i in range(self.combo_ax2.count())), '')
self.ax1 = next((self.combo_ax1.itemText(i)
for i in range(1, self.combo_ax1.count())), self.ax2)
self.agg_attr = [data.domain[0]] if len(data.domain) else []
self.agg_func = 0
self.openContext(data.domain)
if self.agg_attr:
self.attrlist.blockSignals(True)
self.attrlist.selectionModel().clear()
for attr in self.agg_attr:
try:
row = self.attrlist_model.indexOf(attr)
except ValueError:
continue
self.attrlist.selectionModel().select(
self.attrlist_model.index(row),
QItemSelectionModel.SelectCurrent)
self.attrlist.blockSignals(False)
#.........这里部分代码省略.........