本文整理汇总了Python中parameters.qt_widgets.parameter_container.ParameterContainer.hide方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterContainer.hide方法的具体用法?Python ParameterContainer.hide怎么用?Python ParameterContainer.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameters.qt_widgets.parameter_container.ParameterContainer
的用法示例。
在下文中一共展示了ParameterContainer.hide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GroupParameterWidget
# 需要导入模块: from parameters.qt_widgets.parameter_container import ParameterContainer [as 别名]
# 或者: from parameters.qt_widgets.parameter_container.ParameterContainer import hide [as 别名]
class GroupParameterWidget(GenericParameterWidget):
"""Widget class for List parameter."""
def __init__(self, parameter, parent=None):
"""Constructor
.. versionadded:: 2.2
:param parameter: A GroupParameter object.
:type parameter: GroupParameter
"""
super(GroupParameterWidget, self).__init__(parameter, parent)
# Get the parameter label and use its value as the checkbox text
label_item = self.input_layout.itemAt(0)
label_widget = label_item.widget()
text = label_widget.text()
self._enable_check_box = QCheckBox(text)
# Tooltips
self.setToolTip('Tick here to enable ' + self._parameter.name)
# add all widget in the group
self._group_layout = QVBoxLayout()
self._group_layout.setSpacing(0)
if not self._parameter.is_required:
self.input_layout.insertWidget(0, self._enable_check_box)
# now we don't need the parameter label anymore so chuck it
self.input_layout.removeItem(label_item)
# Make the sub group appear indented
self._group_layout.setContentsMargins(20, 0, 0, 0)
else:
self._parameter.enable_parameter = True
self.main_layout.addLayout(self._group_layout)
# Why are we doing imports here? TS
from parameters.qt_widgets.parameter_container import ParameterContainer
self.param_container = ParameterContainer(
parameters=self._parameter.value)
self.param_container.setup_ui(must_scroll=parameter.must_scroll)
# add handlers
# noinspection PyUnresolvedReferences
self._enable_check_box.stateChanged.connect(
self.on_enable_checkbox_changed)
self._enable_check_box.setChecked(self._parameter.enable_parameter)
self.on_enable_checkbox_changed(self._parameter.enable_parameter)
self._group_layout.addWidget(self.param_container)
def on_enable_checkbox_changed(self, state):
if state:
self.param_container.show()
else:
self.param_container.hide()
self._parameter.enable_parameter = state
def get_parameter(self):
"""Obtain list parameter object from the current widget state.
:returns: A ListParameter from the current state of widget
"""
if self._parameter.enable_parameter:
parameters = self.param_container.get_parameters()
self._parameter.value = parameters
self._parameter.validate()
return self._parameter