Python gdbus example server
- From: Tony Asleson <tasleson redhat com>
- To: python-hackers-list gnome org
- Subject: Python gdbus example server
- Date: Tue, 16 Dec 2014 17:16:55 -0600
In an effort to learn & understand writing a dbus service with python
via PyGI, I attempted to convert the C example:
https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-server.c
to python:
https://github.com/tasleson/py-gdbus-example-server/blob/master/py-gdbus-example-server.py
I had to patch glib to include:
https://bug656325.bugzilla-attachments.gnome.org/attachment.cgi?id=288258
to make this work as far as it does.
I would really appreciate those that understand the library better to
take a peek and offer suggestions for those parts which I couldn't find
/ figure out. They are littered around the code in TODO comments.
Most notable:
- How do I find the corresponding constants for things like:
G_IO_ERROR, G_IO_ERROR_FAILED, G_DBUS_ERROR_MATCH_RULE_NOT_FOUND and
others?
- How does one call GLib.set_error_literal correctly?
- Is there a better way to create variant type instead of doing
something like this:
p1 = GLib.Variant('s', str(interface_name))
p2 = GLib.Variant('a{sv}',
{'Title': GLib.Variant('s', title)})
p3 = GLib.Variant('as', ())
values = GLib.Variant.new_tuple(p1, p2, p3)
Getting this example working this far wasn't very straight forward.
There is a dearth of documentation and examples on this subject, thus
the reason I posted the code.
Thanks!
Regards,
Tony
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]