import dbus def cmd_remember_to(ensoapi, thing_to_do): """Creates or appends to a todo note in Tomboy""" bus = dbus.SessionBus() tomboy = bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl") note = tomboy.FindNote("To Do") if note: contents = tomboy.GetNoteContents(note) else: note = tomboy.CreateNamedNote("To Do") contents = "To Do\n" if contents[-1] != "\n": contents += "\n" contents += thing_to_do + "\n" tomboy.SetNoteContents(note, contents) tomboy.DisplayNote(note) def cmd_note(ensoapi, name_of_new_note): """Creates a new note in Tomboy""" bus = dbus.SessionBus() tomboy = bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl") note = tomboy.CreateNamedNote(name_of_new_note) tomboy.DisplayNote(note)