Commit 3a0eef97 authored by Yusei Tahara's avatar Yusei Tahara

patches: Show special icon for proxy roled script on Zope4

parent 3304ea33
Pipeline #28722 failed with stage
in 0 seconds
...@@ -22,6 +22,7 @@ from OFS.misc_ import p_ ...@@ -22,6 +22,7 @@ from OFS.misc_ import p_
from App.ImageFile import ImageFile from App.ImageFile import ImageFile
from Acquisition import aq_base, aq_parent from Acquisition import aq_base, aq_parent
from zExceptions import Forbidden from zExceptions import Forbidden
from Products.ERP5Type import IS_ZOPE2
### Guards ### Guards
...@@ -153,6 +154,7 @@ class _(PatchClass(PythonScript)): ...@@ -153,6 +154,7 @@ class _(PatchClass(PythonScript)):
# Add proxy role icon in ZMI # Add proxy role icon in ZMI
if IS_ZOPE2:
def om_icons(self): def om_icons(self):
"""Return a list of icon URLs to be displayed by an ObjectManager""" """Return a list of icon URLs to be displayed by an ObjectManager"""
if self._proxy_roles: if self._proxy_roles:
...@@ -164,7 +166,13 @@ class _(PatchClass(PythonScript)): ...@@ -164,7 +166,13 @@ class _(PatchClass(PythonScript)):
p_.PythonScript_ProxyRole_icon = \ p_.PythonScript_ProxyRole_icon = \
ImageFile('pyscript_proxyrole.gif', globals()) ImageFile('pyscript_proxyrole.gif', globals())
else:
@property
def zmi_icon(self):
if self._proxy_roles:
return 'fa fa-terminal fa-spin'
  • I, for one, dislike this animation very much.

    I have been using Zope4 for about a week now, and I find myself editing proxy-roled python scripts outside of my browser just so I do not have to see this spinning icon.

    • It attracts the attention way too much, and it cannot be scrolled away so it is always in plain sight.
    • It uses a non-trivial amount of CPU.
    • I believe, in UI language, animations typically mean "something is in progress" (ex: the - still CPU-wasteful - ERP5JS spinner when loading a page). There is nothing in progress here.

    Please reconsider this UI choice, for example by making the color of the font red (...just to borrow the idea from the Zope2 implementation, with the red python icon) or something. That should be just the right amount of attention-grabbing, without being as distracting as an animation. Also, it will waste less CPU & energy.

    Maybe we add a CSS we control, or (yuck) patch the existing one.

    Maybe we can use some other existing class (ex: fa-rotate-90 or fa-flip-horizontal... not as good as the previous (edit: by which I mean Zope2) icon IMHO, but at least it does not move).

    Edited by Vincent Pelletier
  • I like fa-flip-horizontal, visually it looks like other python script with something different

    image

  • That's a good idea. Let's do it.

  • Fixed 8e9c6d42

  • Thank you very much.

    For reference, Yusei found that there exist a python icon in fontawesome. Unfortunately, because of its almost-4-fold symmetry, with just the available 90/180/270 rotations and two-axes mirroring the difference with a proxy-roled script is much harder to spot. So while it is not clear why Zope4 decided to use the terminal icon for Python Scripts, it allows for a much clearer distinction.

  • It seems the python icon is not available because the fontawesome used in ZMI is fontawesome "free" which does not include "brands", maybe it's like this in Zope to prevent potential copyright issues. Anyway, thanks.

  • python icon is available in Zope4.

    <i class="fab fa-python"></i>

    You can find available icons on fontawesome web site. It is important to specify correct version and free category.

    https://fontawesome.com/v5/icons/python?f=brands&s=solid

  • not only fa-python but also fab is necessary to display that icon.

  • Ah I see thanks, I missed the fab, I tried using https://fontawesome.com/icons/python?f=brands&s=solid which is fontawesome v6 and it uses fa-brands, but v5 uses fab

Please register or sign in to reply
else:
return 'fa fa-terminal'
# Guards # Guards
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment