• daveM

    In the icons and emojis, there are a selection of black and white “things”, I’ll call them icons until corrected.

    I’ve generally just been using the black ones but I’ve decided I want to display one in red and change the colour at will.

    Are you in fact able to do that? ie just change any black to any arbitrary RGB value

    posted in Pythonista read more
  • daveM

    I note the beta has just been extended a few days. It’s back at 7 days in my TestFlight. Considering this thread is 7 days old, there’s 14 days right there. Unless this thread was started when there were 14 days left to begin with.

    posted in Pythonista read more
  • daveM

    I’m looking at a compass style object using the attitude sensor.

    I’ll try those now. Thanks guys

    posted in Pythonista read more
  • daveM

    Who are the @administrators of the forums? Or even @moderators ? Is anyone able to help me with login issues? It appears support and @omz himself aren’t around to help ATM. I’m just hoping he’s hunkered down trying to pump out the next version of Pythonista and hence that’s why he’s gone dark recently.

    Can anyone confirm he’s actually about? Or help me with my login issues? I’ve been reaching out for the last three days and not having any luck with emails, tweets, reset emails etc. if anyone is in contact with any admins or mods, I wouldn’t mind a DM to discuss what’s going on.

    posted in Pythonista read more
  • daveM

    Is it possible to rotate an image in an ImageView view? In the docs it appears there is a rotate attached to Image, but I cannot get the preloaded arrow to react to any amount of coercion.

    ImageView.image.rotate 
    

    doesn’t exist, as doesn’t,

    ImageView.rotate. 
    

    Should I just be using an Image not attached to a view? (That definitely doesn’t sound right).

    Any pointers would be appreciated.

    posted in Pythonista read more
  • daveM

    Hey guys, I’ve only been here a short time but I’ve had issues trying to login. For whatever reason my device hasn’t remembered my password and I was too stupid to remember it as well. The forum never sent me a confirmation email as well. When I’ve gone to use another device I had to log in and realised that I didn’t know it.

    The reset emails don’t come through to me and I’ve now got three accounts for the forums and stupidly (although wise because I don’t use repetitious passwords) the passwords aren’t being saved by my device.

    This thread is is from an iPhone using chrome via a gmail address. I have another account on a linux machine also using chrome via a grandfathered google apps personal domain account and my third is on a MBP using the twitter login (that was my attempt at having the password synced with something). I have tried password resets from all three accounts (obviously from other devices, I don’t want to log out and be forced to create a fourth account).

    I have sent messages to support and checked spam and I am coming up empty. I attempted an email to support from a yahoo account in case it was a gmail issue but again there have been no answers.

    I’ve just reached out directly via twitter and I’ll wait and see what happens.

    I’m curious about other people’s experiences with these forums and passwords. Do other people’s accounts synchronise ok and do you get reset emails?

    posted in Pythonista read more
  • daveM

    Nice idea. I do like it. I love that we have such great access to the Apple ecosystem through python. Some of the stuff I’ve seen people put together (yourself included) is encouraging.

    posted in Pythonista read more
  • daveM

    @cvp you beat me to it! Thanks very much I do appreciate that! Cheers!!

    (Damn, if someone could hit me some rep points I’d appreciate it!!! @cvp and I submitted a message about the same time, I can’t respond until the time passes... which is why I added this text to the bottom!!) lol

    posted in Pythonista read more
  • daveM

    Rofl re not speaking your age. Lol. I’ve just hit a milestone that involved the words [‘half’,’century’], but as with most people I know, now it is just a number. Nobody really cares (unless you’re looking for work or a partner!!!) lol

    Re the geocode API, I’ve been wondering what the “go” is with it. I have been using the google API for a few years and never had any issues. But I’ve always respected the limits and played by the rules. I was surprised Apple has opened them up to third parties. I’ll dig through the Apple docs later and see what restrictions are in place, but I don’t plan to use it too often. I’m developing an in-house tool that will allow using it as required. But it’ll only be 10-20 times a day. Although I may hit limits in testing. I hope that’s not the case. Lol

    posted in Pythonista read more
  • daveM

    Lol. Yes. I saw your name there. All good. I’m not sure how much older than me you might be, but I certainly understand the pains of a failing memory!!! Lol

    posted in Pythonista read more
  • daveM

    @cvp

    Ahh found the issue. I didn’t look hard enough. There was another post detailing the answer and it has worked. Placing the first line here before the update gets things working!!

    @ui.in_background
    def update(self):
        If not...
    

    https://forum.omz-software.com/topic/5430/reverse-geolocation-works-on-console-but-not-in-code/5

    posted in Pythonista read more
  • daveM

    Yeah, I’m really not sure what’s happening. I don’t really get it. If you try the code at the very top, it should work as expected and GeoCode and ReverseGeo both work (probably not on your iPad, did you try the working code on your phone?

    I only dig up this old thread because the problem seemed to be identical and was hopeful that one of the original posters might remember how (if) they resolved it

    posted in Pythonista read more
  • daveM

    Ahh cool Thanks.

    posted in Pythonista read more
  • daveM

    working code

    import console, ui, motion, time
    import location
    
    start = time.time()
    motion.start_updates()
    location.start_updates()
    
    console.set_idle_timer_disabled(True)
    
    def dict_print(dic):
        l = 0
        for k in dic:
            l = max(l,len(k))
        for k,v in dic.items():
            print(f'{k}:'.ljust(l+1),v)
    
    for _ in range(1):
        
        my_location = location.get_location()
        print('location:')
        dict_print(my_location)
        
        
        #address_dict = {'Street': 'Infinite Loop', 'City': 'Cupertino', 'Country': 'USA'}
        
        my_address = {
            k:v for k, v in my_location.items()} 
        # if k=='latitude' or k=='longitude'}
        
        
        print ('my address1:')
        dict_print(my_address)
        my_address = location.geocode(my_location)
        print ('\nmy address2:')
        dict_print(dict(my_address))
        
        results = location.reverse_geocode(my_location)
        print ('reverse geocode:')
        if results:
            dict_print(results[0])
        print('authorised:',location.is_authorized())
        
        while False:
            a, b, c = motion.get_attitude()
            # a tilt left right
            # b roll forwards and backwards
            # c twist about horizontal axis
            print('{: .2f}, {: .2f}, {: .2f},'.format(a,b,c))
            time.sleep(.5)
        
    motion.stop_updates()
    location.stop_updates()```
    
    
    # The non working code: 
    *you will need to create a pyui file that contains three labels:*
    ['latlong', 'speed', 'address']
    
     ```   import console, ui, time
        import location, motion
    
        #console.set_idle_timer_disabled(True)
    
        def dict_print(dic):
            l = 0
            for k in dic:
                l = max(l,len(k))
            s = ''
            for k,v in dic.items():
                s += f'{k.ljust(l+1)}: {v}\n'
            return s 
            
        class myview (ui.View):
            pass
            def __init__(self, *arg, **args):
                start = time.time()
                motion.start_updates()
                location.start_updates()
        
            def update(self):
                if not location.is_authorized():
                    self['address'].text = 'This app needs access to your location data'
                    return
                my_location = location.get_location()
                self['latlong'].text = ', '.join([str(my_location['latitude']), str(my_location['longitude'])])
            
                self['speed'].text = ' / '.join(['{: .2} m/s'.format(my_location['speed']),'{: 0.2} km/h'.format(my_location['speed']*60*60/1000)])
        
                results = location.geocode(my_location)
                print(results)
                results = location.reverse_geocode(my_location)
                print ('reverse geocode:')
                s=''
                if results:
                    self['address'].text = dict_print(results[0])
                #self['address'].text = str(results)
                print(results)
            
        location.start_updates()
        motion.start_updates()
        v = ui.load_view()
        v.update_interval=1
        print('authorised:',location.is_authorized())
        v.present('sheet')
        motion.stop_updates()
        location.stop_updates()
    

    posted in Pythonista read more
  • daveM

    I’ve stumbled across this problem tonight except it’s just a custom ui.View class and I’m trying to get a new geolocation and reverse location in the view’s update method. The generic lay/long speed and everything else is there, but the geolocation and reverse lookup keep returning None.

    The script works perfectly outside a class.

    I’m open to ideas because I’ve been scratching my head for hours.

    posted in Pythonista read more
  • daveM

    Thanks for that. It turns out there's a little more to my problem than that because as soon as I did it, my left and top position were now different (ie, not zero), but the width and height are wrong.

    It turns out the superview's self attribute(s) aren't fully available or defined or set of other. Not sure what it is, but after putting in fixed values I got something closer to what I wanted. I'll work on refining it later. Thanks!!!

    posted in Pythonista read more
  • daveM

    I'm using boilerplate code from the docs (http://omz-software.com/pythonista/docs/ios/ui.html#building-custom-views) and added just a label to display touch location. No matter what I define as the initial points of three label, it is always a fixed size on the screen.

    No matter what settings I create the label, it is always defaulted to (0,0) and a small width. I do want it to be full width, the values shown here are for testing.

    import ui
    
    class MyView (ui.View):
        def __init__(self):
            
            self.info=ui.Label(
                self.height/2,
                self.width/2,
                self.width/2, 
                self.height/4)
            self.info.corner_radius=9
            self.info.alignment=ui.ALIGN_CENTER
            self.info.background_color='#6bff6b'
            self.add_subview(self.info)
            self.background_color='#fff9d6'
    
        def draw(self):
            w=self.width
            h=self.height
            l=w/4
            t=h/4
            w=w/2
            h=h/2
            path = ui.Path.rect(l,t,w,h)
            ui.set_color('blue')
            path.fill()
            img = ui.Image.named('iob:alert_256')
            img.draw(l,t,w,h) #self.width, self.height)
    
        def touch_moved(self, touch):
            x,y=touch.location
            self.info.text = '{:04}-{:0=4}'.format(int(x),int(y))
    
    v = MyView()
    v.present('sheet')```

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!