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.
mikael last edited by mikael
@pulbrich, others, any suggestions for a fuzzy search?
fuzzywuzzyis good, but I would like to avoid requiring an extra install.
difflib.get_close_matchesresults are highly unintuitive.
Is there something easy to use provided by iOS?
TPO last edited by
@mikael you could try FuzzyFinder in 10 lines of Python
pulbrich last edited by
I would go with @TPO ‘s idea, perfectly enough for the purpose.
pulbrich last edited by
@mikael Many, many thanks! Perfect now!
for some reason textfield.end_editing() does not hide the keyboard
Same on my iPad mini 4 (iOS 13 + Pythonista beta)
There is a kind of flicking, I think that the keyboard is dismissed and then comes back.
JonB last edited by
from ui import * from objc_util import * uiimage=ObjCClass('UIImage') v=Image.named('test:Lenna') u=uiimage.systemImageNamed_('lessthan.circle') v.objc_instance._setImageAsset_(u.imageAsset())
Leading underscore did the trick, iPadOS 13.1.3.
Maybe not the most future proof, but does the job...
@JonB As usual, you're the 🤴
@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.
@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:"
@cvp, yes, just noticed. iOS 14 must’ve changed it. Will take a look.
@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, for the new symbols, I found a downloadable list of changes, but no list of new icons or an updated master list.
if you want to do a manual quick fix.
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)
@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”).
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)
Names of restricted Symbols are here:
(also a plist file)