This is great @Phuket2, exactly what I was looking for. Just one question. Do you know what I need to change to make this work in Python 2?
I’m getting the error:
in __init__ super().__init__(*args, **kwargs) TypeError: super() takes at least 1 argument (0 given)
I’ve had a bit of a Google and played around. I can get it to run in Python 2 if I comment out the line:
But the resulting grid of buttons doesn’t look the same as with Python 3. The button widths collapse down to a minimum size.
I'm using the photo module to get the smart album AssetCollection. From that I can select the Panoramas album by referencing it's index, but if I want to share this script I would assume that the Panoramas album will not always be in the same position within the smart albums list.
Does anyone know if I can reference it by name?
smart_albums = photos.get_smart_albums() panoramas = smart_albums
I've created a NavView template and put it on GitHub for anyone to use as a starting point for creating a NavView based app using Pythonista. https://github.com/ncarding/NavViewTemplate
I've done this because it took me ages to workout how to do it myself and I wanted to give something back to the community that unknowingly helped me workout all the problems along the way.
There is however a fairly large bug with the template that needs fixing before it is truly useful. I've tried various things and I just can't workout why the bug is there and how to fix it.
As it stands the NavView has two levels: Groups and People. You can create as many Groups as you like and have as many People in each group as you like.
The UI is built with Pythonista's ui module. The logic uses a custom object orientated module called simple_module. The objects that are created are saved and loaded (for persistence) using the pickle module.
The People lists should be independent of the Group lists, but at the moment they are not.
If you add a new Group then add one or more People to that group and then add a second Group, the People from the first Group are automatically added to the second and any additional Groups.
I can't tell where the bug is but it only effects Groups created with each launch of the app. E.g. If you create three Groups they will all contain the same People. If you then quit the app and relaunch it those people will still be in each Group but if you create more Groups they will not contain the original list of People. These new Groups will however all share any new People added to any of the Groups created in this session.
Any suggestions as to why this is happening and how I might fix it are welcome.
All the code is at https://github.com/ncarding/NavViewTemplate