Esempio n. 1
0
    def __init__(self):
        self._limits = PlotLimits()
        self._x_minimum_stack = LimitsStack()
        self._x_maximum_stack = LimitsStack()
        self._x_current_input_name = PlotContext.UNKNOWN_AXIS

        self._y_minimum_stack = LimitsStack()
        self._y_maximum_stack = LimitsStack()
        self._y_current_input_name = PlotContext.UNKNOWN_AXIS
Esempio n. 2
0
    def __init__(self):
        self._limits = PlotLimits()
        self._x_minimum_stack = LimitsStack()
        self._x_maximum_stack = LimitsStack()
        self._x_current_input_name = PlotContext.UNKNOWN_AXIS

        self._y_minimum_stack = LimitsStack()
        self._y_maximum_stack = LimitsStack()
        self._y_current_input_name = PlotContext.UNKNOWN_AXIS
Esempio n. 3
0
 def limits(self):
     """ @rtype: PlotLimits """
     self._updateLimits()
     limits = PlotLimits()
     limits.copyLimitsFrom(self._limits)
     return limits
Esempio n. 4
0
class LimitsWidget(object):
    def __init__(self):
        self._limits = PlotLimits()
        self._x_minimum_stack = LimitsStack()
        self._x_maximum_stack = LimitsStack()
        self._x_current_input_name = PlotContext.UNKNOWN_AXIS

        self._y_minimum_stack = LimitsStack()
        self._y_maximum_stack = LimitsStack()
        self._y_current_input_name = PlotContext.UNKNOWN_AXIS

    @property
    def x_minimum_stack(self):
        """ @rtype: LimitsStack """
        return self._x_minimum_stack

    @property
    def x_maximum_stack(self):
        """ @rtype: LimitsStack """
        return self._x_maximum_stack

    @property
    def y_minimum_stack(self):
        """ @rtype: LimitsStack """
        return self._y_minimum_stack

    @property
    def y_maximum_stack(self):
        """ @rtype: LimitsStack """
        return self._y_maximum_stack

    @property
    def limits(self):
        """ @rtype: PlotLimits """
        self._updateLimits()
        limits = PlotLimits()
        limits.copyLimitsFrom(self._limits)
        return limits

    @limits.setter
    def limits(self, value):
        """ @type value: PlotLimits """
        self._limits.copyLimitsFrom(value)
        self._updateWidgets()

    def _updateWidgets(self):
        limits = self._limits
        self._x_minimum_stack.setValue(PlotContext.DATE_AXIS,
                                       limits.date_minimum)
        self._x_maximum_stack.setValue(PlotContext.DATE_AXIS,
                                       limits.date_maximum)
        self._y_minimum_stack.setValue(PlotContext.DATE_AXIS,
                                       limits.date_minimum)
        self._y_maximum_stack.setValue(PlotContext.DATE_AXIS,
                                       limits.date_maximum)

        self._x_minimum_stack.setValue(PlotContext.DEPTH_AXIS,
                                       limits.depth_minimum)
        self._x_maximum_stack.setValue(PlotContext.DEPTH_AXIS,
                                       limits.depth_maximum)
        self._y_minimum_stack.setValue(PlotContext.DEPTH_AXIS,
                                       limits.depth_minimum)
        self._y_maximum_stack.setValue(PlotContext.DEPTH_AXIS,
                                       limits.depth_maximum)

        self._x_minimum_stack.setValue(PlotContext.DENSITY_AXIS,
                                       limits.density_minimum)
        self._x_maximum_stack.setValue(PlotContext.DENSITY_AXIS,
                                       limits.density_maximum)
        self._y_minimum_stack.setValue(PlotContext.DENSITY_AXIS,
                                       limits.density_minimum)
        self._y_maximum_stack.setValue(PlotContext.DENSITY_AXIS,
                                       limits.density_maximum)

        self._x_minimum_stack.setValue(PlotContext.COUNT_AXIS,
                                       limits.count_minimum)
        self._x_maximum_stack.setValue(PlotContext.COUNT_AXIS,
                                       limits.count_maximum)
        self._y_minimum_stack.setValue(PlotContext.COUNT_AXIS,
                                       limits.count_minimum)
        self._y_maximum_stack.setValue(PlotContext.COUNT_AXIS,
                                       limits.count_maximum)

        self._x_minimum_stack.setValue(PlotContext.INDEX_AXIS,
                                       limits.index_minimum)
        self._x_maximum_stack.setValue(PlotContext.INDEX_AXIS,
                                       limits.index_maximum)
        self._y_minimum_stack.setValue(PlotContext.INDEX_AXIS,
                                       limits.index_minimum)
        self._y_maximum_stack.setValue(PlotContext.INDEX_AXIS,
                                       limits.index_maximum)

        self._x_minimum_stack.setValue(PlotContext.VALUE_AXIS,
                                       limits.value_minimum)
        self._x_maximum_stack.setValue(PlotContext.VALUE_AXIS,
                                       limits.value_maximum)
        self._y_minimum_stack.setValue(PlotContext.VALUE_AXIS,
                                       limits.value_minimum)
        self._y_maximum_stack.setValue(PlotContext.VALUE_AXIS,
                                       limits.value_maximum)

    def _updateLimits(self):
        if self._x_current_input_name is not PlotContext.UNKNOWN_AXIS:
            minimum = self._x_minimum_stack.getValue(
                self._x_current_input_name)
            maximum = self._x_maximum_stack.getValue(
                self._x_current_input_name)
            self._updateLimit(self._x_current_input_name, minimum, maximum)

        if self._y_current_input_name is not PlotContext.UNKNOWN_AXIS:
            minimum = self._y_minimum_stack.getValue(
                self._y_current_input_name)
            maximum = self._y_maximum_stack.getValue(
                self._y_current_input_name)
            self._updateLimit(self._y_current_input_name, minimum, maximum)

    def _updateLimit(self, axis_name, minimum, maximum):
        if axis_name == PlotContext.COUNT_AXIS:
            self._limits.count_limits = minimum, maximum
        elif axis_name == PlotContext.DENSITY_AXIS:
            self._limits.density_limits = minimum, maximum
        elif axis_name == PlotContext.DEPTH_AXIS:
            self._limits.depth_limits = minimum, maximum
        elif axis_name == PlotContext.DATE_AXIS:
            self._limits.date_limits = minimum, maximum
        elif axis_name == PlotContext.INDEX_AXIS:
            self._limits.index_limits = minimum, maximum
        elif axis_name == PlotContext.VALUE_AXIS:
            self._limits.value_limits = minimum, maximum

    def switchInputOnX(self, axis_type):
        self._x_current_input_name = axis_type
        self._updateWidgets()
        self._x_minimum_stack.switchToInput(axis_type)
        self._x_maximum_stack.switchToInput(axis_type)

    def switchInputOnY(self, axis_type):
        self._y_current_input_name = axis_type
        self._updateWidgets()
        self._y_minimum_stack.switchToInput(axis_type)
        self._y_maximum_stack.switchToInput(axis_type)
