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.


    Anyone done any Scene and UI integration? (Drag-N-Drop)

    Pythonista
    4
    7
    3547
    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.
    • TutorialDoctor
      TutorialDoctor last edited by

      I am moving over to Pythonista for a while from Editorial, and I am wondering if anyone has done any UI and scene integration that allows you to drag and drop UI controls.

      Anyone have any sample code on how it would be done?

      I have made 100 + workflows for Editorial, and I plan on making some useful stuff for Pythonista now, mainly dealing with the ui and scene modules.

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

        I created a simple concept showing a pinch zoomable / two finger draggable view, sort of a primitive window system. Not sure if that's what you meant about dragging ui controls.
        This example just contains a textview, but it could contain any view, with a suitable layout method.

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

          @JonB See my fork, as I feel that the new window button is better in the title bar.

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

            I can't pinch to zoom in the views.

            What I mean is where you can tap and hold a title bar, and drag the view to another location-- a window/frame.

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

              Is there another iOS app that has windows that move in this way?

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

                Use two fingers to drag. Both fingers need to be near the border, not in the textview ( this limitation can be eliminated with some effort, see the discussion on gestures recently in the forums). Removing the textviews makes this easier to use, or you could increase the border.

                If you just want to be able to drag, using one finger, without resizing, you would eliminate the computations leading up to dh and dw, and change the logic that requires two touches... And the dx and dy don't need to be averages anymore, just use the touch values.

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

                  I'm getting close. Resizable windows!

                  <pre>
                  from ui import *

                  class ViewClass(View):
                  def init(self):
                  pass
                  def touch_began(self,touch):
                  window.width = touch.location[0]
                  window.height = touch.location[1]
                  def touch_moved(self,touch):
                  window.width = touch.location[0]
                  window.height = touch.location[1]
                  def touched_ended(self,touch):
                  window.width = touch.location[0]
                  window.height = touch.location[1]

                  main_window = load_view()
                  window = main_window['window']
                  main_window.present('fullscreen')
                  </pre>

                  You just have to create a custom view in the designer named 'window', and make sure the loaded view's custom class is 'ViewClass'.

                  Some bugs and stuff though

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