Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_macosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(self, canvas, num):
icon_path = str(cbook._get_data_path('images/matplotlib.pdf'))
_macosx.FigureManager.set_icon(icon_path)
FigureManagerBase.__init__(self, canvas, num)
self._set_window_mode(mpl.rcParams.get("macosx.window_mode", "system"))
self._set_window_mode(mpl.rcParams["macosx.window_mode"])
if self.toolbar is not None:
self.toolbar.update()
if mpl.is_interactive():
Expand Down
15 changes: 7 additions & 8 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,19 @@
'eps with usetex'
])
def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
if rcParams.get("ps.usedistiller") == "ghostscript":
mpl.rcParams.update(rcParams)
if mpl.rcParams["ps.usedistiller"] == "ghostscript":
try:
mpl._get_executable_info("gs")
except mpl.ExecutableNotFoundError as exc:
pytest.skip(str(exc))
elif rcParams.get("ps.userdistiller") == "xpdf":
elif mpl.rcParams["ps.usedistiller"] == "xpdf":
try:
mpl._get_executable_info("gs") # Effectively checks for ps2pdf.
mpl._get_executable_info("pdftops")
except mpl.ExecutableNotFoundError as exc:
pytest.skip(str(exc))

mpl.rcParams.update(rcParams)

fig, ax = plt.subplots()

with io.StringIO() as s_buf, io.BytesIO() as b_buf:
Expand All @@ -67,9 +66,9 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
title += " \N{MINUS SIGN}\N{EURO SIGN}"
ax.set_title(title)
allowable_exceptions = []
if rcParams.get("text.usetex"):
if mpl.rcParams["text.usetex"]:
allowable_exceptions.append(RuntimeError)
if rcParams.get("ps.useafm"):
if mpl.rcParams["ps.useafm"]:
allowable_exceptions.append(mpl.MatplotlibDeprecationWarning)
try:
fig.savefig(s_buf, format=format, orientation=orientation,
Expand All @@ -87,14 +86,14 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
if format == 'ps':
# Default figsize = (8, 6) inches = (576, 432) points = (203.2, 152.4) mm.
# Landscape orientation will swap dimensions.
if rcParams.get("ps.usedistiller") == "xpdf":
if mpl.rcParams["ps.usedistiller"] == "xpdf":
# Some versions specifically show letter/203x152, but not all,
# so we can only use this simpler test.
if papersize == 'figure':
assert b'letter' not in s_val.lower()
else:
assert b'letter' in s_val.lower()
elif rcParams.get("ps.usedistiller") or rcParams.get("text.usetex"):
elif mpl.rcParams["ps.usedistiller"] or mpl.rcParams["text.usetex"]:
width = b'432.0' if orientation == 'landscape' else b'576.0'
wanted = (b'-dDEVICEWIDTHPOINTS=' + width if papersize == 'figure'
else b'-sPAPERSIZE')
Expand Down