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.
Is it possible to add multiple subviews to a NavigationView in the UI designer?
-
I see how to add a subview to a nav view item in the designer, but I don't find any option to create another subview. My application will need three or four different subviews that may be pushed when the user is interacting with the app. Is it just not possible, meaning I must create the UI in code?
I should create another thread, but it would be nice to be able to copy&paste UI elements. For example copy an element then paste it in a subview. Finally it would be nice to be able to export a .pyui file without having to write a script to read the file and write it to clipboard.
I have spent quite a bit of time searching through the forums and docs and I don't seem to find an answer to my primary concern (the nav view). Thank you guys for your help in advance.
-
Although it is not exactly pretty, you can rename a pyui to py or txt, and edit directly. It is basically a big nested dict. I had to do this once when I wanted to add my entire view into a subcontainer view.
As for nav views, what I have seen some people do is create a separate pyui for each subview that you want to push in. Then load each individual view as it's own global or class member variable, then push using the var.
There are a few options for pyui files. First, git as part of shellista lets you post entire folders, individual files, etc to github. There are dropbox pickers that let you do the same, but to dropbox. packui lets you package a pyui and py into one self extracting file. Also, the built in gist export works if you put both files in a folder and export the folder.
-
Thanks. It's a little bit of a hack, but I understand. Also.... I created a little script to create .pyui files, but I am finding if they exist without a corresponding .py file, it seems they get messed up. For example, I created one with an empty View just like gets created from the menu. Added a few elements to the View then went to edit another script. When I came back everything was blank in the design view. Is it mandatory to have a .py with the same name? I notice the only thing in those blank scripts is import ui. Does that have something to do with what I am seeing?
Thanks for answering some noob questions.
-
yes, create a py file if you want to edit in design mode.