On Mon, Feb 27, 2012 at 7:28 PM, Daniel Jönsson
<daniel.jons...@moderat.se>wrote:

> ** **
> 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:
http://pygtk.org/pygtk2tutorial/


> 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
> self.get_visible_data():
>                         if prio >= 26:
>                                 prio = 'A '
>                         elif prio <= 0:
>                                 prio = ' '
>                         else:
>                                 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 !?

Regards,

Jaap
_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to