本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.blockSignals方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.blockSignals方法的具体用法?Python QDoubleSpinBox.blockSignals怎么用?Python QDoubleSpinBox.blockSignals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.blockSignals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlotConfigPanel
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import blockSignals [as 别名]
class PlotConfigPanel(QFrame):
"""A panel to interact with PlotConfig instances."""
plot_marker_styles = ["", ".", ",", "o", "*", "s", "+", "x", "p", "h", "H", "D", "d"]
plot_line_styles = ["", "-", "--", "-.", ":"]
def __init__(self, plot_config):
QFrame.__init__(self)
self.plot_config = plot_config
self.connect(plot_config.signal_handler, SIGNAL('plotConfigChanged(PlotConfig)'), self._fetchValues)
layout = QFormLayout()
layout.setRowWrapPolicy(QFormLayout.WrapLongRows)
self.chk_visible = QCheckBox()
layout.addRow("Visible:", self.chk_visible)
self.connect(self.chk_visible, SIGNAL('stateChanged(int)'), self._setVisibleState)
self.plot_linestyle = QComboBox()
self.plot_linestyle.addItems(self.plot_line_styles)
self.connect(self.plot_linestyle, SIGNAL("currentIndexChanged(QString)"), self._setLineStyle)
layout.addRow("Line style:", self.plot_linestyle)
self.plot_marker_style = QComboBox()
self.plot_marker_style.addItems(self.plot_marker_styles)
self.connect(self.plot_marker_style, SIGNAL("currentIndexChanged(QString)"), self._setMarker)
layout.addRow("Marker style:", self.plot_marker_style)
self.alpha_spinner = QDoubleSpinBox(self)
self.alpha_spinner.setMinimum(0.0)
self.alpha_spinner.setMaximum(1.0)
self.alpha_spinner.setDecimals(3)
self.alpha_spinner.setSingleStep(0.01)
self.connect(self.alpha_spinner, SIGNAL('valueChanged(double)'), self._setAlpha)
layout.addRow("Blend factor:", self.alpha_spinner)
self.color_picker = ColorPicker(plot_config)
layout.addRow("Color:", self.color_picker)
self.setLayout(layout)
self._fetchValues(plot_config)
def _fetchValues(self, plot_config):
"""Fetch values from a PlotConfig and insert into the panel."""
self.plot_config = plot_config
#block signals to avoid updating the incoming plot_config
state = self.plot_linestyle.blockSignals(True)
linestyle_index = self.plot_line_styles.index(self.plot_config.linestyle)
self.plot_linestyle.setCurrentIndex(linestyle_index)
self.plot_linestyle.blockSignals(state)
state = self.plot_marker_style.blockSignals(True)
marker_index = self.plot_marker_styles.index(self.plot_config.marker)
self.plot_marker_style.setCurrentIndex(marker_index)
self.plot_marker_style.blockSignals(state)
state = self.alpha_spinner.blockSignals(True)
self.alpha_spinner.setValue(self.plot_config.alpha)
self.alpha_spinner.blockSignals(state)
state = self.chk_visible.blockSignals(True)
self.chk_visible.setChecked(self.plot_config.is_visible)
self.chk_visible.blockSignals(state)
self.color_picker.update()
#-------------------------------------------
# update plot config from widgets
#-------------------------------------------
def _setLineStyle(self, linestyle):
self.plot_config.linestyle = linestyle
def _setMarker(self, marker):
self.plot_config.marker = marker
def _setAlpha(self, alpha):
self.plot_config.alpha = alpha
def _setVisibleState(self, state):
self.plot_config.is_visible = state == 2