def export(): clear_lists() t = todoflow.from_files(todoflow.lists.to_list()) export_deadlines(t) export_today(t) export_generic(t, '@next and not @done and not @today', '@next', 'Next') export_contexts(t)
def print_deadlines(t, query, tag, title_style, title): due = t.filter(query) if not due: return dues = [] for item in due: if item.has_tag(tag): text = item.text days, days_str = calculate_days_left(item, tag) dues.append((days_str, text, get_color(days, item))) else: pass print_title(title, title_style) for days, text, color in dues: hcs(20) print days, hcs(color=color), text hcs() t = todoflow.from_files(todoflow.lists.to_list()) query_today = '@working and not @done' query_next = '@next and not @done and not @working' print_deadlines(t, '@due and not @done and not @waiting', '@due', (1.0, 0.0, 0.0), 'Deadlines') print_deadlines(t, '@date and not @done and not @waiting', '@date', (1.0, 1.0, 0.0), 'Dates') print_query(t, 'Working', query_today, (0.0, 1.0, 1.0)) print_query(t, 'Next', query_next, (0.0, 0.0, 1.0))
#!/usr/bin/python import sys sys.path.append('/Users/bvsc/Dropbox/Projects') import todoflow from todoflow.printers import XMLPrinter query = ' '.join(sys.argv[1:]) query = todoflow.expand_query(query) t = todoflow.from_files(todoflow.lists.to_list()).filter(query) print XMLPrinter().pformat(t)
DayonePrinter().pformat(filtered) full_text = u"""<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Creation Date</key> <date>{date}</date> <key>Entry Text</key> <string>{entry_text}</string> <key>Starred</key> <false/> <key>Tags</key> <array> <string>todone</string> </array> <key>UUID</key> <string>{uid}</string> </dict> </plist> """.format( uid=uid, entry_text=escape(entry_text).decode('utf-8'), date=log_date.strftime('%Y-%m-%dT23:59:59Z') ) with open(day_one_dir_path + uid + day_one_extension, 'w') as f: f.write(full_text.encode('utf-8')) if __name__ == '__main__': log_to_day_one(todoflow.from_files(todoflow.lists.to_list()))