Example #1
0
    def apply_properties(self):
        props = self.view.get_properties()
        # if only one colorbar apply settings to all images
        if len(get_colorbars_from_fig(self.fig)) == 1:
            # flatten the values into one list
            images = sum(self.image_names_dict.values(), [])
        else:
            images = self.get_selected_image()

        for image in images:
            if image.colorbar:
                image.colorbar.set_label(props.label)

            image.set_cmap(props.colormap)
            if props.interpolation and not (isinstance(
                    image, QuadMesh) or isinstance(image, Poly3DCollection)):
                image.set_interpolation(props.interpolation)

            update_colorbar_scale(self.fig, image, SCALES[props.scale],
                                  props.vmin, props.vmax)

        if props.vmin > props.vmax:
            self.view.max_min_value_warning.setVisible(True)
            self.view.max_min_value_warning.setText(
                "<html> <head/> <body> <p> <span style=\"color:#ff0000;\">Max "
                "value is less than min value so they have been "
                "swapped.</span></p></body></html>")
        elif props.vmin == props.vmax:
            self.view.max_min_value_warning.setVisible(True)
            self.view.max_min_value_warning.setText(
                "<html><head/><body><p><span style=\"color:#ff0000;\">Min and max "
                "value are the same so they have been "
                "adjusted.</span></p></body></html>")
        else:
            self.view.max_min_value_warning.setVisible(False)
Example #2
0
 def update_view(self):
     img_props = ImageProperties.from_image(self.get_selected_image())
     self.view.label_line_edit.setEnabled(bool(get_colorbars_from_fig(self.fig)))
     self.view.set_label(img_props.label)
     self.view.set_colormap(img_props.colormap)
     self.view.set_reverse_colormap(img_props.reverse_colormap)
     self.view.set_min_value(img_props.vmin)
     self.view.set_max_value(img_props.vmax)
     if img_props.interpolation:
         self.view.enable_interpolation(True)
         self.view.set_interpolation(img_props.interpolation)
     else:
         self.view.set_interpolation('None')
         self.view.enable_interpolation(False)
     self.view.set_scale(img_props.scale)