Example #1
0
def eventHandlingTest():
    print "event handler test set"
    print "init test set"
    event_handler = EventHandler()    
    # init modules
    dbus_module = DbusModule(event_handler,"dbus","org.mymeego.Ui","/org/mymeego/Ui","org.mymeego.Ui")
    upnp_module = UpnpModule(event_handler,"upnp")
    worker_module = WorkerModule(event_handler,"worker")  
    #init commands  
    event_handler.addCommand(Command("ReturnUiData",dbus_module))
    event_handler.addCommand(Command("DataRequest",worker_module)) # this is the default command from UI
    event_handler.addCommand(Command("GetDeviceList",upnp_module))
    event_handler.addCommand(Command("GetFileList",upnp_module))
    event_handler.addCommand(Command("TransferFiles",upnp_module))
    
    print "start tests"
    event_handler.handleEvent(Event("DataRequest",1,"GetDeviceList"))
    event_handler.handleEvent(Event("DataRequest",1,"GetFileList"))
    event_handler.handleEvent(Event("DataRequest",1,"TransferFiles"))
    event_handler.handleEvent(Event("ReturnUiData",1,"TransferFiles"))
Example #2
0
 # end upnp init ####
 
 # init closing signals
 signal.signal(signal.SIGINT,close)  # CTRL+C signal error
 signal.signal(signal.SIGQUIT,close)  # terminal quit
     
 # init modules
 dbus_module = DbusModule(event_handler,"dbus","org.mymeego.Ui","/org/mymeego/Ui","org.mymeego.Ui")
 upnp_module = UpnpModule(event_handler,"upnp",upnp)
 worker_module = WorkerModule(event_handler,"worker")
 
 ####################
 # INIT handlers
 ####################    
 #TODO: get the native path you are in currently and then the xml files from there...
 event_handler.addCommand(Command("ReturnUiData",dbus_module))
 event_handler.addCommand(Command("DataRequest",worker_module)) # this is the default command from UI
 event_handler.addCommand(Command("GetDeviceList",upnp_module))
 event_handler.addCommand(Command("GetFileList",upnp_module))
 event_handler.addCommand(Command("TransferFiles",upnp_module))
 ####################
 # stop handler init
 ####################
 
 # create agent
 print "create agent"
 agent = Agent(bus,"org.mymeego.Backend","/org/mymeego/Backend",event_handler)
 
 try:    
     # init mainloop
     print "init upnp mainloop"
Example #3
0
    # init closing signals
    signal.signal(signal.SIGINT, close)  # CTRL+C signal error
    signal.signal(signal.SIGQUIT, close)  # terminal quit

    # init modules
    dbus_module = DbusModule(event_handler, "dbus", "org.mymeego.Ui",
                             "/org/mymeego/Ui", "org.mymeego.Ui")
    upnp_module = UpnpModule(event_handler, "upnp", upnp)
    worker_module = WorkerModule(event_handler, "worker")

    ####################
    # INIT handlers
    ####################
    #TODO: get the native path you are in currently and then the xml files from there...
    event_handler.addCommand(Command("ReturnUiData", dbus_module))
    event_handler.addCommand(Command(
        "DataRequest", worker_module))  # this is the default command from UI
    event_handler.addCommand(Command("GetDeviceList", upnp_module))
    event_handler.addCommand(Command("GetFileList", upnp_module))
    event_handler.addCommand(Command("TransferFiles", upnp_module))
    ####################
    # stop handler init
    ####################

    # create agent
    print "create agent"
    agent = Agent(bus, "org.mymeego.Backend", "/org/mymeego/Backend",
                  event_handler)

    try: