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.
View duplication
-
So I'm looking for a way to duplicate a view into another view. I want the first view to be set up by the user. The user then hits a button and the view moves to two separate other views. At this point I've passed an image view to the second view but this won't work for the final project. Here's the flow.
Image,video, or text selected by user and sent to the first view. User hits a button and the first view moves to views two and three
-
Sorry know this is confusing. I'm beginning with pythonista here. I will gladly clarify if I can get some help
-
If you just want the view to appear elsewhere, you can add_subview a view to another vie, though a view can only have one superview at a time.
Otherwise, you need to walk through your view heirarchy, and copy the parameters that your user can change, such as imageview.image, slider values, switch values, texfield text, and so on.
If you have an example gist, it will be easier to explain.
-
I wondered if that was the only solution... Bummer lol ok
-
@robertiii , I think you meant to provide a link in your post, but there is no link. Anyway, i am not exactly sure what you are trying to do. But there is this ui method called, ui.dump_view(view). I am not sure if its only in the beta or the store version also. But it seems to me this could solve your problem if I understand it correctly. I haven't used this method before, as i just seen it recently.
Eg. Given a view that is displayed, you could use this method to get the json string version of the view. You could save it to disk as a pyui file or pass the json str to ui.load_str() to basically recreate/copy the view.In the beta, the method is described below:
ui.dump_view(view)
Serialize a view as a JSON string. The return value can be saved as a .pyui file or it can be passed to load_view_str() to reconstruct the view later.Custom view attributes are not supported, and images in image views and buttons are only saved if they were loaded from a built-in image (i.e. using ui.Image.named()). Overall, the limitations of this function are similar to those of the visual UI editor.