omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    3
    5
    1700
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robertiii
      robertiii last edited by

      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

      Phuket2 1 Reply Last reply Reply Quote 0
      • robertiii
        robertiii last edited by

        Sorry know this is confusing. I'm beginning with pythonista here. I will gladly clarify if I can get some help

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • robertiii
            robertiii last edited by

            I wondered if that was the only solution... Bummer lol ok

            1 Reply Last reply Reply Quote 0
            • Phuket2
              Phuket2 @robertiii last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors