def update_editor(self): """ Updates the editor when the object trait changes externally to the editor. """ if self.factory.image is None: value = self.value if isinstance(value, ImageResource): self.control.setPixmap(convert_bitmap(value)) self.control.setScaledContents(self.factory.scale) self.control.setAllowUpscaling(self.factory.allow_upscaling) self.control.setPreserveAspectRatio(self.factory.preserve_aspect_ratio) self.control.setAllowClipping(self.factory.allow_clipping)
def init(self, parent): """ Finishes initializing the editor by creating the underlying toolkit widget. """ image = self.factory.image if image is None: image = self.value self.control = QImageView() self.control.setPixmap(convert_bitmap(image)) self.control.setScaledContents(self.factory.scale) self.control.setAllowUpscaling(self.factory.allow_upscaling) self.control.setPreserveAspectRatio(self.factory.preserve_aspect_ratio) self.control.setAllowClipping(self.factory.allow_clipping) self.set_tooltip()