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.
Best practice for choosing a folder in a dialog
-
files1 = sorted(os.listdir(os.getcwd()), key=str.lower)
script = dialogs.list_dialog(title='', items=files1, multiple=False)
if '.py' not in script:
files1 = sorted(os.listdir(script), key=str.lower)
script = dialogs.list_dialog(title='', items=files1, multiple=False)
url = 'pythonista://' + script + '?action=run'Pretty sure there is a better way to do this.
-
Unless I'm completely missing something obvious, there isn't an official folder dialogue. As such, your way seems to be the best you can do without recursion. Although, you could iterate over each subdirectory (presumably using os.walk) and display separate list dialogues for each subdirectory the user taps into. This would allow for the user to have as many subdirectory levels as they want. I haven't tried actually implementing such a system (I haven't had the need to) but in theory, at least, this should work.