• Sir Platypus

    @ccc When I take out that line it throws an error saying that a ui or view is already being presented.

    posted in Pythonista read more
  • Sir Platypus

    I am finishing a script that uses a ui to add a reminder using the reminder module. In the last section of the script is the location alarm code. I am using a list dialog to select a location. At the end of the list is custom.
    When you click custom, it presents a form where you input the street, city, and state. It then uses the location module to convert the address to geocode, and uses the geocode for the reminder.
    This process has always worked, and I have never had trouble with it. Now that I am trying to put it in a ui script, the form is returning None. The code appears to be perfectly fine, and when I try to use the same system in the console, it works perfectly. Only in the script does it return None.

    The section of the script looks like this:

       self.wait_modal()
       a = reminders.Alarm()
       address_dict = dialogs.form_dialog('test', [{'title': 'Street', 'type': 'text'}, 
       {'title': 'City', 'type': 'text'} ,
       {'title': 'State', 'type': 'text'}, 
       {'title':'Country', 'type': 'text', 'value': 'USA'}])
       results = location.geocode(address_dict)
       if self.radiusswitch.selected_index == 0:
         a.proximity = 'enter'
       if self.radiusswitch.selected_index == 1:
         a.proximity = 'leave'
       lat = results[0]['longitude']
       lng = results[0]['latitude']
       radius = 500
       reverse = location.reverse_geocode(results)
       title = reverse[0]['street']         
       a.location = (title, lat,lng)
       v.r.alarms = [a]
    v.r.save()```
    
    The var that returns None is address_dict. 
    
    Is there any reason why it might be returning None?

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!