Пример #1
0
    def __init__(self, title, parent=None):
        super(FFTW_GROUP, self).__init__(title, parent)

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

        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)

        vbox = QtGui.QHBoxLayout()
        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)
Пример #2
0
    def set_vals(self, inlist):
        while len(inlist) < len(self.boxes):
            oldbox = self.boxes.pop(0)
            self.vbox.removeWidget(oldbox)
            oldbox.deleteLater()
            oldbox.setParent(None)
            oldbox = None

        while len(inlist) > len(self.boxes):
            newbox = gpi.BasicSpinBox()
            self.boxes.insert(0, newbox)
            newbox.valueChanged.connect(self.valueChanged)
            newbox.set_min(1)
            newbox.set_val(1)
            newbox.set_max(gpi.GPI_INT_MAX)
            self.vbox.addWidget(newbox)

        if len(inlist) != len(self.boxes):
            self.log.critical("RESHAPE_GROUP: number of boxes not correct!")

        ind = 0
        for box in self.boxes:
            inval = inlist[ind]
            box.set_val(inval)
            ind = ind + 1
Пример #3
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)
Пример #4
0
    def __init__(self, title, parent=None):
        super().__init__(title, parent)

        self._val = {}
        self._val['action'] = 0
        self._val['dim_position'] = 1  # 0 - first, 1 - middle, 2 - last
        self._val['combine_dir'] = 0
        self._val['split_prod'] = 1
        self._val['split_val1'] = 1
        self._val['split_val2'] = 1

        # create exclusive push buttons to choose action
        self.action = gpi.ExclusivePushButtons('action')
        self.buttons = ['pass', 'combine', 'split']
        self.action.set_buttons(self.buttons)

        # create exclusive push buttons to choose action
        self.combdir = gpi.ExclusivePushButtons('direction')
        self.buttons = [u'\u2B06', u'\u2B07']
        self.combdir.set_buttons(self.buttons)
        self.combdir.set_visible(False)

        # create integer boxes for splitting a value
        self.sb1 = gpi.BasicSpinBox()
        self.sb1.set_min(1)
        self.sb1.set_val(1)
        self.sb1.set_max(gpi.GPI_INT_MAX)
        self.sb2 = gpi.BasicSpinBox()
        self.sb2.set_min(1)
        self.sb2.set_val(1)
        self.sb2.set_max(gpi.GPI_INT_MAX)
        self.set_sb_visible(False)

        self.action.valueChanged.connect(self.actionChange)
        self.combdir.valueChanged.connect(self.combdirChange)
        self.sb1.valueChanged.connect(self.splitChangeLeft)
        self.sb2.valueChanged.connect(self.splitChangeRight)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.action)
        hbox.addWidget(self.combdir)
        hbox.addWidget(self.sb1)
        hbox.addWidget(self.sb2)
        hbox.setSpacing(0)
        self.setLayout(hbox)
Пример #5
0
 def addBox(self):
     newbox = gpi.BasicSpinBox()
     self.boxes.insert(0, newbox)
     newbox.valueChanged.connect(self.valueChanged)
     newbox.set_min(1)
     newbox.set_val(1)
     newbox.set_max(gpi.GPI_INT_MAX)
     self.vbox.addWidget(newbox)
     self.valueChanged.emit()
Пример #6
0
    def __init__(self, title, parent=None):
        super().__init__(title, parent)

        self._val = {}
        self._val['length'] = 1
        self._val['start'] = 0.
        self._val['end'] = 0. # the original array length

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

        self.db1 = gpi.BasicDoubleSpinBox()  # start
        self.db1.set_label('Start:')
        self.db1.set_min(gpi.GPI_FLOAT_MIN)
        self.db1.set_max(gpi.GPI_FLOAT_MAX)
        self.db1.set_decimals(3)
        self.db1.set_singlestep(1.)
        self.db1.set_val(0)

        self.db2 = gpi.BasicDoubleSpinBox()  # end
        self.db2.set_label('End:')
        self.db2.set_min(gpi.GPI_FLOAT_MIN)
        self.db2.set_max(gpi.GPI_FLOAT_MAX)
        self.db2.set_decimals(3)
        self.db2.set_singlestep(1.)
        self.db2.set_val(0)

        self.sb.valueChanged.connect(self.lenChange)
        self.db1.valueChanged.connect(self.startChange)
        self.db2.valueChanged.connect(self.endChange)

        vbox = QtWidgets.QHBoxLayout()
        vbox.addWidget(self.sb)
        vbox.addWidget(self.db1)
        vbox.addWidget(self.db2)
        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)
Пример #7
0
    def __init__(self, title, parent=None):
        super().__init__(title, parent)

        self._val = {}
        self._val['size'] = 1
        self._val['width'] = 1

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

        self.slb = gpi.BasicSlider()  # width
        self.slb.set_min(1)
        self.slb.set_val(1)
        self.slb.set_max(1)

        self.slider_label = QtWidgets.QLabel('width:')

        self.sb.valueChanged.connect(self.sizeChange)
        self.slb.valueChanged.connect(self.widthChange)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.slider_label)
        hbox.addWidget(self.slb)
        hbox.setStretch(0, 0)
        hbox.setSpacing(5)

        hboxGroup = QtWidgets.QHBoxLayout()
        hboxGroup.addWidget(self.sb)
        hboxGroup.addLayout(hbox)
        hboxGroup.setStretch(0, 0)
        hboxGroup.setContentsMargins(0, 0, 0, 0)  # we don't need margins here
        hboxGroup.setSpacing(30)
        self.setLayout(hboxGroup)