@@ -133,6 +133,8 @@ class ColorMapManager(QW.QDialog):
133133 that the colormap cannot be removed.
134134 """
135135
136+ SIG_APPLY_COLORMAP = QC .Signal (str )
137+
136138 def __init__ (
137139 self ,
138140 parent : QW .QWidget | None = None ,
@@ -196,13 +198,16 @@ def __init__(
196198 self ._cmap_choice .currentIndexChanged .connect (self .set_colormap )
197199
198200 self .bbox = QW .QDialogButtonBox (
199- QW .QDialogButtonBox .Save
201+ QW .QDialogButtonBox .Apply
202+ | QW .QDialogButtonBox .Save
200203 | QW .QDialogButtonBox .Ok
201204 | QW .QDialogButtonBox .Cancel
202205 )
203206 self ._changes_saved = True
204207 self ._save_btn = self .bbox .button (QW .QDialogButtonBox .Save )
205208 self ._save_btn .setEnabled (False ) # type: ignore
209+ self ._apply_btn = self .bbox .button (QW .QDialogButtonBox .Apply )
210+ self ._apply_btn .setEnabled (False ) # type: ignore
206211 self .bbox .clicked .connect (self .button_clicked )
207212
208213 dialog_layout = QW .QVBoxLayout ()
@@ -220,7 +225,12 @@ def button_clicked(self, button: QW.QAbstractButton) -> None:
220225 Args:
221226 button: button clicked
222227 """
223- if button is self ._save_btn :
228+ if button is self ._apply_btn :
229+ if not self .current_changes_saved and not self .save_colormap ():
230+ return
231+ self ._apply_btn .setEnabled (False )
232+ self .SIG_APPLY_COLORMAP .emit (self .colormap_editor .get_colormap ().name )
233+ elif button is self ._save_btn :
224234 self .save_colormap ()
225235 elif self .bbox .buttonRole (button ) == QW .QDialogButtonBox .AcceptRole :
226236 self .accept ()
@@ -231,6 +241,7 @@ def _changes_not_saved(self) -> None:
231241 """Callback function to be called when the colormap is modified. Enables the
232242 save button and sets the current_changes_saved attribute to False."""
233243 self ._save_btn .setEnabled (True ) # type: ignore
244+ self ._apply_btn .setEnabled (True ) # type: ignore
234245 self ._changes_saved = False
235246
236247 @property
0 commit comments