← Back to team overview

gtg-user team mailing list archive

Need hints using dbus interface

 

I'm poking around at adding some minor functionality to the command line
interface, and have run into trouble figuring out how to make the dbus
interface work.  I'm not sure if the problem is a bug or my own
ignorance, but would appreciate advice.

I've attached my simple dbus script, which just tries to list out all
the active tasks tagged 'gtg'.  All I see printed when I run this is:

 $ ./gtdbus 
 0

I've tested this both with 0.2.4 and 0.3.0 gtg instances running, and
am not seeing correct behavior in either.  OTOH, the ./gtg_new_task
script is working fine.

My guess is either I'm calling timi.get_tasks_filtered() improperly, or
else there is a bug in get_tasks_filtered().

I notice there is a dearth of documentation for the dbus interface.  If
someone could take the time to explain how the interface works, I'll
write up some docs to make life easier for the next guy.

(If it is a bug, then if someone can give me some tips I can try my hand
at debugging it.)

Bryce
#!/usr/bin/env python
import re, sys
import dbus, cgi
from GTG import _

def list_tasks():
    bus = dbus.SessionBus()
    liste = bus.list_names()
    busname = "org.GTG"
    remote_object = bus.get_object(busname,"/org/GTG")
    timi = dbus.Interface(remote_object,dbus_interface="org.GTG")

    tags = 'gtg'
    status = 'Active'
    started_only = None
    is_root = None

    tasks = timi.get_tasks_filtered(tags, status, started_only, is_root)
    print len(tasks)
    for task in tasks:
        print " * " + task['title']

if __name__ == '__main__':
    list_tasks()


Follow ups