Esempio n. 1
0
    def __init__(self, title, parent=None):
        super().__init__(title, parent)

        # buttons for adding/removing a box
        self.sub = gpi.BasicPushButton()
        self.sub.set_toggle(False)
        self.sub.set_button_title(u'\u2212')
        self.sub.valueChanged.connect(self.removeBox)
        self.add = gpi.BasicPushButton()
        self.add.set_toggle(False)
        self.add.set_button_title(u'\uFF0B')
        self.add.valueChanged.connect(self.addBox)

        self.hbox = QtWidgets.QHBoxLayout()
        self.hbox.setSpacing(0)
        self.hbox.addWidget(self.sub)
        self.hbox.addWidget(self.add)

        # at least one spin box
        self.boxes = []
        self.boxes.append(gpi.BasicSpinBox())
        self.vbox = QtWidgets.QVBoxLayout()
        self.vbox.setSpacing(0)

        self.vbox.addLayout(self.hbox)
        for box in self.boxes:
            self.vbox.addWidget(box)
            box.valueChanged.connect(self.valueChanged)
        self.setLayout(self.vbox)
Esempio n. 2
0
 def __init__(self, title, parent=None):
     super().__init__(title, parent)
     self.sl = gpi.BasicCWFCSliders()
     self.sl.valueChanged.connect(self.valueChanged)
     self.pb = gpi.BasicPushButton()
     self.pb.set_button_title('reset')
     # layout
     wdgLayout = QtWidgets.QVBoxLayout()
     wdgLayout.addWidget(self.sl)
     wdgLayout.addWidget(self.pb)
     self.setLayout(wdgLayout)
     # default
     self.set_min(0)
     self.set_max(100)
     self.sl.set_allvisible(True)
     self.reset_sliders()
     self.pb.valueChanged.connect(self.reset_sliders)
Esempio n. 3
0
    def __init__(self, title, parent=None):
        super().__init__(title, parent)

        self._val = {}
        self._val['compute'] = False
        self._val['length'] = 1
        self._val['in_len'] = 1  # the original array length

        self.pb = gpi.BasicPushButton()
        self.pb.set_toggle(True)

        self.db = gpi.BasicDoubleSpinBox()  # factor
        self.db.set_label('factor:')
        self.db.set_min(0.001)
        self.db.set_max(gpi.GPI_FLOAT_MAX)
        self.db.set_decimals(3)
        self.db.set_singlestep(0.001)
        self.db.set_val(1)

        self.sb = gpi.BasicSpinBox()  # length
        self.sb.set_label('length:')
        self.sb.set_min(1)
        self.sb.set_val(1)
        self.sb.set_max(gpi.GPI_INT_MAX)

        self.db.valueChanged.connect(self.factChange)
        self.sb.valueChanged.connect(self.lenChange)
        self.pb.valueChanged.connect(self.compChange)

        vbox = QtWidgets.QHBoxLayout()
        vbox.addWidget(self.pb)
        vbox.addWidget(self.db)
        vbox.addWidget(self.sb)
        vbox.setStretch(0, 0)
        vbox.setStretch(1, 0)
        vbox.setStretch(2, 0)
        vbox.setContentsMargins(0, 0, 0, 0)  # we don't need margins here
        vbox.setSpacing(0)
        self.setLayout(vbox)