Zim

python access to tasks

Asked by Morten Nielsen on 2016-02-21

Hi

Where can I find some example code to access a notebooks tasks list from my python program?
I have been browsing the code, but cannot find a good place to start.

This is mostly the same question like the on I had in 2013
https://answers.launchpad.net/zim/+question/227797

In that question, you supplied some example code, but that is now obsolete.

Regards
Morten

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Morten Nielsen
Solved:
2016-02-23
Last query:
2016-02-23
Last reply:
2016-02-23

Hi Morten,

Seems to me the code in the "ZimToCal" script is about right. No big
changes in the plugin that should break it in the current version.

Regards,

Jaap

On Sun, Feb 21, 2016 at 12:27 PM, Morten Nielsen <
<email address hidden>> wrote:

> New question #286454 on Zim:
> https://answers.launchpad.net/zim/+question/286454
>
> Hi
>
> Where can I find some example code to access a notebooks tasks list from
> my python program?
> I have been browsing the code, but cannot find a good place to start.
>
> This is mostly the same question like the on I had in 2013
> https://answers.launchpad.net/zim/+question/227797
>
> In that question, you supplied some example code, but that is now obsolete.
>
> Regards
> Morten
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

Morten Nielsen (mbn) said : #2

Hi Jaap

Thanks for the answer

In order to get access to tags , parent info and other metadata related to each task, I will need to create more complex select queries.
I rely a lot on the "implicit tags" based on page names. These are not included in the tasklist.

It just seems more "natural" to tap into zims own python modules.

Is it your recommendation that I create my own queries?

if yes, Bonus request:
Looking here
http://bazaar.launchpad.net/~jaap.karssenberg/zim/pyzim/view/head:/zim/plugins/tasklist.py
I conclude I need a hint on how to get the tags from page names.

regards
Morten

Sorry, but you will have to be more precise in what you want.

Regards,

Jaap

On Mon, Feb 22, 2016 at 10:22 PM, Morten Nielsen <
<email address hidden>> wrote:

> Question #286454 on Zim changed:
> https://answers.launchpad.net/zim/+question/286454
>
> Status: Answered => Open
>
> Morten Nielsen is still having a problem:
> Hi Jaap
>
> Thanks for the answer
>
> In order to get access to tags , parent info and other metadata related to
> each task, I will need to create more complex select queries.
> I rely a lot on the "implicit tags" based on page names. These are not
> included in the tasklist.
>
> It just seems more "natural" to tap into zims own python modules.
>
> Is it your recommendation that I create my own queries?
>
> if yes, Bonus request:
> Looking here
>
> http://bazaar.launchpad.net/~jaap.karssenberg/zim/pyzim/view/head:/zim/plugins/tasklist.py
> I conclude I need a hint on how to get the tags from page names.
>
>
> regards
> Morten
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

Morten Nielsen (mbn) said : #4

ok, will try.

In zim when I open the tasklist, there is a list of tags to the left - with "all tasks" at the top.
You can select one or more tags, and the corresponding tasks will be shown in the tasks list to the right

This tells me that zim has a list of which tags that is associated to which tasks. It is this list I want.

In my zimToCal, I would like to add the tags information to the calendar events.

regards Morten

In the tasklist database table there is a column "tags" that is used for
that. The widget just loads all tasks and than lists the tags seen.

The API in the plugin does not much more than listing the tasks from the
table. So benefit of using the API is that you don't need to load the
database yourself, but not much more convenience.

-- Jaap

On Mon, Feb 22, 2016 at 11:22 PM, Morten Nielsen <
<email address hidden>> wrote:

> Question #286454 on Zim changed:
> https://answers.launchpad.net/zim/+question/286454
>
> Status: Answered => Open
>
> Morten Nielsen is still having a problem:
> ok, will try.
>
> In zim when I open the tasklist, there is a list of tags to the left -
> with "all tasks" at the top.
> You can select one or more tags, and the corresponding tasks will be shown
> in the tasks list to the right
>
> This tells me that zim has a list of which tags that is associated to
> which tasks. It is this list I want.
>
> In my zimToCal, I would like to add the tags information to the calendar
> events.
>
>
> regards Morten
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

Morten Nielsen (mbn) said : #6

ok, thanks for the clarification

I will continue using the sqlite access to the index database,

regards
morten