Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(ChooseTypeDepPage, self).__init__(*args, **kwargs)

        self.setTitle("Choose the type of dependency")

        layout = QtGui.QVBoxLayout(self)
        self.__title = QtGui.QLabel("", self)
        layout.addWidget(self.__title)

        self.__radioGroup = QtGui.QButtonGroup(self)
        self.__radioGroup.setExclusive(True)

        for val, meta in sorted(DEPEND_TYPES.items()):

            btn = QtGui.QRadioButton(meta['label'], self)
            self.__radioGroup.addButton(btn, val)

            label = QtGui.QLabel(
                "<font color='#c3c3c3'>%s</font>" % meta['descript'], self)
            label.setIndent(30)
            font = btn.font()
            font.setPointSize(font.pointSize() - 1)
            label.setFont(font)

            layout.addWidget(btn)
            layout.addWidget(label)

        self.registerField("dependType*", self, "dependType")
        self.__radioGroup.buttonClicked[int].connect(self.completeChanged)
Exemplo n.º 2
0
    def __init__(self, title, options, cols=3, parent=None):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)

        group_box = QtGui.QGroupBox(title)
        group_box_layout = QtGui.QGridLayout(group_box)

        row = 0
        for item, opt in enumerate(options):
            row = item / cols
            radio = QtGui.QRadioButton(opt, self)
            group_box_layout.addWidget(radio, row, item % cols)

        layout.addWidget(group_box)