def _apply(self, configuration): if self.map_name not in configuration.map_plot_options: configuration.map_plot_options[self.map_name] = SingleMapConfig() single_map_config = super()._apply( configuration.map_plot_options[self.map_name]) if single_map_config is None: del configuration.map_plot_options[self.map_name] return configuration
def _apply(self, data_info, configuration): if self.map_name not in configuration.map_plot_options: configuration.map_plot_options[self.map_name] = SingleMapConfig() single_map_config = super(SimpleMapSpecificConfigAction, self)._apply( data_info, configuration.map_plot_options[self.map_name]) if single_map_config is None: del configuration.map_plot_options[self.map_name] return configuration
def _extra_actions(self, configuration): single_map_config = super()._extra_actions(configuration) if single_map_config == SingleMapConfig(): return None return single_map_config
def _get_current_map_config(self): current_model = self._controller.get_model() current_config = current_model.get_config() current_map_config = current_config.map_plot_options.get( self._current_map, SingleMapConfig()) return current_map_config
def use(self, map_name): """Load the settings of the given map""" self._current_map = map_name current_model = self._controller.get_model() try: map_info = current_model.get_config().map_plot_options[map_name] except KeyError: map_info = SingleMapConfig() data_info = current_model.get_data() vmin, vmax = data_info.get_single_map_info(map_name).min_max( mask=self._get_mask(data_info, map_name)) with blocked_signals(self.map_title): self.map_title.document().setPlainText( map_info.title if map_info.title else '') with blocked_signals(self.data_colorbar_label): self.data_colorbar_label.document().setPlainText( map_info.colorbar_label if map_info.colorbar_label else '') with blocked_signals(self.colormap): if map_info.colormap is None: self.colormap.setCurrentIndex(0) else: self.colormap.setCurrentText(map_info.colormap) with blocked_signals(self.data_clipping_min): self.data_clipping_min.setValue(map_info.clipping.vmin) with blocked_signals(self.data_clipping_max): self.data_clipping_max.setValue(map_info.clipping.vmax) with blocked_signals(self.data_scale_min): self.data_scale_min.setValue(map_info.scale.vmin) with blocked_signals(self.data_scale_max): self.data_scale_max.setValue(map_info.scale.vmax) with blocked_signals(self.data_set_use_scale): self.data_set_use_scale.setChecked(map_info.scale.use_min or map_info.scale.use_max) with blocked_signals(self.data_set_use_clipping): self.data_set_use_clipping.setChecked(map_info.clipping.use_min or map_info.clipping.use_max) with blocked_signals(self.use_data_clipping_min): self.use_data_clipping_min.setChecked(map_info.clipping.use_min) with blocked_signals(self.use_data_clipping_max): self.use_data_clipping_max.setChecked(map_info.clipping.use_max) with blocked_signals(self.use_data_scale_min): self.use_data_scale_min.setChecked(map_info.scale.use_min) with blocked_signals(self.use_data_scale_max): self.use_data_scale_max.setChecked(map_info.scale.use_max) map_filename = data_info.get_file_path(map_name) if map_filename: self.info_file_location.setText( split_long_path_elements(map_filename, 25)) self.info_minimum.setText(str(vmin)) self.info_maximum.setText(str(vmax)) self.info_has_nan.setText('Yes' if data_info.get_single_map_info( map_name).has_nan() else 'No') self.info_shape.setText( str(data_info.get_single_map_info(map_name).shape))
def _extra_actions(self, configuration): single_map_config = super(SimpleMapSpecificConfigAction, self)._extra_actions(configuration) if single_map_config == SingleMapConfig(): return None return single_map_config
def use(self, map_name): """Load the settings of the given map""" self._current_map = map_name try: map_info = self._controller.get_config().map_plot_options[map_name] except KeyError: map_info = SingleMapConfig() data_info = self._controller.get_data() vmin = data_info.maps[map_name].min() vmax = data_info.maps[map_name].max() with blocked_signals(self.map_title): self.map_title.setText(map_info.title if map_info.title else '') with blocked_signals(self.data_colorbar_label): self.data_colorbar_label.setText( map_info.colorbar_label if map_info.colorbar_label else '') with blocked_signals(self.colormap): if map_info.colormap is None: self.colormap.setCurrentIndex(0) else: self.colormap.setCurrentText(map_info.colormap) with blocked_signals(self.data_clipping_min): self.data_clipping_min.setValue(map_info.clipping.vmin) with blocked_signals(self.data_clipping_max): self.data_clipping_max.setValue(map_info.clipping.vmax) with blocked_signals(self.data_scale_min): self.data_scale_min.setValue(map_info.scale.vmin) with blocked_signals(self.data_scale_max): self.data_scale_max.setValue(map_info.scale.vmax) with blocked_signals(self.data_set_use_scale): self.data_set_use_scale.setChecked(map_info.scale.use_min or map_info.scale.use_max) with blocked_signals(self.data_set_use_clipping): self.data_set_use_clipping.setChecked(map_info.clipping.use_min or map_info.clipping.use_max) with blocked_signals(self.use_data_clipping_min): self.use_data_clipping_min.setChecked(map_info.clipping.use_min) with blocked_signals(self.use_data_clipping_max): self.use_data_clipping_max.setChecked(map_info.clipping.use_max) with blocked_signals(self.use_data_scale_min): self.use_data_scale_min.setChecked(map_info.scale.use_min) with blocked_signals(self.use_data_scale_max): self.use_data_scale_max.setChecked(map_info.scale.use_max) map_filename = data_info.get_file_name(map_name) if map_filename: self.info_file_location.setText(map_filename) self.info_maximum.setText(str(vmax)) self.info_minimum.setText(str(vmin)) self.info_shape.setText(str(data_info.maps[map_name].shape))