Esempio n. 5
0
 def limits(self):
     """ @rtype: PlotLimits """
     self._updateLimits()
     limits = PlotLimits()
     limits.copyLimitsFrom(self._limits)
     return limits
Esempio n. 6
0
class LimitsWidget(object):
    def __init__(self):
        self._limits = PlotLimits()
        self._x_minimum_stack = LimitsStack()
        self._x_maximum_stack = LimitsStack()
        self._x_current_input_name = PlotContext.UNKNOWN_AXIS

        self._y_minimum_stack = LimitsStack()
        self._y_maximum_stack = LimitsStack()
        self._y_current_input_name = PlotContext.UNKNOWN_AXIS


    @property
    def x_minimum_stack(self):
        """ @rtype: LimitsStack """
        return self._x_minimum_stack

    @property
    def x_maximum_stack(self):
        """ @rtype: LimitsStack """
        return self._x_maximum_stack

    @property
    def y_minimum_stack(self):
        """ @rtype: LimitsStack """
        return self._y_minimum_stack

    @property
    def y_maximum_stack(self):
        """ @rtype: LimitsStack """
        return self._y_maximum_stack

    @property
    def limits(self):
        """ @rtype: PlotLimits """
        self._updateLimits()
        limits = PlotLimits()
        limits.copyLimitsFrom(self._limits)
        return limits

    @limits.setter
    def limits(self, value):
        """ @type value: PlotLimits """
        self._limits.copyLimitsFrom(value)
        self._updateWidgets()

    def _updateWidgets(self):
        limits = self._limits
        self._x_minimum_stack.setValue(PlotContext.DATE_AXIS, limits.date_minimum)
        self._x_maximum_stack.setValue(PlotContext.DATE_AXIS, limits.date_maximum)
        self._y_minimum_stack.setValue(PlotContext.DATE_AXIS, limits.date_minimum)
        self._y_maximum_stack.setValue(PlotContext.DATE_AXIS, limits.date_maximum)

        self._x_minimum_stack.setValue(PlotContext.DEPTH_AXIS, limits.depth_minimum)
        self._x_maximum_stack.setValue(PlotContext.DEPTH_AXIS, limits.depth_maximum)
        self._y_minimum_stack.setValue(PlotContext.DEPTH_AXIS, limits.depth_minimum)
        self._y_maximum_stack.setValue(PlotContext.DEPTH_AXIS, limits.depth_maximum)

        self._x_minimum_stack.setValue(PlotContext.DENSITY_AXIS, limits.density_minimum)
        self._x_maximum_stack.setValue(PlotContext.DENSITY_AXIS, limits.density_maximum)
        self._y_minimum_stack.setValue(PlotContext.DENSITY_AXIS, limits.density_minimum)
        self._y_maximum_stack.setValue(PlotContext.DENSITY_AXIS, limits.density_maximum)

        self._x_minimum_stack.setValue(PlotContext.COUNT_AXIS, limits.count_minimum)
        self._x_maximum_stack.setValue(PlotContext.COUNT_AXIS, limits.count_maximum)
        self._y_minimum_stack.setValue(PlotContext.COUNT_AXIS, limits.count_minimum)
        self._y_maximum_stack.setValue(PlotContext.COUNT_AXIS, limits.count_maximum)

        self._x_minimum_stack.setValue(PlotContext.INDEX_AXIS, limits.index_minimum)
        self._x_maximum_stack.setValue(PlotContext.INDEX_AXIS, limits.index_maximum)
        self._y_minimum_stack.setValue(PlotContext.INDEX_AXIS, limits.index_minimum)
        self._y_maximum_stack.setValue(PlotContext.INDEX_AXIS, limits.index_maximum)

        self._x_minimum_stack.setValue(PlotContext.VALUE_AXIS, limits.value_minimum)
        self._x_maximum_stack.setValue(PlotContext.VALUE_AXIS, limits.value_maximum)
        self._y_minimum_stack.setValue(PlotContext.VALUE_AXIS, limits.value_minimum)
        self._y_maximum_stack.setValue(PlotContext.VALUE_AXIS, limits.value_maximum)


    def _updateLimits(self):
        if self._x_current_input_name is not PlotContext.UNKNOWN_AXIS:
            minimum = self._x_minimum_stack.getValue(self._x_current_input_name)
            maximum = self._x_maximum_stack.getValue(self._x_current_input_name)
            self._updateLimit(self._x_current_input_name, minimum, maximum)

        if self._y_current_input_name is not PlotContext.UNKNOWN_AXIS:
            minimum = self._y_minimum_stack.getValue(self._y_current_input_name)
            maximum = self._y_maximum_stack.getValue(self._y_current_input_name)
            self._updateLimit(self._y_current_input_name, minimum, maximum)


    def _updateLimit(self, axis_name, minimum, maximum):
        if axis_name == PlotContext.COUNT_AXIS:
            self._limits.count_limits = minimum, maximum
        elif axis_name == PlotContext.DENSITY_AXIS:
            self._limits.density_limits = minimum, maximum
        elif axis_name == PlotContext.DEPTH_AXIS:
            self._limits.depth_limits = minimum, maximum
        elif axis_name == PlotContext.DATE_AXIS:
            self._limits.date_limits = minimum, maximum
        elif axis_name == PlotContext.INDEX_AXIS:
            self._limits.index_limits = minimum, maximum
        elif axis_name == PlotContext.VALUE_AXIS:
            self._limits.value_limits = minimum, maximum


    def switchInputOnX(self, axis_type):
        self._x_current_input_name = axis_type
        self._updateWidgets()
        self._x_minimum_stack.switchToInput(axis_type)
        self._x_maximum_stack.switchToInput(axis_type)


    def switchInputOnY(self, axis_type):
        self._y_current_input_name = axis_type
        self._updateWidgets()
        self._y_minimum_stack.switchToInput(axis_type)
        self._y_maximum_stack.switchToInput(axis_type)