5151from ert .services import ServerBootFail
5252from ert .utils import log_duration
5353
54- from .customization_dialog import PlotCustomizer
5554from .plot_api import EnsembleObject , PlotApi , PlotApiKeyDefinition
56- from .utils import PlotConfig , PlotContext
55+ from .utils import PlotConfigFactory , PlotContext
5756from .utils .observation_locations import transform_observation_locations
57+ from .utils .plot_color_palettes import TABLEAU_10_COLOR_CYCLE
5858from .utils .plot_types import ObservationPlotLocations
5959from .utils .qt_creator import create_group_box , create_group_layout , create_side_panel
6060from .widgets .data_type_keys_widget import DataTypeKeysWidget
@@ -206,8 +206,9 @@ def __init__(
206206 self ._key_definitions = []
207207 QApplication .restoreOverrideCursor ()
208208
209- self ._plot_customizer = PlotCustomizer (self , self ._key_definitions )
210- self ._plot_customizer .settingsChanged .connect (self .keySelected )
209+ self ._titles : dict [str , str ] = {}
210+ self ._x_labels : dict [str , str | None ] = {}
211+ self ._y_labels : dict [str , str | None ] = {}
211212 self ._central_tab = QTabWidget ()
212213
213214 central_widget = QWidget ()
@@ -266,7 +267,7 @@ def __init__(
266267
267268 self ._ensemble_selection_widget = EnsembleSelectionWidget (
268269 plot_case_objects ,
269- self . _plot_customizer . get_plot_config (). get_number_of_colors ( ),
270+ len ( TABLEAU_10_COLOR_CYCLE ),
270271 )
271272
272273 self ._ensemble_selection_widget .ensembleSelectionChanged .connect (
@@ -543,9 +544,10 @@ def fetch_data(
543544 except BaseException as e :
544545 handle_exception (e )
545546
546- plot_config = PlotConfig .create_copy (
547- self ._plot_customizer .get_plot_config ()
548- )
547+ plot_config = PlotConfigFactory .create_plot_config_for_key (key_def )
548+ plot_config .set_title (self ._titles .get (key , key ))
549+ plot_config .set_x_label (self ._x_labels .get (key ))
550+ plot_config .set_y_label (self ._y_labels .get (key ))
549551 plot_config .set_legend_enabled (self ._general_options .legend_checkbox_state )
550552 plot_config .set_grid_enabled (self ._general_options .grid_checkbox_state )
551553 plot_config .set_line_color_cycle (self ._general_options .get_color_cycle ())
@@ -656,7 +658,6 @@ def add_plot_widget(
656658 enabled : bool = True ,
657659 ) -> None :
658660 plot_widget = PlotWidget (name , plotter )
659- plot_widget .customizationTriggered .connect (self .toggle_customize_dialog )
660661 plot_widget .axisLabelEditRequested .connect (self ._edit_axis_label )
661662 plot_widget .titleEditRequested .connect (self ._edit_title )
662663 plot_widget .layer_index_changed .connect (self .layer_index_changed )
@@ -669,11 +670,14 @@ def _edit_axis_label(self, axis: str) -> None:
669670 label_names = {"x" : "x-label" , "y" : "y-label" }
670671 if axis not in label_names :
671672 raise ValueError (f"Unknown axis '{ axis } '. Expected 'x' or 'y'." )
673+ key_def = self .getSelectedKey ()
674+ if key_def is None :
675+ return
672676 label_name = label_names [axis ]
673677 title = f"Edit { label_name } "
674678 prompt = f"New { label_name } :"
675- plot_config = self ._plot_customizer . get_plot_config ()
676- current_label = plot_config . x_label () if axis == "x" else plot_config . y_label ( )
679+ labels = self ._x_labels if axis == "x" else self . _y_labels
680+ current_label = labels . get ( key_def . key )
677681 if current_label is None :
678682 current_widget = self ._central_tab .currentWidget ()
679683 if isinstance (current_widget , PlotWidget ) and current_widget ._figure .axes :
@@ -689,38 +693,30 @@ def _edit_axis_label(self, axis: str) -> None:
689693 if not accepted :
690694 return
691695 new_label : str | None = new_label_text or None
692- if axis == "x" :
693- plot_config .set_x_label (new_label )
694- else :
695- plot_config .set_y_label (new_label )
696- self ._plot_customizer .update_plot_config (plot_config )
696+ labels [key_def .key ] = new_label
697+ self .update_plot ()
697698
698699 def _edit_title (self ) -> None :
700+ key_def = self .getSelectedKey ()
701+ if key_def is None :
702+ return
699703 title = "Edit title"
700- plot_config = self ._plot_customizer .get_plot_config ()
701704 new_title , accepted = self ._general_options .get_text_input (
702705 title ,
703706 "New title:" ,
704- plot_config . title ( ),
707+ self . _titles . get ( key_def . key , key_def . key ),
705708 )
706709 if not accepted :
707710 return
708- if new_title :
709- plot_config .set_title (new_title )
710- else :
711- key_def = self .getSelectedKey ()
712- if key_def is None :
713- return
714- plot_config .set_title (key_def .key )
715- self ._plot_customizer .update_plot_config (plot_config )
711+ self ._titles [key_def .key ] = new_title or key_def .key
712+ self .update_plot ()
716713
717714 @showWaitCursorWhileWaiting
718715 def keySelected (self ) -> None :
719716 key_def = self .getSelectedKey ()
720717 if key_def is None :
721718 self ._show_no_data_message ()
722719 return
723- self ._plot_customizer .switch_plot_config_history (key_def )
724720
725721 is_everest_specific_widget = key_def .metadata .get ("data_origin" ) in {
726722 "everest_objectives" ,
@@ -835,9 +831,6 @@ def everest_available_widget_selection(
835831 self ._prev_key_origin = key_def .metadata .get ("data_origin" )
836832 self .update_plot ()
837833
838- def toggle_customize_dialog (self ) -> None :
839- self ._plot_customizer .toggle_customization_dialog ()
840-
841834 def add_plot_widgets_from_plot_map (
842835 self , plot_map : dict [str , Callable [[], Plotter ]]
843836 ) -> None :
0 commit comments