Closed HadleyKing closed 7 months ago
Note that they just have a lot which is why it's being used but it's not a requirement. There are also a few blueprints icons and another directory with scripts to convert some images into the icons.
The ultimate requirement of these icons is a single svg path spec, you can throw a png into icons/services/src
and use npm run codegen:icons
(may require some dependencies) which will attempt to extract such a path from a raster.
@u8sand Thanks for the breadcrumbs! I was thinking of that first, since all of GlyGen's various contributors and sources have their own icons for favicons and whatnot, but I thought using the package would be more appropriate since I saw everyone else doing it. ;-) @jeet-vora and I can pick some of the favicons and convert them.
@u8sand: This is not a priority but....
I added an icon next to the other two like you suggested.
I installed a venv
and the requirements.txt and ran the npm run codegen:icons
and then got to following error:
hadley_king:02/08/23 10:55:04:playbook-partnership:npm run codegen:icons
> playbook-partnership@1.0.0 codegen:icons
> python cli/convert-icons.py icons/services/src icons/services/index.ts
['cli/convert-icons.py', 'icons/services/src', 'icons/services/index.ts']
converting GlyGen
Traceback (most recent call last):
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 82, in <module>
main(*sys.argv[1:])
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 70, in main
print(
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 73, in <genexpr>
f"export var {slugify(icon_file.stem)}_icon = {repr(convert_path(icon_file.parent/icon_file.stem, icon_file.suffix))};"
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 51, in convert_path
convert('-flatten', f"{base}{ext}", f"{base}.tmp.pbm")
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 14, in convert
def convert(*args): shell('convert', *args)
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 13, in shell
def shell(*args): assert Popen(args, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr).wait() == 0
File "/Users/hadley_king/.pyenv/versions/3.10.6/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/hadley_king/.pyenv/versions/3.10.6/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'convert'
I tried debugging with the convert-icons.py
script a bit an adding a convert
directory but had no success.
Any suggestions?
There is a tool called convert part of imagemagick. It can likely be installed with homebrew on Mac , some package manager on Linux, and maybe Choco or something on windows.
Alternatively the docker image should have it installed but it may be a bit tricky to use that I don't have any instructions yet. I will add those instructions when I get a chance.
@u8sand
That worked a little...
ran brew install imagemagick
and then brew install potrace
.
Now getting the following:
hadley_king:02/23/23 :playbook-partnership:npm run codegen:icons
> playbook-partnership@1.0.0 codegen:icons
> python cli/convert-icons.py icons/services/src icons/services/index.ts
['cli/convert-icons.py', 'icons/services/src', 'icons/services/index.ts']
converting Enrichr
extracting Enrichr
Traceback (most recent call last):
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 82, in <module>
main(*sys.argv[1:])
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 70, in main
print(
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 73, in <genexpr>
f"export var {slugify(icon_file.stem)}_icon = {repr(convert_path(icon_file.parent/icon_file.stem, icon_file.suffix))};"
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 60, in convert_path
result = extract_path(base)
File "/Users/hadley_king/GitHub/nih-cfde/playbook-partnership/cli/convert-icons.py", line 41, in extract_path
for path in g.iterfind(f"{ns}path")
AttributeError: 'NoneType' object has no attribute 'iterfind'
I have done some trouble shooting and come up with nothing so far. Again, not a real priority.
Hi @HadleyKing , actually I ran into this issue as well trying to get it working on Ubuntu. I think I'm somehow utilizing some very new version of one of these tools, in any case I was able to make my dev environment reproducible with docker. Assuming you have docker
and docker-compose
installed, you should be able to run:
docker-compose run dev npm run codegen:icons
Versions in that image, fyi
$ python --version
Python 3.10.9
$ convert -version
Version: ImageMagick 7.1.0-61 Q16-HDRI x86_64 20866 https://imagemagick.org
$ potrace -version
potrace 1.16. Copyright (C) 2001-2019 Peter Selinger.
@pmcneely Here is the icon for Glycan
For Glycan set can you retrieve the horizontal lines they are using for depicting the set and add the glycan icon
For protein icon we can use the below. @seankim658 and @pmcneely can you implement this before Thursday?
@jeet-vora I think we can close this, yes?
@pmcneely Yes we can close it.
The CFDE site uses Material Design Icons to represent datatypes. I have chose the following for Glycan icons for the time being: https://pictogrammers.com/library/mdi/icon/square-wave/
You can submit new icons to the site via their contribution link. Maybe we submit one?