• JonB

    Which is returning None? get_location, or reverse_geocode?

    posted in Pythonista read more
  • JonB

    You could omit the repeat_forever, but it creates a fun effect, where you can have multiple spots repeating at once. But you should get the idea here...

    import scene,ui
    class MyScene(scene.Scene):
        def __init__(self, in_dot_color=scene.Color(0, 0, 0, 1)):
            self.dot_color = in_dot_color
            self.touch = None
        def draw(self):
            ''' real time drawing only'''
            scene.background(0, 0, 0)
            if self.touch:
                loc = self.touch.location
                scene.ellipse(loc.x - 50, loc.y - 50, 100, 100)
                scene.text('{}, {}'.format(*loc), 'Futura', 20, 100, 50)
        def touch_began(self, touch):
            '''register initial point and time'''
            self.touch = touch
            self.spot_color=(loc.x/self.bounds.width, loc.y/self.bounds.height, .5)
        def touch_moved(self, touch):
            '''Record points and relative timing '''
            self.touch = touch
        def touch_ended(self, touch):
            '''instantiate a shapenode, and animate it'''
            self.touch = None
            for i in range(len(self.points)-1):
    scene.run(s, show_fps=True)

    posted in Pythonista read more
  • JonB

    You migt want to take a look at Sprite or ShapeNode, and use an Action.Sequence, consisting of Action.move_to's based on the recorded timing. That way you just specify the x,y and time to the next point, and scene takes care of doing it smoothly.

    posted in Pythonista read more
  • JonB

    are you trying to replay with the same timing as the original? In that case, you would need to store a list of touches, which includes a timestamp, then in your scene update method you would need to find the nearest time in the list and draw that circle.

    or iirc there are also some animation nodes that you could program to interpolate. but maybe start with just recording and playing back touches, then can work on smoothing it out if needed.

    posted in Pythonista read more
  • JonB

    i should also mention that the gh command does require that you have your github https user/pass stored in the keychain (see help for gh command), which could be set up by running clone at least once using https, then running push.

    posted in Pythonista read more
  • JonB

    By the way, in stash you can use

    stashconf py_traceback 1

    to print full tracebacks, and

    stashconf py_pdb 1

    to automatically start interactive pdb when exceptions occur.
    These turn out to be not very useful for troubleshooting dulwich auth issues.

    For paramiko issues, you could, in the 2.7 interpreter in the console, type

    import paramiko

    (this has to be the 2.7 interpreter, because stash runs in 2.7 by default)

    This forces paramiko to log to the above named file, which you can open in the editor and see what is happening. With my old key(s) i was getting the super helpful

    DEB [20170618-07:37:36.987] thr=2   paramiko.transport: Trying discovered key cb06eb8641f4ca3ff73f806d8bdd7c22 in /private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/.ssh/id_rsa
    DEB [20170618-07:37:37.075] thr=1   paramiko.transport: userauth is OK
    INF [20170618-07:37:37.581] thr=1   paramiko.transport: Authentication (publickey) failed.

    I had to delete the offending key before it would move onto another one.

    posted in Pythonista read more
  • JonB

    Strangely, all of my git ssh keys in pythonista seemed to stop working recently . Don't know what that's all about, but the following did fix the issue:

    1. I deleted my existing keys in ~/.ssh If you use ssh in stash for other things, this could be a problem, in which case go into github and delete your keys.

    [~/Documents]$ gh create_key newipadkey
    Creating a ssh key in ~/.ssh/
    ssh-keygen -d rsa -b2048
    ssh keys generated with rsa encryption
    [~/Documents]$ git clone ssh://git@github.com/jsbain/stash.git stash

    And this successfully cloned.

    It is possible you may need to add github to known hosts (copy the following to your ~/.ssh/known_hosts file) if you havent before

    github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==

    posted in Pythonista read more
  • JonB

    I will bite the bullet and install ios9...

    posted in Pythonista read more
  • JonB

    The confusing bit is that anchor_point not only defines how a node is placed within its parent, but also defines the origin of the node as children relate to it.

    This works fine if everybody's anchor_point is the same, but may be confusing when you want a node centered on the scene, but subnodes referenced from corner.

    For your code, the easiest fix is when the board is anchored at (.5,.5), to center it in the scene, you need to subtract size/2 from the square positions (anchored at 0,0)

    class BoardSquare(ShapeNode):
        def __init__(self, parent, frame, inLocation):
            x, y, w, h = frame
            super().__init__(ui.Path.rect(0,0, w, h),
                             parent=parent, position=(x,y)-parent.size/2,anchor_point = (0.0, 0.0))
            odd = (inLocation[0] + inLocation[1]) % 2
            self.fill_color = colorRed if odd else colorBlue

    Ideally, there would have been something like a "frame anchor" and "bounds anchor".

    posted in Pythonista read more
  • JonB

    have you looked at the dialogs module? The form_dialog can make settings type ui's.

    from dialogs import *
    stunned={'type':'switch','title':'just stunned'}
    section1=('Parrot',[dead, resting, stunned] )
    section2=('Spam',[spam, spamity, spaM],'SpammitySpam' )
    f = form_dialog(title='Python Settings', sections=
        [section1, section2])

    As to your original question, you can use an imageview with an image of a line that you stretch out. Also, you could use a custom view with drawing, but that requires code, cannot really layout in ui editor.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!