本文整理匯總了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