1from fsui.qt.helpers import QParent
2from fsui.qt.qt import QLabel
3from fsui.qt.widget import Widget
4
5
6class ImageView(Widget):
7    def __init__(self, parent, image, stretch=False):
8        super().__init__(parent)
9        self.set_widget(QLabel(QParent(parent)))
10        self._widget.setPixmap(image.qpixmap)
11        if stretch:
12            self._widget.setScaledContents(True)
13
14    def set_image(self, image):
15        self._widget.setPixmap(image.qpixmap)
16