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

PR: Update Material Design Icons to 5.9.55 and add support for new mayor version 6.x - 6.3.95 #174

Merged
merged 3 commits into from
Oct 20, 2021
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
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ The following prefixes are currently available to use:

- `ei` prefix holds [**Elusive Icons** 2.0 with its 304 icons](http://elusiveicons.com/icons/).

- `mdi` prefix holds [**Material Design Icons** 5.4.55 with its 5555 icons.](https://cdn.materialdesignicons.com/5.4.55/)
- [**Material Design Icons**](https://cdn.materialdesignicons.com)

- `mdi6` prefix holds [**Material Design Icons** 6.3.95 with its 6395 icons.](https://cdn.materialdesignicons.com/6.3.95/)

- `mdi` prefix holds [**Material Design Icons** 5.9.55 with its 5955 icons.](https://cdn.materialdesignicons.com/5.9.55/)

- `msc` prefix holds [**Codicon Icons** 0.0.25 with its 385 icons.](https://github.com/microsoft/vscode-codicons)

Expand All @@ -84,8 +88,8 @@ asl_icon = qta.icon('ei.asl')
elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!')

# or Material Design Icons:
apn_icon = qta.icon('mdi.access-point-network')
mdi_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')
apn_icon = qta.icon('mdi6.access-point-network')
mdi6_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')

# or Microsoft's Codicons:
squirrel_icon = qta.icon('msc.squirrel')
Expand Down Expand Up @@ -178,11 +182,11 @@ Once installed, run `qta-browser` from a shell to start the browser.
MIT License. Copyright 2015 - The Spyder development team.
See the [LICENSE](LICENSE) file for details.

The Font Awesome, Elusive Icons and Material Design Icons fonts are licensed under the [SIL Open Font License](https://en.wikipedia.org/wiki/SIL_Open_Font_License).
The Font Awesome and Elusive Icons fonts are licensed under the [SIL Open Font License](https://en.wikipedia.org/wiki/SIL_Open_Font_License).

The Phosphor font is licensed under the MIT License.

The Remix Icon font is licensed under the Apache License Version 2.0.
The Material Design Icons and Remix Icon fonts are licensed under the [Apache License Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

Microsoft's Codicons are licensed under a [Creative Commons Attribution 4.0 International Public License](https://github.com/microsoft/vscode-codicons/blob/master/LICENSE).

Expand Down
8 changes: 4 additions & 4 deletions UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ with open('charmap.json', 'w') as file:

## Material Design Icons

To update _Material Design Icons_, you must:
To update _Material Design Icons 6.x_, you must:

- download ttf from <https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/fonts/materialdesignicons-webfont.ttf>
- regenerate the json charmap with the `materialdesignicons.css` file from <https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css>
Expand All @@ -52,15 +52,15 @@ import hashlib
TTF_URL = 'https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/fonts/materialdesignicons-webfont.ttf'
CSS_URL = 'https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css'

with open('materialdesignicons-webfont.ttf', 'wb') as fp:
with open('materialdesignicons6-webfont.ttf', 'wb') as fp:
req = urllib.request.urlopen(TTF_URL)
if req.status != 200:
raise Exception('Failed to download TTF')
fp.write(req.read())
req.close()

hasher = hashlib.md5()
with open('materialdesignicons-webfont.ttf', 'rb') as f:
with open('materialdesignicons6-webfont.ttf', 'rb') as f:
content = f.read()
hasher.update(content)

Expand All @@ -83,7 +83,7 @@ for name, key in data:
name = name.lower()
charmap[name] = key

with open('materialdesignicons-webfont-charmap.json', 'w') as fp:
with open('materialdesignicons6-webfont-charmap.json', 'w') as fp:
json.dump(charmap, fp, indent=4, sort_keys=True)

```
Expand Down
17 changes: 11 additions & 6 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ The following prefixes are currently available to use:

- ``ei`` prefix holds `Elusive Icons 2.0 with its 304 icons`_.

- ``mdi`` prefix holds `Material Design Icons 5.4.55 with its 5555
icons.`_
- `Material Design Icons`_:

- ``mdi6`` prefix holds `Material Design Icons 6.3.95 with its 6395 icons.`_

- ``mdi`` prefix holds `Material Design Icons 5.9.55 with its 5955 icons.`_

- ``msc`` prefix holds Microsoft's `Codicon Icons 0.0.25 with its 385 icons.`_

Expand All @@ -33,7 +36,9 @@ The following prefixes are currently available to use:
.. _414 icons of various brands.: https://fontawesome.com/icons?d=gallery&s=brands&v=5.0.0,5.0.1,5.0.2,5.0.3,5.0.4,5.0.5,5.0.6,5.0.7,5.0.8,5.0.9,5.0.10,5.0.11,5.0.12,5.0.13,5.1.0,5.1.1,5.2.0,5.3.0,5.3.1,5.4.0,5.4.1,5.4.2,5.5.0,5.6.0,5.6.1,5.6.3&m=free
.. _FA 4.7 version with its 675 icons: https://fontawesome.com/v4.7.0/icons/
.. _Elusive Icons 2.0 with its 304 icons: http://elusiveicons.com/icons/
.. _Material Design Icons 5.4.55 with its 5555 icons.: https://cdn.materialdesignicons.com/5.4.55/
.. _Material Design Icons: https://cdn.materialdesignicons.com/
.. _Material Design Icons 6.3.95 with its 6395 icons.: https://cdn.materialdesignicons.com/6.3.95/
.. _Material Design Icons 5.9.55 with its 5955 icons.: https://cdn.materialdesignicons.com/5.9.55/
.. _Codicon Icons 0.0.25 with its 385 icons.: https://github.com/microsoft/vscode-codicons

Examples
Expand Down Expand Up @@ -61,9 +66,9 @@ Examples
asl_icon = qta.icon('ei.asl')
elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!')

# Get Material Design icons by name
apn_icon = qta.icon('mdi.access-point-network')
mdi_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')
# Get Material Design icons 6.x by name
apn_icon = qta.icon('mdi6.access-point-network')
mdi6_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')

# Get Microsoft Codicons icons by name
squirrel_icon = qta.icon('msc.squirrel')
Expand Down
6 changes: 3 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def __init__(self):
elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!')

# Get Material Design icons by name
apn_icon = qta.icon('mdi.access-point-network')
mdi_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')
apn_icon = qta.icon('mdi6.access-point-network')
mdi6_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!')

# Rotated
rot_icon = qta.icon('mdi.access-point-network', rotated=45)
Expand Down Expand Up @@ -127,7 +127,7 @@ def __init__(self):
fa5s_button,
fa5b_button,
elusive_button,
mdi_button,
mdi6_button,
music_button,
heart_button,
rot_button,
Expand Down
9 changes: 6 additions & 3 deletions qtawesome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def _instance():
'fontawesome5-brands-webfont.ttf',
'fontawesome5-brands-webfont-charmap.json'),
('ei', 'elusiveicons-webfont.ttf', 'elusiveicons-webfont-charmap.json'),
('mdi', 'materialdesignicons-webfont.ttf',
'materialdesignicons-webfont-charmap.json'),
('mdi', 'materialdesignicons5-webfont.ttf',
'materialdesignicons5-webfont-charmap.json'),
('mdi6', 'materialdesignicons6-webfont.ttf',
'materialdesignicons6-webfont-charmap.json'),
('ph', 'phosphor.ttf', 'phosphor-charmap.json'),
('ri', 'remixicon.ttf', 'remixicon-charmap.json'),
('msc', 'codicon.ttf', 'codicon-charmap.json'),
Expand Down Expand Up @@ -102,7 +104,8 @@ def icon(*names, **kwargs):
- The prefix corresponding to Font-Awesome 5.x (solid) is 'fa5s'
- The prefix corresponding to Font-Awesome 5.x (brands) is 'fa5b'
- The prefix corresponding to Elusive-Icons is 'ei'
- The prefix corresponding to Material-Design-Icons is 'mdi'
- The prefix corresponding to Material-Design-Icons 5.x is 'mdi'
- The prefix corresponding to Material-Design-Icons 6.x is 'mdi6'

When requesting a single glyph, options (such as color or positional offsets)
can be passed as keyword arguments::
Expand Down
Loading