def __init__(self, name, initial): super(PlotConfigHistory, self).__init__() self._name = name self._initial = PlotConfig.createCopy(initial) self._undo_history = [] self._redo_history = [] self._current = PlotConfig.createCopy(self._initial)
def applyChanges(self, plot_config): """@type plot_config: PlotConfig""" self._undo_history.append(self._current) copy = PlotConfig.createCopy(self._current) copy.copyConfigFrom(plot_config) self._current = copy del self._redo_history[:]
def createPlotContext(self, figure): key = self.getSelectedKey() cases = self._case_selection_widget.getPlotCaseNames() data_gatherer = self.getDataGathererForKey(key) plot_config = PlotConfig.createCopy(self._plot_customizer.getPlotConfig()) plot_config.setTitle(key) return PlotContext(self._ert, figure, plot_config, cases, key, data_gatherer)
def applyChanges(self, plot_config): """ @type plot_config: PlotConfig """ self._undo_history.append(self._current) copy = PlotConfig.createCopy(self._current) copy.copyConfigFrom(plot_config) self._current = copy del self._redo_history[:]
def currentPlotChanged(self): key_def = self.getSelectedKey() key = key_def["key"] for plot_widget in self._plot_widgets: index = self._central_tab.indexOf(plot_widget) if index == self._central_tab.currentIndex() \ and plot_widget._plotter.dimensionality == key_def["dimensionality"]: self._updateCustomizer(plot_widget) cases = self._case_selection_widget.getPlotCaseNames() case_to_data_map = {case: self._api.data_for_key(case, key)[key] for case in cases} if len(key_def["observations"]) > 0: observations = self._api.observations_for_obs_keys(cases[0], key_def["observations"]) else: observations = None plot_config = PlotConfig.createCopy(self._plot_customizer.getPlotConfig()) plot_config.setTitle(key) plot_context = PlotContext(plot_config, cases, key) if key_def["has_refcase"]: plot_context.refcase_data = self._api.refcase_data(key) plot_widget.updatePlot(plot_context, case_to_data_map, observations)
def getPlotConfig(self): """@rtype: PlotConfig""" return PlotConfig.createCopy(self._current)
def getPlotConfig(self): """ @rtype: PlotConfig """ return PlotConfig.createCopy(self._current)