def __init__(self, parent=None, title=None): super(Create_from_selection, self).__init__(parent) self.setStyleSheet(cfg.stylesheet) self.setMaximumWidth(200) self.setMinimumWidth(200) self.setMaximumHeight(50) self.label = QtWidgets.QLabel() self.label.setPixmap(cfg.new_icon) # layout = QtWidgets.QVBoxLayout(self) self.item_name = QtWidgets.QLabel(title) # self.text_input = QtWidgets.QLineEdit() self.include_radio = QtWidgets.QRadioButton("Include all connections") self.include_radio.setChecked(True) self.exclude_radio = QtWidgets.QRadioButton("Include only textures") layout.addWidget(self.item_name) # layout.addWidget(self.text_input) layout.addWidget(self.include_radio) layout.addWidget(self.exclude_radio) buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons)
def __init__(self, parent, label=None, options=None, ic=None): super(GroupRadioInput, self).__init__(parent) self.options = [option for option in options] self.option = self.options[0] self.layout = QtWidgets.QHBoxLayout(self) self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setAlignment(QtCore.Qt.AlignLeft) if ic: self.icon = QtWidgets.QLabel() self.icon.setPixmap(ic) self.icon.setMinimumSize(QtCore.QSize(24, 24)) self.layout.addWidget(self.icon) self.icon.setAlignment(QtCore.Qt.AlignTop) if label: self.label = QtWidgets.QLabel(label) self.label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.label) self.label.setAlignment(QtCore.Qt.AlignTop) self.options_widget = QtWidgets.QWidget() self.layout.addWidget(self.options_widget) self.options_widget_layout = QtWidgets.QVBoxLayout(self.options_widget) self.options_radio_widgets = [] for option in self.options: option_widget = QtWidgets.QRadioButton(option) self.options_radio_widgets.append( option_widget ) self.options_widget_layout.addWidget(option_widget) option_widget.clicked.connect(self.selection) self.options_radio_widgets[0].setChecked(True)