MENU
#!/usr/bin/env python
#! coding:utf8
'''
Created on 11.3.2010
@author: Josef 'multi' Jebavý
mail: josef dot jebavy at gmail.com
web: http://multi.xeres.cz
'''        

import gobject
import dbus
import elementary, e_dbus

if  getattr(dbus, "version", (0,0,0)) >= (0,41,0):
    import dbus.glib
    
dbus_interface = "org.freesmartphone.GSM.Call"
signal_name = "CallStatus"
path = "/org/freesmartphone/GSM/Device"
bus_name = "org.freesmartphone.ogsmd"


def callstatus(self, id, status):
        print "call zmena"
        print id
        print status
#        print properties

class CallStatusE():
    
    
    def __init__(self):
        print " Call Status using E"
        elementary.init()
        
        # nahrada za gobject.MainLoop().run()
        loop = e_dbus.DBusEcoreMainLoop()
        #nefunguje
#        sysbus = dbus.SystemBus(mainloop=loop)
#                
        dbus.set_default_main_loop(loop)
        sysbus = dbus.SystemBus()

#---------------------------------------------------------
        sysbus.add_signal_receiver(callstatus,
                signal_name, dbus_interface, bus_name, path)
#---------------------------------------------------------
#jina moznost:        
#        proxy = sysbus.get_object(bus_name, path)
#        slHal = dbus.Interface(proxy, dbus_interface)
#        slHal.connect_to_signal(signal_name,   callstatus)
#---------------------------------------------------------
        
        elementary.run()
        elementary.shutdown()
        
        
        
class CallStatusG():
    
    def __init__(self):
        print " Call Status using GTK"

        bus = dbus.SystemBus()
    
        proxy = bus.get_object(bus_name, path)
        slHal = dbus.Interface(proxy, dbus_interface)

#---------------------------------------------------------        
        slHal.connect_to_signal(signal_name,   callstatus)
#---------------------------------------------------------        
#jina moznost:
#        sysbus = dbus.SystemBus()        
#        sysbus.add_signal_receiver(callstatus,
#                signal_name, dbus_interface, bus_name, path)
#---------------------------------------------------------

        gobject.MainLoop().run()
        
            
if __name__ == "__main__":
    print "spoustim se "
    CallStatusE()

#    CallStatusG()

Kontakt

Pozdrav, dotaz nebo žádost o konzultaci pošlete na můj email:mail(uzenáč)josefjebavy.cz




Flattr this



Ověřit CSS!