|
|
09-20-2010
, 08:19 PM
|
|
Posts: 3,428 |
Thanked: 2,848 times |
Joined on Jul 2008
|
#2
|
loop = gobject.MainLoop()
gobject.threads_init()
context = loop.get_context()
| The Following User Says Thank You to fatalsaint For This Useful Post: | ||
|
|
09-20-2010
, 08:37 PM
|
|
Posts: 125 |
Thanked: 76 times |
Joined on Oct 2009
@ Sao Paulo, Brazil
|
#3
|
|
|
09-21-2010
, 06:53 AM
|
|
Posts: 6 |
Thanked: 3 times |
Joined on May 2010
|
#4
|
![]() |
| Thread Tools | Search this Thread |
|
This code runs ok:
#!/usr/bin/python2.5 import conic import gobject, dbus from dbus.mainloop.glib import DBusGMainLoop def connection_cb(connection, event): print "connection_cb(%s, %s)" % (connection, event) status = event.get_status() error = event.get_error() iap_id = event.get_iap_id() bearer = event.get_bearer_type() if status == conic.STATUS_CONNECTED: print "(CONNECTED (%s, %s, %i, %i)" % (iap_id, bearer, status, error) elif status == conic.STATUS_DISCONNECTED: print "(DISCONNECTED (%s, %s, %i, %i)" % (iap_id, bearer, status,error) elif status == conic.STATUS_DISCONNECTING: print "(DISCONNECTING (%s, %s, %i, %i)" % (iap_id, bearer, status,error) if __name__ == "__main__": DBusGMainLoop(set_as_default=True) bus = dbus.SystemBus() connection = conic.Connection() connection.set_property("automatic-connection-events", True) connection.connect("connection-event", connection_cb) gobject.MainLoop().run()Last edited by jaguilar; 09-20-2010 at 08:39 PM. Reason: added RESOLVED to the title