def __init__(self, filename: str = None, selection_filter: str = None, parent: QtGui.QWidget = None): self.selection_filter = selection_filter self.filename = None super().__init__(parent) self.select_button = create_button( _("Choose a file…"), min_size=True, connect=self.select_file, icon="edit-find" ) self.line_editor = QtGui.QLineEdit(p(self)) self.set_value(filename) layout = h_layout(self, self.select_button, self.line_editor) self.setLayout(layout) self.adjustSize()
def __init__(self, color: str = None, parent: QtGui.QWidget = None): self.color = None super().__init__(parent) self.select_button = create_button( _("Choose a color…"), min_size=True, connect=self.select_color, icon="preferences-color" ) self.line_editor = QtGui.QLineEdit(p(self)) self.line_editor.setValidator(self.validator) if not color or not COLOR_RE.match(color): color = None self.set_value(color) layout = h_layout(self, self.select_button, self.line_editor) self.setLayout(layout) self.adjustSize()
def __init__(self, initial=None, parent=None): QtGui.QDialog.__init__(self, p(parent)) BaseForm.__init__(self, initial=initial) ThreadedCalls.__init__(self) # widget creation widgets = [] if self.description: widgets.append(QtGui.QLabel(self.description, p(self))) sub_layout = QtGui.QFormLayout(self) self._fill_form_layout(layout=sub_layout) widgets.append(sub_layout) self._buttons = [] if self.text_confirm: self._buttons.append(create_button(self.text_confirm, connect=self.accept, min_size=True)) if self.text_cancel: self._buttons.append(create_button(self.text_cancel, connect=self.reject, min_size=True)) if self._buttons: widgets.append(h_layout(self, *self._buttons, direction=QtGui.QBoxLayout.RightToLeft)) self.setLayout(v_layout(self, *widgets)) if self.verbose_name: self.setWindowTitle(str(self.verbose_name)) self.raise_()