r4536 - developers/john_lee/pyfso
john_lee at docs.openmoko.org
john_lee at docs.openmoko.org
Fri Jul 18 19:19:56 CEST 2008
Author: john_lee
Date: 2008-07-18 19:19:55 +0200 (Fri, 18 Jul 2008)
New Revision: 4536
Modified:
developers/john_lee/pyfso/dialer.py
developers/john_lee/pyfso/fso_backend.py
Log:
modify fso_backend to set mainloop when initialize. use GMainLoop as
default in testing.
* also modify dialer to reflect the changes.
Modified: developers/john_lee/pyfso/dialer.py
===================================================================
--- developers/john_lee/pyfso/dialer.py 2008-07-18 17:19:47 UTC (rev 4535)
+++ developers/john_lee/pyfso/dialer.py 2008-07-18 17:19:55 UTC (rev 4536)
@@ -76,7 +76,7 @@
class FSODialer(Dialer):
"""A Dialer implementation based on fso dbus API.
"""
- def __init__(self):
+ def __init__(self, mainloop):
super(FSODialer, self).__init__()
self.callid = None
self.initialized = False
@@ -84,12 +84,12 @@
self.fso = FSOObject()
from threading import Thread
# put the slow init function into background
- Thread(target=self._init).start()
+ Thread(target=self._init, args=(mainloop, )).start()
# FIXME: get state from fso and set self state
self._set_state('release')
- def _init(self):
- if not self.fso.initialize():
+ def _init(self, mainloop):
+ if not self.fso.initialize(mainloop):
return
self.fso.onCallStatus.append(self.on_call_status)
self.initialized = True
@@ -130,9 +130,8 @@
def _test():
- import ecore
- FSODialer()
- ecore.main_loop_begin()
+ from dbus.mainloop.glib import DBusGMainLoop
+ FSODialer(DBusGMainLoop())
if __name__ == "__main__":
Modified: developers/john_lee/pyfso/fso_backend.py
===================================================================
--- developers/john_lee/pyfso/fso_backend.py 2008-07-18 17:19:47 UTC (rev 4535)
+++ developers/john_lee/pyfso/fso_backend.py 2008-07-18 17:19:55 UTC (rev 4536)
@@ -1,4 +1,3 @@
-import e_dbus
import os
from dbus import DBusException, SystemBus, Interface
from general import Singleton
@@ -44,11 +43,11 @@
self.objects[ "%s:%s" % ( busname, objname ) ] = obj
return obj
- def initialize( self ):
+ def initialize( self, mainloop ):
if self.fullinit:
return True
try:
- self.bus = SystemBus( mainloop=e_dbus.DBusEcoreMainLoop() )
+ self.bus = SystemBus( mainloop=mainloop )
except DBusException, e:
print "could not connect to dbus_object system bus:", e
return False
@@ -177,8 +176,9 @@
def _test():
+ from dbus.mainloop.glib import DBusGMainLoop
fso = FSOObject()
- fso.initialize()
+ fso.initialize(DBusGMainLoop())
if __name__ == '__main__':
More information about the commitlog
mailing list