8000 Don't push axes state if it wasn't edited. · matplotlib/matplotlib@beb642c · GitHub
[go: up one dir, main page]

Skip to content

Commit beb642c

Browse files
committed
Don't push axes state if it wasn't edited.
1 parent 70dcaa6 commit beb642c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@ def figure_edit(axes, parent=None):
4545
sep = (None, None) # separator
4646

4747
# 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())
5051
general = [('Title', axes.get_title()),
5152
sep,
5253
(None, "<b>X-Axis</b>"),
53-
('Min', xmin), ('Max', xmax),
54+
('Min', orig_xmin), ('Max', orig_xmax),
5455
('Label', axes.get_xlabel()),
5556
('Scale', [axes.get_xscale(), 'linear', 'log']),
5657
sep,
5758
(None, "<b>Y-Axis</b>"),
58-
('Min', ymin), ('Max', ymax),
59+
('Min', orig_ymin), ('Max', orig_ymax),
5960
('Label', axes.get_ylabel()),
6061
('Scale', [axes.get_yscale(), 'linear', 'log']),
6162
sep,
@@ -234,7 +235,9 @@ def apply_callback(data):
234235
# Redraw
235236
figure = axes.get_figure()
236237
figure.canvas.draw()
237-
figure.canvas.toolbar.push_current()
238+
if not ((xmin, xmax) == (orig_xmin, orig_xmax)
239+
and (ymin, ymax) == (orig_ymin, orig_ymax)):
240+
figure.canvas.toolbar.push_current()
238241

239242
data = formlayout.fedit(datalist, title="Figure options", parent=parent,
240243
icon=get_icon('qt4_editor_options.svg'),

0 commit comments

Comments
 (0)
0