Esempio n. 1
0
    def _setup_form(self) -> None:
        """Setup form for user interaction."""
        self.form_group_box = qt.QGroupBox("Options")

        form_layout = qt.QFormLayout()
        form_layout.addRow(qt.QLabel("Language:"), self.lang_combobox)
        form_layout.addRow(qt.QLabel("Field of word:"), self.base_combobox)
        form_layout.addRow(qt.QLabel("Field of IPA transcription:"), self.field_combobox)

        self.form_group_box.setLayout(form_layout)
Esempio n. 2
0
def createColorSelect(self, row, csName, labelText):
    '''
    Creates a color select with the specified label.
    '''
    label = qt.QLabel(labelText)
    selectButton = qt.QPushButton('Select')
    csPreviewName = '%sPreview' % csName
    csDialogName = '%sDialog' % csName
    setattr(self, csPreviewName, qt.QLabel(''))
    setattr(self, csDialogName, qt.QColorDialog(selectButton))
    getattr(self, csDialogName).setOption(qt.QColorDialog.DontUseNativeDialog)
    selectButton.pressed.connect(lambda: selectColorDialog(
        getattr(self, csDialogName), getattr(self, csPreviewName)))
    self.lifeDrainLayout.addWidget(label, row, 0)
    self.lifeDrainLayout.addWidget(selectButton, row, 2)
    self.lifeDrainLayout.addWidget(getattr(self, csPreviewName), row, 3)
Esempio n. 3
0
def createCheckBox(self, row, cbName, labelText):
    '''
    Creates a checkbox with the specified label.
    '''
    label = qt.QLabel(labelText)
    setattr(self, cbName, qt.QCheckBox(self.lifeDrainWidget))
    self.lifeDrainLayout.addWidget(label, row, 0)
    self.lifeDrainLayout.addWidget(getattr(self, cbName), row, 2, 1, 2)
Esempio n. 4
0
def createSpinBox(self, row, sbName, labelText, valRange):
    '''
    Creates a spin box with the specified label and range.
    '''
    label = qt.QLabel(labelText)
    setattr(self, sbName, qt.QSpinBox(self.lifeDrainWidget))
    getattr(self, sbName).setRange(valRange[0], valRange[1])
    self.lifeDrainLayout.addWidget(label, row, 0)
    self.lifeDrainLayout.addWidget(getattr(self, sbName), row, 2, 1, 2)
Esempio n. 5
0
def createLabel(self, row, text, color=None):
    '''
    Creates a label that occupies the whole line and wraps if it is too big.
    '''
    label = qt.QLabel(text)
    label.setWordWrap(True)
    self.lifeDrainLayout.addWidget(label, row, 0, 1, 4)
    if color:
        label.setStyleSheet('color: {}'.format(color))
Esempio n. 6
0
def createComboBox(self, row, cbName, labelText, options):
    '''
    Creates a combo box with the specified label and options.
    '''
    label = qt.QLabel(labelText)
    setattr(self, cbName, qt.QComboBox(self.lifeDrainWidget))
    for option in options:
        getattr(self, cbName).addItem(option)
    self.lifeDrainLayout.addWidget(label, row, 0)
    self.lifeDrainLayout.addWidget(getattr(self, cbName), row, 2, 1, 2)