From d06bfe528bb8d5e2ad2b4844c36fe43155739b3d Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Tue, 12 Jul 2005 18:16:07 +0000 Subject: * python/dbus_bindings.pyx.in: removed * python/dbus_bindings.pyx: Added. - Fixed some memleaks (patch from Sean Meiners ) - Broke out the #include "dbus_h_wrapper.h" and put it in its own pxd file (Pyrex definition) - Broke out glib dependancies into its own pyx module * python/dbus_bindings.pdx: Added. - Defines C class Connection for exporting to other modules * python/dbus_glib_bindings.pyx: Added. - New module to handle lowlevel dbus-glib mainloop integration * python/glib.py: Added. - Registers the glib mainloop when you import this module * python/services.py: Removed (renamed to service.py) * python/service.py: Added. - (class Server): renamed Name * python/__init__.py: Bump ro version (0,41,0) - don't import the decorators or service module by default. These now reside in the dbus.service namespace * python/_dbus.py (Bus::__init__): Add code run the main loop setup function on creation * python/examples/example-service.py, python/examples/example-signal-emitter.py: update examples * python/examples/gconf-proxy-service.py, python/examples/gconf-proxy-service2.py: TODO fix these up * doc/TODO: Addition - Added a Python Bindings 1.0 section - added "Add match on args or match on details to match rules" --- python/_dbus.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'python/_dbus.py') diff --git a/python/_dbus.py b/python/_dbus.py index d559ce18..d52aa8fc 100644 --- a/python/_dbus.py +++ b/python/_dbus.py @@ -42,7 +42,8 @@ print(dbus_object.ListServices()) """ import dbus_bindings -from decorators import * + +import dbus from proxies import * from exceptions import * from services import * @@ -51,13 +52,6 @@ from matchrules import * import re import inspect -_threads_initialized = 0 -def init_gthreads (): - global _threads_initialized - if not _threads_initialized: - dbus_bindings.init_gthreads () - _threads_initialized = 1 - class Bus: """A connection to a DBus daemon. @@ -76,13 +70,16 @@ class Bus: START_REPLY_SUCCESS = dbus_bindings.DBUS_START_REPLY_SUCCESS START_REPLY_ALREADY_RUNNING = dbus_bindings.DBUS_START_REPLY_ALREADY_RUNNING - def __init__(self, bus_type=TYPE_SESSION, glib_mainloop=True): + def __init__(self, bus_type=TYPE_SESSION, use_default_mainloop=True): self._connection = dbus_bindings.bus_get(bus_type) self._connection.add_filter(self._signal_func) self._match_rule_tree = SignalMatchTree() - if (glib_mainloop): - self._connection.setup_with_g_main() + + if use_default_mainloop: + func = getattr(dbus, "_dbus_mainloop_setup_function", None) + if func != None: + func(self) def get_connection(self): return self._connection -- cgit