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)
-
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.
-
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. -
@JonB See my fork, as I feel that the new window button is better in the title bar.
-
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.
-
Is there another iOS app that has windows that move in this way?
-
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.
-
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