'--paths', type=str, action='store', nargs='*', default=topy.lists.to_list(), help="paths to files containg todo list, " "defaults to paths stored in topy.lists " "(see config.py)") parser.add_argument('--css', type=str, action='store', nargs=1, default=[None], help="css stylesheet, only valid with --html") args = parser.parse_args() tlist = topy.from_files(args.paths) filtered = tlist.filter(args.query[0]) css_style = args.css[0] def open_html(tlist, css_style=None): html = tlist.as_full_html(css_style=css_style) with open('html/temp.html', 'w') as f: f.write(html) subprocess.call('open html/temp.html', shell=True) open_html(filtered, css_style=css_style)
action='store', nargs='*', default=topy.lists.to_list(), help="paths to files containg todo list, " "defaults to paths stored in topy.lists " "(see config.py)" ) parser.add_argument( '--css', type=str, action='store', nargs=1, default=[None], help="css stylesheet, only valid with --html" ) args = parser.parse_args() tlist = topy.from_files(args.paths) filtered = tlist.filter(args.query[0]) css_style = args.css[0] def open_html(tlist, css_style=None): html = tlist.as_full_html(css_style=css_style) with open('html/temp.html', 'w') as f: f.write(html) subprocess.call('open html/temp.html', shell=True) open_html(filtered, css_style=css_style)
#!/usr/bin/python from config import projects_path, inbox_path, onhold_path # archive_path import topy # from archive import archive from update_lists import update_daily, update_weekly, update_waiting from tvcal import tvcal from log_to_day_one import log_to_day_one all_lists = topy.from_files(topy.lists.to_list()) inbox_file = open(inbox_path, 'a') # archive_list = topy.from_file(archive_path) onhold_list = topy.from_file(onhold_path) log_to_day_one(all_lists.deep_copy()) tvcal(inbox_file) update_weekly(onhold_list, inbox_file) update_waiting(onhold_list, inbox_file) # inbox_file.close() update_daily(all_lists) # archive(all_lists, archive_list) # archive_list.to_file(archive_path) topy.save(all_lists)
filtered = tlist.filter('@done = ' + log_data_str) filtered.remove_tag('done') entry_text = day_one_entry_title + \ filtered.as_markdown(emphasise_done=False) full_text = """<?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>UUID</key> <string>{uid}</string> </dict> </plist> """.format( uid=uid, entry_text=entry_text, 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) if __name__ == '__main__': log_to_day_one(topy.from_files(topy.lists.to_list()))