/srv/irclogs.ubuntu.com/2011/11/16/#ubuntu-app-devel.txt

aquariusif I have a path to a .desktop file, what's the best way of launching that program from a python app? Do I have to open it and parse it for the Exec key myself?00:10
ajmitchaquarius: you could possibly use python-xdg to parse the .desktop file, I don't know if it'd be worth it though00:11
jo-erlendwell... "Parse"? :) for line in open("/path/to/desktop.file"): if line.startswith("Exec="): subprocess.check_call([line[5:]])00:13
aquariusheh.00:13
aquariusnot if, for example, the exec line specifies a parameter00:13
aquariusor if it's broken over two lines00:13
ajmitchwhich would need the % arguments stripped off :)00:13
aquariusetc, etc, etc :)00:13
aquariusthis is why I was hoping someone else had already done the hard work ;)00:14
jo-erlendaquarius, add shell=True and it'll work with parameters. But what do you mean broken over two lines? Is that legal in .desktop-files?00:15
aquariusjo-erlend, yeah, I am pretty sure there's a line-break thing00:15
aquariusam looking at pyxdg00:15
jo-erlendoh. I didn't know that.00:15
aquariusgio.AppInfo is the way to launch it, I think00:15
ajmitchpython-xdg has a DesktopEntry class with a getExec() method, probably the closest you'll get :)00:15
aquariusbut I still need to load the individual details with pyxdg to pass them to gio. Bah00:16
aquariuswish gio.AppInfo had a load_desktop_file method.00:16
ajmitchit used to be that you could just call 'xdg-open blah.desktop' & it'd run it00:16
jo-erlendbtw... I've forgotten how to get outputs of commands as lines when running subprocess. Anyone?00:24
aquariusjo-erlend, http://docs.python.org/library/subprocess.html#replacing-bin-sh-shell-backquote01:01
dpmmorning08:20
jo-erlendmorning. :)08:39
jmlhi09:32
=== johnoxton_ is now known as johnoxton
=== johnoxton_ is now known as johnoxton

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!