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.


    Bug Report: SketchView can’t draw by pencile/hand

    Pythonista
    3
    7
    2617
    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.
    • wolf71
      wolf71 last edited by

      New version Pythonista.

      Using Examples\User Interface\Sketch.py

      change last line sv.present(‘fullscreen’) to sv.present(‘sheet’)

      you can’t draw it. Please fix it.

      mikael 2 Replies Last reply Reply Quote 0
      • mikael
        mikael @wolf71 last edited by

        @wolf71, this might not be a bug, or at least not a bug in Pythonista.

        As the doc states:

        'sheet': The view covers only part of the screen, and can be dismissed with a downwards swipe gesture (on iOS 13+).

        The ”downwards swipe” looks to me to be more of a long-running pan than a single swipe, and conflicts with regular panning (drawing in sketch).

        This probably could be hacked, to remove the gesture from the sheet.

        1 Reply Last reply Reply Quote 0
        • mikael
          mikael @wolf71 last edited by

          @wolf71, if you absolutely need the sheet, put these lines at the end of the Sketch.py to remove the panning gesture and enable drawing again:

          v = sv.objc_instance
          for _ in range(6): v = v.superview()
          v.gestureRecognizers()[0].setEnabled(False)
          
          cvp wolf71 3 Replies Last reply Reply Quote 1
          • cvp
            cvp @mikael last edited by

            @mikael Thanks a lot. Since iOS 13.3/Pythonista 3.3, I had a similar problem with a script running in appex mode, thus with a view presented in sheet mode. Each touch move did also move the base view. Your appended lines solve it. Thanks to gestures wizard 😀

            mikael 1 Reply Last reply Reply Quote 1
            • wolf71
              wolf71 @mikael last edited by

              @mikael Thank you very much.

              1 Reply Last reply Reply Quote 0
              • mikael
                mikael @cvp last edited by

                @cvp and @wolf71, for what it is worth, I tried using a swipe instead of the built-in pan by adding to the end:

                import gestures
                swiper = gestures.swipe(sv, lambda x: sv.close(), direction=gestures.DOWN)
                

                ... and while it technically works, it is not really usable since iOS swipe gesture is so sensitive that it is easily triggered when starting to draw downwards.

                There is an (undocumented) way to adjust this sensitivity, but I could not find a value that would be a reliably workable compromise between drawing and swiping.

                swiper.context.recognizer.setMinimumPrimaryMovement_(200)
                

                Could be useful for some other use case, though.

                1 Reply Last reply Reply Quote 1
                • cvp
                  cvp @mikael last edited by

                  @mikael said:

                  v = sv.objc_instance
                  for _ in range(6): v = v.superview()
                  v.gestureRecognizers()[0].setEnabled(False)

                  From some time (iOS 14?), these lines are no more sufficient...
                  Up to 8 instead of 6 solve the problem, but I have generalized it with

                  	#for _ in range(8): v = v.superview()
                  	#v.gestureRecognizers()[0].setEnabled(False)	
                  	UIPanGestureRecognizer = ObjCClass('UIPanGestureRecognizer')
                  	#i = 0
                  	while v:
                  		#i+=2
                  		#print(' '*i,v._get_objc_classname())
                  		if v.gestureRecognizers():
                  			for gr in v.gestureRecognizers():
                  				# comment next line to avoid UIParallaxTransitionPanGestureRecognizer
                  				#if gr.isKindOfClass_(UIPanGestureRecognizer.ptr):
                  				if gr._get_objc_classname() == b'UIPanGestureRecognizer':
                  					#print(' '*i,gr._get_objc_classname())
                  					gr.setEnabled(False)
                  		v = v.superview()
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors