コード例 #1
0
    def _mouse_modes(self):

        axes = self.client.axes

        def apply_mode(mode):
            for roi_mode in roi_modes:
                if roi_mode != mode:
                    roi_mode._roi_tool.reset()
            self.apply_roi(mode.roi())

        rect = RectangleMode(axes, roi_callback=apply_mode)
        circ = CircleMode(axes, roi_callback=apply_mode)
        poly = PolyMode(axes, roi_callback=apply_mode)
        roi_modes = [rect, circ, poly]

        contrast = ContrastMode(axes, move_callback=self._set_norm)

        self._contrast = contrast

        # Get modes from tools
        tool_modes = []
        for tool in self._tools:
            tool_modes += tool._get_modes(axes)
            add_callback(self.client, 'display_data', tool._display_data_hook)

        return [rect, circ, poly, contrast] + tool_modes
コード例 #2
0
ファイル: custom_viewer.py プロジェクト: robintw/glue
    def _mouse_modes(self):
        if not self._coordinator.selections_enabled:
            return []

        axes = self.client.axes

        def apply_mode(mode):
            self.client.apply_roi(mode.roi())

        # return []
        return [RectangleMode(axes, roi_callback=apply_mode),
                PolyMode(axes, roi_callback=apply_mode)]
コード例 #3
0
    def _mouse_modes(self):
        axes = self.client.axes

        def apply_mode(mode):
            return self.apply_roi(mode.roi())

        rect = RectangleMode(axes, roi_callback=apply_mode)
        xra = HRangeMode(axes, roi_callback=apply_mode)
        yra = VRangeMode(axes, roi_callback=apply_mode)
        circ = CircleMode(axes, roi_callback=apply_mode)
        poly = PolyMode(axes, roi_callback=apply_mode)
        return [rect, xra, yra, circ, poly]