本文整理汇总了Python中PySide.QtGui.QFormLayout.setFieldGrowthPolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QFormLayout.setFieldGrowthPolicy方法的具体用法?Python QFormLayout.setFieldGrowthPolicy怎么用?Python QFormLayout.setFieldGrowthPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QFormLayout
的用法示例。
在下文中一共展示了QFormLayout.setFieldGrowthPolicy方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def __init__(self, wdg_detector, key='', parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(wdg_detector.accessibleName())
# Widgets
self._txt_key = QLineEdit()
self._txt_key.setValidator(QRegExpValidator(QRegExp(r"^(?!\s*$).+")))
self._txt_key.setText(key)
self._wdg_detector = wdg_detector
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# Layouts
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) # Fix for Mac OS
layout.addRow('Key', self._txt_key)
layout.addRow(self._wdg_detector)
layout.addRow(buttons)
self.setLayout(layout)
# Signals
self._txt_key.textChanged.connect(self._onChanged)
self._txt_key.textChanged.emit('')
buttons.accepted.connect(self._onOk)
buttons.rejected.connect(self.reject)
示例2: _createFormLayout
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def _createFormLayout(self):
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
obsFormat = self._docFormat.getObservationFormat(self._obs.__class__.__name__)
fields = dict((f.name, f) for f in self._obs.FIELDS)
self._editors = {}
for fieldName in obsFormat.fieldOrder:
field = fields[fieldName]
label = self._getFieldLabel(field)
fieldFormat = obsFormat.getFieldFormat(fieldName)
value = getattr(self._obs, fieldName)
text = fieldFormat.format(value, editing=True)
editor = _FieldValueEditor(self, fieldFormat)
editor.setText(text)
editor.setToolTip(self._getFieldToolTip(field, fieldFormat))
layout.addRow(label, editor)
self._editors[fieldName] = editor
return layout
示例3: setup_general_server_group
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def setup_general_server_group(self):
""" Setup the 'Server' group in the 'General' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Server')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
email, password = self.auth_credentials()
self.email_edit = QLineEdit(email)
self.email_edit.textChanged.connect(self.update_auth)
layout.addRow('Email', self.email_edit)
self.password_edit = QLineEdit(password)
self.password_edit.setEchoMode(QLineEdit.Password)
self.password_edit.textChanged.connect(self.update_auth)
layout.addRow('Password', self.password_edit)
show_password_widget = QCheckBox()
show_password_widget.stateChanged.connect(self.on_show_password_toggle)
layout.addRow('Show password', show_password_widget)
test_authentication_button = QPushButton('Test Authentication')
test_authentication_button.clicked.connect(self.on_test_authentication)
layout.addRow(test_authentication_button)
group.setLayout(layout)
return group
示例4: __init__
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def __init__(self, parameter, parent=None):
_ParameterWidget.__init__(self, parameter, parent)
# Widgets
self._lbl_u = QLabel('u')
self._lbl_u.setStyleSheet("color: blue")
self._txt_u = MultiNumericalLineEdit()
self._lbl_v = QLabel('v')
self._lbl_v.setStyleSheet("color: blue")
self._txt_v = MultiNumericalLineEdit()
self._lbl_w = QLabel('w')
self._lbl_w.setStyleSheet("color: blue")
self._txt_w = MultiNumericalLineEdit()
# Layouts
layout = QFormLayout()
layout.setContentsMargins(0, 0, 0, 0)
if sys.platform == 'darwin': # Fix for Mac OS
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
layout.addRow(self._lbl_u, self._txt_u)
layout.addRow(self._lbl_v, self._txt_v)
layout.addRow(self._lbl_w, self._txt_w)
self.setLayout(layout)
# Signals
self.valuesChanged.connect(self._onChanged)
self.validationRequested.connect(self._onChanged)
self._txt_u.textChanged.connect(self.valuesChanged)
self._txt_v.textChanged.connect(self.valuesChanged)
self._txt_w.textChanged.connect(self.valuesChanged)
self.validationRequested.emit()
示例5: setup_advanced_storage_group
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def setup_advanced_storage_group(self):
""" Setup the 'Storage' group in the 'Advanced' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Storage')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
path = Config.get('WEB_SOURCE_STORE', '')
self.message_storage_edit = QLineEdit(path)
self.message_storage_edit.textChanged.connect(self.update_message_storage)
layout.addRow('Message Storage Path', self.message_storage_edit)
group.setLayout(layout)
return group
示例6: setup_advanced_server_group
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def setup_advanced_server_group(self):
""" Setup the 'Server' group in the 'Advanced' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Server')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
self.message_url_edit = QLineEdit(Config.get('WS_HOST', ''))
self.message_url_edit.textChanged.connect(self.update_message_url)
layout.addRow('Messages API URL', self.message_url_edit)
group.setLayout(layout)
return group
示例7: __init__
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def __init__(self, wdg_limit, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(wdg_limit.accessibleName())
# Widgets
self._wdg_limit = wdg_limit
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# Layouts
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) # Fix for Mac OS
layout.addRow(self._wdg_limit)
layout.addRow(buttons)
self.setLayout(layout)
# Signals
buttons.accepted.connect(self._onOk)
buttons.rejected.connect(self.reject)
示例8: _initUI
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def _initUI(self):
layout = QFormLayout()
if sys.platform == 'darwin': # Fix for Mac OS
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
return layout
示例9: _initUI
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def _initUI(self):
# Widgets
self._rb_delimited = QRadioButton('Delimited')
self._rb_delimited.setChecked(False)
self._lbl_elevation = QLabel("Elevation")
self._lbl_elevation.setStyleSheet("color: blue")
self._txt_elevation = _AngleRangeWidget(_DelimitedDetector.elevation_rad)
self._txt_elevation.setEnabled(False)
self._txt_elevation.setRequired(False)
self._lbl_azimuth = QLabel('Azimuth')
self._lbl_azimuth.setStyleSheet("color: blue")
self._txt_azimuth = _AngleRangeWidget(_DelimitedDetector.azimuth_rad)
self._txt_azimuth.setEnabled(False)
self._txt_azimuth.setRequired(False)
self._rb_annular = QRadioButton('Annular')
self._rb_annular.setChecked(True)
self._lbl_takeoffangle = QLabel('Take-off angle')
self._lbl_takeoffangle.setStyleSheet("color: blue")
param_takeoffangle = \
AngleParameter(validators=range_validator(0.0, HALFPI),
doc='Take-off angle from the x-y plane')
param_takeoffangle._name = 'takeoffangle'
self._txt_takeoffangle = AngleParameterWidget(param_takeoffangle)
self._lbl_opening = QLabel('Opening')
self._lbl_opening.setStyleSheet("color: blue")
param_opening = \
AngleParameter(validators=range_validator(0.0, HALFPI, False),
doc='Opening angle from the take-off angle (above and below)')
param_opening._name = 'opening'
self._txt_opening = AngleParameterWidget(param_opening)
# Layouts
layout = _DetectorWidget._initUI(self)
layout.addRow(self._rb_delimited)
sublayout = QFormLayout()
sublayout.setContentsMargins(10, 0, 0, 0)
if sys.platform == 'darwin': # Fix for Mac OS
sublayout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
sublayout.addRow(self._lbl_elevation, self._txt_elevation)
sublayout.addRow(self._lbl_azimuth, self._txt_azimuth)
layout.addRow(sublayout)
layout.addRow(self._rb_annular)
sublayout = QFormLayout()
sublayout.setContentsMargins(10, 0, 0, 0)
if sys.platform == 'darwin': # Fix for Mac OS
sublayout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
sublayout.addRow(self._lbl_takeoffangle, self._txt_takeoffangle)
sublayout.addRow(self._lbl_opening, self._txt_opening)
layout.addRow(sublayout)
# Signals
self._rb_delimited.toggled.connect(self._onToggle)
self._rb_annular.toggled.connect(self._onToggle)
return layout
示例10: __init__
# 需要导入模块: from PySide.QtGui import QFormLayout [as 别名]
# 或者: from PySide.QtGui.QFormLayout import setFieldGrowthPolicy [as 别名]
def __init__(self, results, result_key,
parameter_getters, x_parameter_name,
series=None, parent=None):
QDialog.__init__(self, parent)
# Variables
self._results = results
self._result_key = result_key
self._parameter_getters = parameter_getters
options = results.options
# Widgets
self._txt_name = QLineEdit()
self._cb_parameters = {}
for name, getter in parameter_getters.items():
if name == x_parameter_name:
continue
combobox = QComboBox()
values = np.array(getter(options), ndmin=1)
combobox.setModel(_ValuesModel(values))
self._cb_parameters[name] = combobox
self._cb_summary_key = QComboBox()
self._cb_summary_key.setModel(_ValuesModel([]))
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# Layouts
layout = QFormLayout()
if sys.platform == 'darwin': # Fix for Mac OS
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
layout.addRow('Name', self._txt_name)
for name, combobox in self._cb_parameters.items():
layout.addRow(name, combobox)
layout.addRow('Summary variable', self._cb_summary_key)
layout.addRow(buttons)
self.setLayout(layout)
# Signals
buttons.accepted.connect(self._onOk)
buttons.rejected.connect(self.reject)
for combobox in self._cb_parameters.values():
combobox.currentIndexChanged.connect(self._onParameterChanged)
# Defaults
if series is not None:
self._txt_name.setText(series.name)
for name, _, value in series.conditions:
combobox = self._cb_parameters[name]
index = combobox.model().valueIndex(value)
combobox.setCurrentIndex(index)
self._onParameterChanged()
index = self._cb_summary_key.model().valueIndex(series.summary_key)
self._cb_summary_key.setCurrentIndex(index)
else:
self._onParameterChanged()