Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP, ENH: Add renderer icon #8117

Merged
merged 4 commits into from
Aug 18, 2020
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
21 changes: 19 additions & 2 deletions logo/generate_mne_logos.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from scipy.stats import multivariate_normal
from matplotlib.path import Path
from matplotlib.text import TextPath
from matplotlib.patches import PathPatch
from matplotlib.patches import PathPatch, Ellipse
from matplotlib.colors import LinearSegmentedColormap

# manually set values
dpi = 300.
center_fudge = np.array([2, 0]) # compensate for font bounding box padding
center_fudge = np.array([15, 0]) # compensate for font bounding box padding
tagline_scale_fudge = 0.97 # to get justification right
tagline_offset_fudge = np.array([0, -100.])

Expand Down Expand Up @@ -113,6 +113,23 @@
static_dir = op.join(op.dirname(__file__), '..', 'doc', '_static')
assert op.isdir(static_dir)
plt.savefig(op.join(static_dir, 'mne_logo.svg'), transparent=True)

# modify to make an icone
data_dir = op.join(op.dirname(__file__), '..', 'mne', 'icons')
ax.patches.pop(-1) # no tag line for our icon
ax.collections[:] = []
bounds = np.array([
[mne_path.vertices[:, ii].min(), mne_path.vertices[:, ii].max()]
for ii in range(2)])
bounds *= (plot_dims / dims)
xy = np.mean(bounds, axis=1) - [100, 0]
r = np.diff(bounds, axis=1).max() * 1.2
ax.add_patch(Ellipse(xy, r, r, clip_on=False, zorder=-1, fc='k'))
ax.set_ylim(xy[1] + r / 1.9, xy[1] - r / 1.9)
fig.set_size_inches((256 / dpi, 256 / dpi))
# Qt does not support clip paths in SVG rendering so we have to use PNG here
# then use "optipng -o7" on it afterward (14% reduction in file size)
plt.savefig(op.join(data_dir, 'mne-circle-black.png'), transparent=True)
plt.close()

# 92x22 image
Expand Down
1 change: 1 addition & 0 deletions mne/icons/mne.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<file alias="clear.svg">clear-black-18dp.svg</file>
<file alias="screenshot.svg">screenshot-black-18dp.svg</file>
<file alias="movie.svg">movie-black-18dp.svg</file>
<file alias="mne-icon.png">mne-circle-black.png</file>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeFavelier let me know if this fits into the existing Qt resource scheme well enough

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough 👍

</qresource>
</RCC>
Loading