Ejemplo n.º 1
0
    def __init__(self, parent, data_accessor):
        super(__SampleStepWidget__, self).__init__(parent,
                                            layout=QVBoxLayout())

        self.data_accessor = data_accessor

        info_group = CompositeWidget(self, layout=QHBoxLayout())
        LabelWidget(info_group, i18n_def='Sample step:')
        self.__step_value__ = LabelWidget(info_group, i18n_def='<value>')
        self.__unit_value__ = LabelWidget(info_group, i18n_def='')

        self.__step_slider__ = SliderWidget(self, orientation=Qt.Horizontal,
                        sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding,
                                               QSizePolicy.Fixed),
                        value_changed_handler=self.__value_changed__)
        self.__step_slider__.setTickPosition(QSlider.TicksBelow)
        self.setValueInSignalUnit()
        self.setUnit()
Ejemplo n.º 2
0
    def __init__(self, parent, data_accessor):
        super(__StepperSizeWidget__, self).__init__(parent,
                                            layout=QVBoxLayout())

        self.data_accessor = data_accessor

        info_group = CompositeWidget(self, layout=QHBoxLayout())
        LabelWidget(info_group, i18n_def='Stepper size:')
        self.__size_value__ = LabelWidget(info_group, i18n_def='<value>')
        self.__unit_value__ = LabelWidget(info_group, i18n_def='')

        self.__size_slider__ = SliderWidget(self, orientation=Qt.Horizontal,
                        sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding,
                                               QSizePolicy.Fixed),
                        value_changed_handler=self.__value_changed__)
        self.__size_slider__.setTickPosition(QSlider.TicksBelow)
        self.setValueInUnit(self.data_accessor.signal_x_unit)
        self.setUnit(self.data_accessor.signal_x_unit)

        self.__unitsWidget__ = TimeUnitsWidget(self, i18n_def='Units',
                        default_unit=self.data_accessor.signal_x_unit,
                        change_unit_handler=self.changeUnit,
                        layout=QHBoxLayout())
        self.__unitsWidget__.addUnit(OrderUnit)
Ejemplo n.º 3
0
class __StepperSizeWidget__(CompositeWidget):
    """
    widget used to change stepper size
    """
    def __init__(self, parent, data_accessor):
        super(__StepperSizeWidget__, self).__init__(parent,
                                            layout=QVBoxLayout())

        self.data_accessor = data_accessor

        info_group = CompositeWidget(self, layout=QHBoxLayout())
        LabelWidget(info_group, i18n_def='Stepper size:')
        self.__size_value__ = LabelWidget(info_group, i18n_def='<value>')
        self.__unit_value__ = LabelWidget(info_group, i18n_def='')

        self.__size_slider__ = SliderWidget(self, orientation=Qt.Horizontal,
                        sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding,
                                               QSizePolicy.Fixed),
                        value_changed_handler=self.__value_changed__)
        self.__size_slider__.setTickPosition(QSlider.TicksBelow)
        self.setValueInUnit(self.data_accessor.signal_x_unit)
        self.setUnit(self.data_accessor.signal_x_unit)

        self.__unitsWidget__ = TimeUnitsWidget(self, i18n_def='Units',
                        default_unit=self.data_accessor.signal_x_unit,
                        change_unit_handler=self.changeUnit,
                        layout=QHBoxLayout())
        self.__unitsWidget__.addUnit(OrderUnit)

    def __value_changed__(self, _value):
        self.__size_value__.setText(str(_value))

    def setValueInUnit(self, _unit):
        signal = self.data_accessor.signal_in_unit(_unit)
        self.__size_slider__.setMaximum(int(pl.amax(signal)))
        self.__size_slider__.setValue(0)
        self.__size_slider__.setTickInterval(self.__size_slider__.maximum() / 10)  # @IgnorePep8

    def setUnit(self, _unit):
        self.__unit_value__.setText(_unit.name)

    @property
    def size(self):
        value = self.__size_slider__.value()
        return None if value == 0 else value

    def setSize(self, _size):
        self.__size_slider__.setValue(int(_size))

    def changeUnit(self, _unit):
        if not _unit == None:
            self.setValueInUnit(_unit)
            self.setUnit(_unit)
            self.__unitsWidget__.setUnit(_unit)

    @property
    def unit(self):
        return self.__unitsWidget__.getUnit()
Ejemplo n.º 4
0
class __SampleStepWidget__(CompositeWidget):
    """
    widget used to change sample step value
    """
    def __init__(self, parent, data_accessor):
        super(__SampleStepWidget__, self).__init__(parent,
                                            layout=QVBoxLayout())

        self.data_accessor = data_accessor

        info_group = CompositeWidget(self, layout=QHBoxLayout())
        LabelWidget(info_group, i18n_def='Sample step:')
        self.__step_value__ = LabelWidget(info_group, i18n_def='<value>')
        self.__unit_value__ = LabelWidget(info_group, i18n_def='')

        self.__step_slider__ = SliderWidget(self, orientation=Qt.Horizontal,
                        sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding,
                                               QSizePolicy.Fixed),
                        value_changed_handler=self.__value_changed__)
        self.__step_slider__.setTickPosition(QSlider.TicksBelow)
        self.setValueInSignalUnit()
        self.setUnit()

    def __value_changed__(self, _value):
        self.__step_value__.setText(str(_value))

    def setValueInSignalUnit(self):
        signal = self.data_accessor.signal
        self.__step_slider__.setMaximum(int(pl.amax(signal)))
        self.__step_slider__.setValue(0)
        self.__step_slider__.setTickInterval(self.__step_slider__.maximum() / 10)  # @IgnorePep8

    def setUnit(self):
        self.__unit_value__.setText(
                            self.data_accessor.signal_unit.display_label)

    @property
    def step(self):
        value = self.__step_slider__.value()
        return None if value == 0 else value

    def setStep(self, _step):
        self.__step_slider__.setValue(_step)
Ejemplo n.º 5
0
class __DataWindowSizeWidget__(CompositeWidget):
    """
    widget used to change data window size
    """
    def __init__(self, parent, data_accessor):
        super(__DataWindowSizeWidget__, self).__init__(parent,
                                            layout=QVBoxLayout())

        self.data_accessor = data_accessor

        info_group = CompositeWidget(self, layout=QHBoxLayout())
        LabelWidget(info_group, i18n_def='Data window size:')
        self.__size_value__ = LabelWidget(info_group, i18n_def='<value>')
        self.__unit_value__ = LabelWidget(info_group, i18n_def='')

        self.__size_slider__ = SliderWidget(self, orientation=Qt.Horizontal,
                        sizePolicy=QSizePolicy(QSizePolicy.MinimumExpanding,
                                               QSizePolicy.Fixed),
                        value_changed_handler=self.__value_changed__)
        self.__size_slider__.setTickPosition(QSlider.TicksBelow)
        self.setValueInUnit(self.data_accessor.signal_x_unit)
        self.setUnit(self.data_accessor.signal_x_unit)

    def __value_changed__(self, _value):
        self.__size_value__.setText(str(_value))

    def setValueInUnit(self, _unit):
        signal = self.data_accessor.signal_in_unit(_unit)
        self.__size_slider__.setMaximum(int(pl.amax(signal)))
        self.__size_slider__.setValue(0)
        self.__size_slider__.setTickInterval(self.__size_slider__.maximum() / 10)  # @IgnorePep8

    def setUnit(self, _unit):
        self.__unit_value__.setText(_unit.name)

    @property
    def size(self):
        return self.__size_slider__.value()

    def setSize(self, _size):
        self.__size_slider__.setValue(int(_size))