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


Python QtGui.QFormLayout类代码示例

本文整理汇总了Python中PySide.QtGui.QFormLayout的典型用法代码示例。如果您正苦于以下问题:Python QFormLayout类的具体用法?Python QFormLayout怎么用?Python QFormLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _createFormLayout

 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
开发者ID:HaroldMills,项目名称:Maka,代码行数:28,代码来源:ObservationDialog.py

示例2: FormWidget

class FormWidget(QWidget):
    def __init__(self, parent=None, submit_callback=None, inputs=None):
        super(FormWidget, self).__init__(parent)

        if inputs is None:
            inputs = {}

        self.submit_callback = submit_callback

        self.form = QFormLayout()

        self.inputs = {}
        for key in inputs:
            self.inputs[key] = QLineEdit()
            self.form.addRow(QLabel(key), self.inputs[key])

        self.submitButton = QPushButton("Submit")
        self.submitButton.clicked.connect(self.button_pushed)

        self.form.addRow(self.submitButton)

        self.setLayout(self.form)

    def button_pushed(self, checked):
        if self.submit_callback:
            values = {key: self.inputs[key].text()
                      for key in self.inputs}
            self.submit_callback(values)
开发者ID:timmartin,项目名称:TrivialUI,代码行数:28,代码来源:__init__.py

示例3: __init__

    def __init__(self,parent=None):
        super(QtReducePreferencesComputation,self).__init__(parent)

        reduceGroup = QGroupBox("Reduce")

        self.reduceBinary = QLineEdit()

        # font = self.reduceBinary.font()
        # font.setFamily(QSettings().value("worksheet/fontfamily",
        #                                QtReduceDefaults.FONTFAMILY))
        # self.reduceBinary.setFont(font)

        self.reduceBinary.setText(QSettings().value("computation/reduce",
                                                    QtReduceDefaults.REDUCE))

        self.reduceBinary.editingFinished.connect(self.editingFinishedHandler)

        reduceLayout = QFormLayout()
        reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary)

        reduceGroup.setLayout(reduceLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(reduceGroup)

        self.setLayout(mainLayout)
开发者ID:webushka,项目名称:reduce,代码行数:26,代码来源:qrpreferences.py

示例4: __init__

 def __init__(self):
     super(PhoneFrame, self).__init__()
     self.setWindowTitle('Phone Book.')
     self.name = QLineEdit()
     self.number = QLineEdit()
     entry = QFormLayout()
     entry.addRow(QLabel('Name'), self.name)
     entry.addRow(QLabel('Number'), self.number)
     buttons = QHBoxLayout()
     button = QPushButton('&Add')
     button.clicked.connect(self._addEntry)
     buttons.addWidget(button)
     button = QPushButton('&Update')
     button.clicked.connect(self._updateEntry)
     buttons.addWidget(button)
     button = QPushButton('&Delete')
     button.clicked.connect(self._deleteEntry)
     buttons.addWidget(button)
     dataDisplay = QTableView()
     dataDisplay.setModel(PhoneDataModel())
     layout = QVBoxLayout()
     layout.addLayout(entry)
     layout.addLayout(buttons)
     layout.addWidget(dataDisplay)
     self.setLayout(layout)
     self.show()
开发者ID:stevengonsalvez,项目名称:python_training,代码行数:26,代码来源:phonebook_pyside.py

示例5: SetLayout

 def SetLayout(self):
     formLayout = QFormLayout(self)
     labelUsername = QLabel("Username")
     txtUsername = QLineEdit()
     labelPassword = QLabel("Password")
     txtPassword = QLineEdit()
     formLayout.addRow(labelUsername, txtUsername)
     formLayout.addRow(labelPassword, txtPassword)
     self.setLayout(formLayout)
开发者ID:sebastian-code,项目名称:squick-pyside,代码行数:9,代码来源:app_23.py

示例6: __init__

    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)
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:27,代码来源:detector.py

示例7: __init__

    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()
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:35,代码来源:beam.py

