def run(self): #print print "Worker module processing event" print self.event # process event if (self.event.command == "DataRequest"): # a data request from ui occurred if (self.event.type == "GetDeviceList"): #forward event to upnp module self.event.command = "GetDeviceList" self.event_handler.handleEvent(self.event) elif (self.event.type == "GetFileList"): #forward event to upnp module self.event.command = "GetFileList" self.event_handler.handleEvent(self.event) elif (self.event.type == "TransferFiles"): #forward event to upnp module self.event.command = "TransferFiles" #change the value format from string to TransferList class transfer = TransferList() transfer.importAsString(self.event.value) self.event.value = transfer self.event_handler.handleEvent(self.event) else: print "ERROR: no solutions found for command DataRequest" else: print "ERROR: no solutions found for event processing found." print "Worker module processed the event"
def transferListTest(): print "transfer list test" valuestringlist = [] valuestringlist.append("4:5:6") valuestringlist.append("3:2:1:2:4:5") valuestringlist.append("1:4") valuestringlist.append("") tr = TransferList() print tr tr.source = "2" tr.target = "5" tr.file_list.append("12") tr.file_list.append("124") print tr print "import as string value tests" for valuestring in valuestringlist: tr = TransferList() tr.importAsString(valuestring) print tr print "transfer list test set ended"