zim-wiki team mailing list archive
Mailing list archive
Re: Todo list export function
On Mon, Feb 27, 2012 at 7:28 PM, Daniel Jönsson
> ** **
> I would like for a start to add a button to the tasklist plugin that
> exports the tasklist to a todo.txt file. How do I do that?
Either by patching the tasklist plugin, or by writing a new plugin that
"decorates" that tasklist dialog.
Have a look at the "print to browser" plugin for the second option, this is
where the "print" button is added to the tasklist dialog.
If you need help with basic Gtk stuff like defining a button and connecting
signals, I suggest going over the Gtk tutorial here:
> Here is the codesnippet for making the export:
> def get_visible_data_as_todotxt(self):
> '''Exports currently visible elements from the tasks list
> to Todo.txt'''
> text = ""
> for indent, prio, desc, date, page in
> if prio >= 26:
> prio = 'A '
> elif prio <= 0:
> prio = ' '
> prio = '(%s) '%chr(ord('Z') - prio + 1)
> desc = desc
> if date <> '':
> date = 'due:' + date
> text += " ".join((prio, desc, date)) + "\n"
> return text
If I understand correctly you are using prio up to 26 - do you mean to say
you have tasks with 26 exclamation marks in them !?