/usr/lib/python2.7/dist-packages/ginga/cvw/ImageViewCanvasCv.py is in python-ginga 2.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #
# ImageViewCanvasCv.py -- A FITS image widget with canvas drawing in OpenCv
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from ginga.cvw import ImageViewCv
from ginga.canvas.mixins import DrawingMixin, CanvasMixin, CompoundMixin
class ImageViewCanvasError(ImageViewCv.ImageViewCvError):
pass
class ImageViewCanvas(ImageViewCv.ImageViewCv,
DrawingMixin, CanvasMixin, CompoundMixin):
def __init__(self, logger=None, rgbmap=None, settings=None,
bindmap=None, bindings=None):
ImageViewCv.ImageViewCv.__init__(self, logger=logger,
rgbmap=rgbmap,
settings=settings)
CompoundMixin.__init__(self)
CanvasMixin.__init__(self)
DrawingMixin.__init__(self)
# we are both a viewer and a canvas
self.set_canvas(self, private_canvas=self)
# override
self.defer_redraw = False
# subclass needs to implement these to avoid warning messages
def reschedule_redraw(self, time_sec):
pass
def update_image(self):
pass
# METHODS THAT WERE IN IPG
def add_canvas(self, tag=None):
# add a canvas to the view
DrawingCanvas = self.getDrawClass('drawingcanvas')
canvas = DrawingCanvas()
# enable drawing on the canvas
canvas.enable_draw(True)
canvas.ui_setActive(True)
canvas.setSurface(self)
# add the canvas to the view.
self.add(canvas, tag=tag)
return canvas
def show(self):
from IPython.display import Image
return Image(data=bytes(self.get_rgb_image_as_bytes(format='png')),
format='png', embed=True)
#END
|