当前位置: 首页>>代码示例>>Python>>正文


Python QCheckBox.setDisabled方法代码示例

本文整理汇总了Python中PySide.QtGui.QCheckBox.setDisabled方法的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox.setDisabled方法的具体用法?Python QCheckBox.setDisabled怎么用?Python QCheckBox.setDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QCheckBox的用法示例。


在下文中一共展示了QCheckBox.setDisabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SceneTab

# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setDisabled [as 别名]
class SceneTab(QWidget):  # FIXME I'm Ugly.
    """This widget is for changing the Scene propagation policies
       of the module.
    """

    def __init__(self, parent, agent):
        """Construct the SceneTab with the given parent (TabDialog) and
           ModuleAgent.
        """
        super(SceneTab, self).__init__(parent)

        self.agent = agent

        self.layout = QVBoxLayout()
        self.layout.setAlignment(Qt.AlignCenter)

        self.layout.addWidget(self.buildHighlightGroupBox())
        self.layout.addItem(QSpacerItem(5, 5))
        self.layout.addWidget(self.buildModuleGroupBox())
        self.layout.addItem(QSpacerItem(5, 5))
        self.layout.addWidget(self.buildAttributeGroupBox())

        self.setLayout(self.layout)

    def buildHighlightGroupBox(self):
        """Layout/construct the highlight UI for this tab."""
        groupBox = QGroupBox("Highlight Policy")
        layout = QVBoxLayout()

        # agent.propagate_highlights
        self.highlights_propagate = QCheckBox("Propagate highlights to " + "other modules.")
        self.highlights_propagate.setChecked(self.agent.propagate_highlights)
        self.highlights_propagate.stateChanged.connect(self.highlightsPropagateChanged)
        # We only allow this change if the parent does not propagate
        if self.agent.parent().propagate_highlights:
            self.highlights_propagate.setDisabled(True)

        # agent.apply_highlights
        self.applyHighlights = QCheckBox("Apply highlights from " + "other modules.")
        self.applyHighlights.setChecked(self.agent.apply_highlights)
        self.applyHighlights.stateChanged.connect(self.applyHighlightsChanged)

        layout.addWidget(self.applyHighlights)
        layout.addItem(QSpacerItem(5, 5))
        layout.addWidget(self.highlights_propagate)
        groupBox.setLayout(layout)
        return groupBox

    def highlightsPropagateChanged(self):
        """Called when highlight propagtion is changed to update the
           Agent.
        """
        self.agent.propagate_highlights = self.highlights_propagate.isChecked()

    def applyHighlightsChanged(self):
        """Called when highlight application is changed to update the
           Agent.
        """
        self.agent.apply_highlights = self.applyHighlights.isChecked()

    def buildModuleGroupBox(self):
        """Layout/construct the ModuleScene UI for this tab."""
        groupBox = QGroupBox("Module Policy")
        layout = QVBoxLayout()

        # agent.propagate_module_scenes
        self.module_propagate = QCheckBox("Propagate module scene information " + "to other modules.")
        self.module_propagate.setChecked(self.agent.propagate_module_scenes)
        self.module_propagate.stateChanged.connect(self.modulePropagateChanged)
        # We only allow this change if the parent does not propagate
        if self.agent.parent().propagate_module_scenes:
            self.module_propagate.setDisabled(True)

        # agent.apply_module_scenes
        self.module_applyScene = QCheckBox("Apply module scene information " + "from other modules.")
        self.module_applyScene.setChecked(self.agent.apply_module_scenes)
        self.module_applyScene.stateChanged.connect(self.moduleApplyChanged)

        layout.addWidget(self.module_applyScene)
        layout.addItem(QSpacerItem(5, 5))
        layout.addWidget(self.module_propagate)
        groupBox.setLayout(layout)
        return groupBox

    def modulePropagateChanged(self):
        """Called when ModuleScene propagtion is changed to update the
           Agent.
        """
        self.agent.propagate_module_scenes = self.module_propagate.isChecked()

    def moduleApplyChanged(self):
        """Called when ModuleScene application is changed to update the
           Agent.
        """
        self.agent.apply_module_scenes = self.module_applyScene.isChecked()

    def buildAttributeGroupBox(self):
        """Layout/construct the AttributeScene UI for this tab."""
        groupBox = QGroupBox("Attribute Policy (Colors)")
        layout = QVBoxLayout()
#.........这里部分代码省略.........
开发者ID:Schizo,项目名称:boxfish,代码行数:103,代码来源:ModuleFrame.py


注:本文中的PySide.QtGui.QCheckBox.setDisabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。