@@ -47,6 +47,7 @@ def figure_edit(axes, parent=None):
47
47
sep = (None , None ) # separator
48
48
49
49
# Get / General
50
+ # Cast to builtin floats as they have nicer reprs.
50
51
xmin , xmax = map (float , axes .get_xlim ())
51
52
ymin , ymax = map (float , axes .get_ylim ())
52
53
general = [('Title' , axes .get_title ()),
@@ -177,6 +178,9 @@ def prepare_data(d, init):
177
178
178
179
def apply_callback (data ):
179
180
"""This function will be called to apply changes"""
181
+ orig_xlim = axes .get_xlim ()
182
+ orig_ylim = axes .get_ylim ()
183
+
180
184
general = data .pop (0 )
181
185
curves = data .pop (0 ) if has_curve else []
182
186
images = data .pop (0 ) if has_image else []
@@ -248,7 +252,8 @@ def apply_callback(data):
248
252
# Redraw
249
253
figure = axes .get_figure ()
250
254
figure .canvas .draw ()
251
- figure .canvas .toolbar .push_current ()
255
+ if not (axes .get_xlim () == orig_xlim and axes .get_ylim () == orig_ylim ):
256
+ figure .canvas .toolbar .push_current ()
252
257
253
258
data = formlayout .fedit (datalist , title = "Figure options" , parent = parent ,
254
259
icon = get_icon ('qt4_editor_options.svg' ),
0 commit comments