omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    SFSymbols?

    Pythonista
    7
    39
    13363
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mikael
      mikael @JonB last edited by

      @JonB, thanks. Intuitively this seems like it should be faster and more efficient than going via the PNG conversion.

      But when I went to test the performance I ran into a couple of issues with the asset approach:

      • Resulting image size is dependent on the size of the original ui.Image created.
      • Both the original and ”asset-applied” images are retained in the ui.Image somehow, and for example ButtonItems do not really handle that well.

      See below couple of example images. First one uses a too-large initializing picture (Lenna), the second too small one (triangle arrow icon), which you can see presented in the title area.

      Break 1
      Break 2

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @mikael last edited by

        @mikael your module now crashes with

        Traceback (most recent call last):
          File "/private/var/mobile/Containers/Shared/AppGroup/668A7D98-7216-47ED-917D-AA0B6173167E/Pythonista3/Documents/MesTests/sfsymbol.py", line 233, in <module>
            data_source = symbol_table.data_source = SymbolSource(root, symbol_table)
          File "/private/var/mobile/Containers/Shared/AppGroup/668A7D98-7216-47ED-917D-AA0B6173167E/Pythonista3/Documents/MesTests/sfsymbol.py", line 76, in __init__
            image=SymbolImage('arrow.left', 8, weight=THIN),
          File "/private/var/mobile/Containers/Shared/AppGroup/668A7D98-7216-47ED-917D-AA0B6173167E/Pythonista3/Documents/MesTests/sfsymbol.py", line 27, in SymbolImage
            conf = UIImageSymbolConfiguration.configurationWithConfiguration_and_(
          File "/var/containers/Bundle/Application/34BAEE1A-BC33-4D6F-A0C1-B733E4991F31/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 445, in __getattr__
            cached_method = ObjCClassMethod(self, attr)
          File "/var/containers/Bundle/Application/34BAEE1A-BC33-4D6F-A0C1-B733E4991F31/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 752, in __init__
            raise AttributeError('No class method found for selector "%s"' % (self.sel_name))
        AttributeError: No class method found for selector "configurationWithConfiguration:and:"
        
        mikael 1 Reply Last reply Reply Quote 0
        • mikael
          mikael @cvp last edited by

          @cvp, yes, just noticed. iOS 14 must’ve changed it. Will take a look.

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @mikael last edited by

            @mikael 900 added symbols in iOS 14 see here

            mikael 2 Replies Last reply Reply Quote 0
            • mikael
              mikael @cvp last edited by

              @cvp, here’s the relevant code if you want to do a manual quick fix. Will push an update to PyPI soon.

                  ...
                  if point_size is not None:
                      conf = conf.configurationByApplyingConfiguration_(
                              UIImageSymbolConfiguration.configurationWithPointSize_(point_size))
                  if weight is not None:
                      conf = conf.configurationByApplyingConfiguration_(
                          UIImageSymbolConfiguration.configurationWithWeight_(weight))
                  if scale is not None:
                      conf = conf.configurationByApplyingConfiguration_(
                          UIImageSymbolConfiguration.configurationWithScale_(scale))
                  objc_image = objc_image.imageByApplyingSymbolConfiguration_(conf)
                  ...
              
              cvp 1 Reply Last reply Reply Quote 0
              • mikael
                mikael @cvp last edited by

                @cvp, for the new symbols, I found a downloadable list of changes, but no list of new icons or an updated master list.

                cvp 1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @mikael last edited by

                  @mikael said:

                  if you want to do a manual quick fix.

                  Seems ok

                  1 Reply Last reply Reply Quote 0
                  • cvp
                    cvp @mikael last edited by

                    @mikael dis you see? Even colored ones

                    1 Reply Last reply Reply Quote 0
                    • 7upser
                      7upser last edited by

                      If someone interested in a list of string, here we go

                      import plistlib
                      import io
                      
                      vFilePath = '/System/Library/CoreServices/CoreGlyphs.bundle/symbol_order.plist'
                      
                      with open(vFilePath, 'rb') as vFile:
                      	vFileObject = io.BytesIO(vFile.read())
                      vJsonSFSymbols = plistlib.load(vFileObject)
                      
                      for vIndex, vJsonSFSymbol in enumerate(vJsonSFSymbols):
                      	print(str(vIndex).zfill(4), vJsonSFSymbol)
                      
                      mikael 1 Reply Last reply Reply Quote 2
                      • mikael
                        mikael @7upser last edited by

                        @7upser, excellent! I ran a quick comparison, and the plist list has all the symbols that the ”manual” list had, plus 162 additional symbols all ending in one of: ar, he, hi, ja, ko, zh or rtl, which I take to be additional language-based versions.

                        With this, when I have a moment, I can probably change the symbol browser to show whatever you have available in your iOS version, rather than relying on a manually updated list. What seems to be missing, though, is the marker for the symbols that Apple says must not be used outside their Apple context (like ”airpods”).

                        1 Reply Last reply Reply Quote 0
                        • 7upser
                          7upser last edited by 7upser

                          I'm missing the Categories for SF Symbols.
                          I think there are only Categories in the Mac App.
                          I found two older version and a Screenshot for the new Gaming Cat.
                          I add some cats for newer Symbols, but didn't finished.
                          This is what i have (with Pythonista Symbols and Emojis)

                          Icons.json

                          Names of restricted Symbols are here:
                          /System/Library/CoreServices/CoreGlyphs.bundle/symbol_restrictions.strings
                          (also a plist file)

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Powered by NodeBB Forums | Contributors