gtg-user team mailing list archive
-
gtg-user team
-
Mailing list archive
-
Message #00223
Re: I made a docky plugin for GTG
Great news, being a docky user, I can't wait to try.
On Wed, Feb 10, 2010 at 5:20 AM, Luca Invernizzi <invernizzi.l@xxxxxxxxx> wrote:
> Hey Sam, good to hear that!
> Open a bug on the gtg launchapad page, so that we can discuss that
> without bugging the other gtg-users.
>
> Luca
> On Tue, Feb 09, 2010 at 08:14:37PM -0800, Sam wrote:
>> I used the dbus api to make this, its almost perfect, but I would like a
>> dbus function to access the number of active tasks to have its dock icon
>> superimpose this.
>>
>> --
>> Ubuntu FTW!
>
>> #!/usr/bin/python
>>
>> import atexit
>> import gobject
>> import glib
>> import sys
>> import os
>> import dbus
>>
>> try:
>> from docky.docky import DockyItem, DockySink
>> from signal import signal, SIGTERM
>> from sys import exit
>> except ImportError, e:
>> exit()
>>
>> def newTask():
>> bus = dbus.SessionBus()
>> liste = bus.list_names()
>> busname = None
>> busgps = None
>> #We take the list of all buses actually available
>> for i in liste :
>> if i.startswith("org.GTG") :
>> busname = i
>> if busname :
>> remote_object = bus.get_object(busname,"/org/GTG")
>> timi = dbus.Interface(remote_object,dbus_interface="org.GTG")
>> #Calling the method
>> timi.open_new_task()
>> else:
>> print "GTG not found on DBus. Are you sure GTG is started?"
>>
>> def newWindow():
>> bus = dbus.SessionBus()
>> liste = bus.list_names()
>> busname = None
>> busgps = None
>> #We take the list of all buses actually available
>> for i in liste :
>> if i.startswith("org.GTG") :
>> busname = i
>> if busname :
>> remote_object = bus.get_object(busname,"/org/GTG")
>> timi = dbus.Interface(remote_object,dbus_interface="org.GTG")
>> #Calling the method
>> timi.show_task_browser()
>> else:
>> print "GTG not found on DBus. Are you sure GTG is started?"
>>
>> class DockyGTGItem(DockyItem):
>> def __init__(self, path):
>> DockyItem.__init__(self, path)
>>
>> menu_id = self.iface.AddMenuItem ("New Task", "/usr/share/pixmaps/gnome-day.png", "Task Controls")
>> self.id_map[menu_id] = "NewTask"
>>
>> menu_id = self.iface.AddMenuItem ("Open Tasks List", "gtg", "Task Controls")
>> self.id_map[menu_id] = "OpenWindow"
>>
>> def menu_pressed(self, menu_id):
>> if self.id_map[menu_id] == "NewTask":
>> newTask()
>> elif self.id_map[menu_id] == "OpenWindow":
>> newWindow()
>>
>> class DockyGTGSink(DockySink):
>> def item_path_found(self, pathtoitem, item):
>> if item.GetOwnsDesktopFile() and item.GetDesktopFile().endswith("gtg.desktop"):
>> self.items[pathtoitem] = DockyGTGItem(pathtoitem)
>>
>> dockysink = DockyGTGSink()
>>
>> def cleanup():
>> dockysink.dispose()
>>
>> if __name__ == "__main__":
>> mainloop = gobject.MainLoop(is_running=True)
>>
>> atexit.register (cleanup)
>> signal(SIGTERM, lambda signum, stack_frame: exit(1))
>>
>> mainloop.run()
>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~gtg-user
>> Post to : gtg-user@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~gtg-user
>> More help : https://help.launchpad.net/ListHelp
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iQIcBAEBCAAGBQJLcjPxAAoJEJwV7kAnLtWzI+gQALlUxXfskQKyrq+p09ct9jUA
> ozM/Ng4UpdM8ZPJYUKA7cJndsqSLJ4ACm0xJUdSk5DMA/B9oivNR7skIRXQkelWP
> pWqGxKra21C+X5C/qwHuDrQmBx1i7MyRHroDQGYF9/qo8i6JtARvCrN1AmjymVrE
> d3M/MGnpZd+xVabHtYctGjRlnvb9X6cfJ0sg3uER+DNdP6WKA9PMyQkRpIpLj4/R
> rrWGSX+uVnDnuLE8FjFhuw+W9BOl+z6VGbyz3lsl16JzfpleOXs54PxS0Ja0DV2b
> CCk6okf/53ABY/y4s1xqGVCdaJQrwvwtynfi6jO6oxvW8Vog+tv0eMnWI58YBagB
> SH6Fqdbng49GOPW/w0hpFuc6RrYzEPZJvKpZXcryUzNYPtQFeFjbI4X7KdlDsM0v
> Zd0vAPoD19BybfMArbNl1UFHfAwVgB4WqesbPrzy9khWMRCRK7URjN5bDenF0GLq
> tm/PWlXVaBV4BtfZ22+/m7JJlfUBuv/L8vAW4/3e4WpkAXM1Hd8dwhTK7eVuM9Ee
> 4YaQC2Uvo1Xktbd9HmetFKguTF0oO6u4BR0XzSfcZXm95FT4Q85166f9ACgwWNhG
> UKTWEan2skn4/6LPvp4mOkXz4nWzZfsLiP2cf4M1a726rjVMya20o2nKhhSAQYJl
> 6TQTRo2+ZzPIctrZQyQ9
> =D4vA
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Mailing list: https://launchpad.net/~gtg-user
> Post to : gtg-user@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~gtg-user
> More help : https://help.launchpad.net/ListHelp
>
>
--
Bertrand Rousseau
Follow ups
References