示例8: setLayoutForm

 def setLayoutForm(self):
     """Présentation du QFormLayout"""
     self.setWindowTitle("Form Layout")
     formLayout = QFormLayout(self)
     labelUser = QLabel("Username")
     txtUser = QLineEdit()
     labelPass = QLabel("Password")
     txtPass = QLineEdit()
     formLayout.addRow(labelUser, txtUser)
     formLayout.addRow(labelPass, txtPass)
     self.setLayout(formLayout)
开发者ID:Pampipampupampa,项目名称:Cours-Python,代码行数:11,代码来源:qBoxLayout.py

示例9: SetLayout

 def SetLayout(self):
     
     formLayout = QFormLayout(self)
     lUsername = QLabel("Username")
     txtUsername = QLineEdit()
     lPasswd = QLabel("Passwd")
     txPasswd = QLineEdit()
     formLayout.addRow(lUsername, txtUsername)
     formLayout.addRow(lPasswd, txPasswd)
     
     self.setLayout(formLayout)
开发者ID:MarlonPassos,项目名称:pysideGuiApplication,代码行数:11,代码来源:qformlayout.py

示例10: __init__

    def __init__(self):
        QDialog.__init__(self)

        layout = QFormLayout(self)
        self.setLayout(layout)
        layout.addRow("Python version:", QLabel("%s.%s.%s (%s)" % 
                        (sys.version_info[0], 
                         sys.version_info[1], 
                         sys.version_info[2], 
                         sys.version_info[3])))

        layout.addRow("Qt version:", QLabel( qVersion()))
开发者ID:afester,项目名称:CodeSamples,代码行数:12,代码来源:helloPyside.py

示例11: __init__

 def __init__(self, url="", parent=None):
     super(WSDLDialog, self).__init__()
     self.setWindowTitle("Select Web Service")
     layout = QVBoxLayout(self)
     
     form = QWidget(self)
     form_layout = QFormLayout(form)
     self.wsdl_field = QLineEdit()
     self.wsdl_field.setText(url)
     form_layout.addRow("WSDL Address:", self.wsdl_field)
     
     layout.addWidget(form)
     
     self.auth = QGroupBox("Use HTTP Basic Authentication")
     self.auth.setCheckable(True)
     self.auth.setChecked(False)
     
     auth_layout = QFormLayout(self.auth)
     
     self.user_field = QLineEdit()
     auth_layout.addRow("Username:", self.user_field)
     
     self.pass_field = QLineEdit()
     auth_layout.addRow("Pass:", self.pass_field)
     
     layout.addWidget(self.auth)
     
     button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     button_box.accepted.connect(self.accept)
     button_box.rejected.connect(self.reject)
     
     layout.addWidget(button_box)
开发者ID:michaelballantyne,项目名称:py-ws-client,代码行数:32,代码来源:pywscclient.py

示例12: testGetItemPosition

    def testGetItemPosition(self):
        formlayout = QFormLayout()
        row, role = formlayout.getItemPosition(0)
        self.assert_(isinstance(row, int))
        self.assert_(isinstance(role, QFormLayout.ItemRole))
        self.assertEqual(row, -1)

        widget = QWidget()
        formlayout.addRow(widget)
        row, role = formlayout.getItemPosition(0)
        self.assert_(isinstance(row, int))
        self.assert_(isinstance(role, QFormLayout.ItemRole))
        self.assertEqual(row, 0)
        self.assertEqual(role, QFormLayout.SpanningRole)
开发者ID:Hasimir,项目名称:PySide,代码行数:14,代码来源:qformlayout_test.py

示例13: _initUI

    def _initUI(self):
        # Widgets
        self._txt_showers = QLineEdit()
        self._txt_showers.setText(str(self.result().showers))

        # Layouts
        layout = _SaveableResultWidget._initUI(self)

        sublayout = QFormLayout()
        if sys.platform == "darwin":  # Fix for Mac OS
            layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
        sublayout.addRow("Number of showers", self._txt_showers)
        layout.addLayout(sublayout)

        layout.addStretch()

        return layout
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:17,代码来源:result.py

示例14: __init__

    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
开发者ID:weijer,项目名称:dotStudio,代码行数:26,代码来源:FnPdfExporter.py

示例15: setup_advanced_server_group

    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
开发者ID:brett-patterson,项目名称:d-clock,代码行数:18,代码来源:preferences_dialog.py


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