@@ -45,17 +45,18 @@ def figure_edit(axes, parent=None):
45
45
sep = (None , None ) # separator
46
46
47
47
# Get / General
48
- xmin , xmax = map (float , axes .get_xlim ())
49
- ymin , ymax = map (float , axes .get_ylim ())
48
+ # Cast to builtin floats as they have nicer reprs.
49
+ orig_xmin , orig_xmax = map (float , axes .get_xlim ())
50
+ orig_ymin , orig_ymax = map (float , axes .get_ylim ())
50
51
general = [('Title' , axes .get_title ()),
51
52
sep ,
52
53
(None , "<b>X-Axis</b>" ),
53
- ('Min' , xmin ), ('Max' , xmax ),
54
+ ('Min' , orig_xmin ), ('Max' , orig_xmax ),
54
55
('Label' , axes .get_xlabel ()),
55
56
('Scale' , [axes .get_xscale (), 'linear' , 'log' ]),
56
57
sep ,
57
58
(None , "<b>Y-Axis</b>" ),
58
- ('Min' , ymin ), ('Max' , ymax ),
59
+ ('Min' , orig_ymin ), ('Max' , orig_ymax ),
59
60
('Label' , axes .get_ylabel ()),
60
61
('Scale' , [axes .get_yscale (), 'linear' , 'log' ]),
61
62
sep ,
@@ -166,6 +167,9 @@ def prepare_data(d, init):
166
167
167
168
def apply_callback (data ):
168
169
"""This function will be called to apply changes"""
170
+ orig_xlim = axes .get_xlim ()
171
+ orig_ylim = axes .get_ylim ()
172
+
169
173
general = data .pop (0 )
170
174
curves = data .pop (0 ) if has_curve else []
171
175
images = data .pop (0 ) if has_image else []
@@ -234,7 +238,8 @@ def apply_callback(data):
234
238
# Redraw
235
239
figure = axes .get_figure ()
236
240
figure .canvas .draw ()
237
- figure .canvas .toolbar .push_current ()
241
+ if not (axes .get_xlim () == orig_xlim and axes .get_ylim () == orig_ylim ):
242
+ figure .canvas .toolbar .push_current ()
238
243
239
244
data = formlayout .fedit (datalist , title = "Figure options" , parent = parent ,
240
245
icon = get_icon ('qt4_editor_options.svg' ),
0 commit comments