• Jozh

    You can do it from the keyboard snippets.

    posted in Editorial read more
  • Jozh

    Thanks you.

    posted in Pythonista read more
  • Jozh

    How do you make this work

    import dialogs
    
    text = '''the
    tree
    going'''
    
    
    
    dialogs.edit_list_dialog(title='', items= [text], move=True, delete=True)```

    posted in Pythonista read more
  • Jozh

    editor.set_file_contents(name, new_contents[, root])
    Writes new data to the file with the given name (a relative path). If a file with this name exists, it is overwritten.

    Note that new_contents is a byte string, which means that you can also use this to write binary files (such as images), but if you write non-ASCII text, you have to encode it yourself.

    root can be either ‘local’ or ‘dropbox’. ‘local’ is the default.

    posted in Editorial read more
  • Jozh

    The beta of Editorial has split-screen multitasking.

    posted in Editorial read more
  • Jozh

    editor.get_file_contents(name[, root])
    Return the contents of a file in the document library. root can be either ‘local’ or ‘dropbox’. The default is ‘local’.

    Note that this returns a plain byte string. If you want to get the text of a file that contains unicode, you have to decode it yourself (Editorial saves text files as UTF-8).

    editor.set_file_contents(name, new_contents[, root])
    Writes new data to the file with the given name (a relative path). If a file with this name exists, it is overwritten.

    Note that new_contents is a byte string, which means that you can also use this to write binary files (such as images), but if you write non-ASCII text, you have to encode it yourself.

    root can be either ‘local’ or ‘dropbox’. ‘local’ is the default.

    posted in Editorial read more
  • Jozh

    Is this the best way to say output a list of say the 10 closest birthday? I think not. Thank

    import contacts
    from datetime import datetime
    import operator
    import workflow
    import dialogs
    
    days_list = []
    people = contacts.get_all_people()
    now = datetime.now()
    for p in people:
      b = p.birthday
      if b:
        next_birthday = datetime(now.year, b.month, b.day)
        if next_birthday < now:
          next_birthday = datetime(now.year + 1, b.month, b.day)
        days = (next_birthday - now).days
        days_list.append({'name': p.full_name, 'days': days})
    
    if not days_list:
      print 'You don\'t have any birthdays in your address book.'
    else:
      days_list.sort(key=operator.itemgetter('days'))
      for item in days_list[:1]:
        text = '* %s in %i days' % (item['name'], item['days'])
      for item in days_list[:2]:
        text2 = '* %s in %i days' % (item['name'], item['days'])
      for item in days_list[:3]:
        text3 = '* %s in %i days' % (item['name'], item['days'])
      for item in days_list[:4]:
        text4 = '* %s in %i days' % (item['name'], item['days'])
      for item in days_list[:5]:
        text5 = '* %s in %i days' % (item['name'], item['days'])  
    birthday_list = '\n'.join([text, text2, text3,text4,text5]) 
    workflow.set_output(birthday_list)```

    posted in Editorial read more

Internal error.

Oops! Looks like something went wrong!