当前位置: 首页>>代码示例>>Python>>正文


Python Message类代码示例

本文整理汇总了Python中Message的典型用法代码示例。如果您正苦于以下问题:Python Message类的具体用法?Python Message怎么用?Python Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stockerPiece

 def stockerPiece(self):
     print("[-->] On veut stocker")
     # Vérification
     if self.traite == True:
         # Stockage dans l'entrepôt
         print("[-->] On stocke")
         Message.send("fileEntrepot",self.nom,self.resultatCourant)
开发者ID:Epimanjr,项目名称:S7-Usinage,代码行数:7,代码来源:Machine.py

示例2: openProcessWithTitleCheck

def openProcessWithTitleCheck(processName, title, message, args):
    if isWindowExist(title):
        os.popen("wmctrl -R '" + title + "'")
    else:
        if Message != "":
            Message.hint(message)
        subprocess.Popen([processName, args])
开发者ID:AndrewTerekhine,项目名称:xkeys,代码行数:7,代码来源:Common.py

示例3: send_msg

    def send_msg(self, target, data):
        """
            Sends a message to a computer

            @target: The ip address of the computer we are sending
                     the message to. This should be a string

            @data: The data we are sending, usually the string representation
                   of JSON. 
        """
        # Get IP Address to populate message sender field
        my_addr = NetworkUtilities.get_my_ip()

        # Create a new message object       
        msg = Message(my_addr, target, data)  
        msg = msg.get_json()
        
        # Create a new connection to the server
        s = socket(AF_INET, SOCK_STREAM)
        s.connect((self.host, self.port))  
        s.send(msg)

        # Get response from server
        response = s.recv(512)
        print "Response from server : " + response
        s.close()
开发者ID:alexottoboni,项目名称:basic-messenger,代码行数:26,代码来源:msgclient.py

示例4: test_messages_to_python_with_json_message

    def test_messages_to_python_with_json_message(self):
        message_count = 3
        # JSON formatted message NOT created by celery
        q = self.channel._new_queue(self.queue_name)
        message = '{"foo":"bar"}'
        for i in range(message_count):
            m = Message()
            m.set_body(message)
            q.write(m)

        # Get the messages now
        messages = q.get_messages(num_messages=message_count)

        # Now convert them to payloads
        payloads = self.channel._messages_to_python(
            messages, self.queue_name,
        )

        # We got the same number of payloads back, right?
        self.assertEquals(len(payloads), message_count)

        # Make sure they're payload-style objects, and body is the same
        for p in payloads:
            self.assertTrue('properties' in p)
            self.assertEqual(p['body'], message)
开发者ID:juancferrer,项目名称:kombu,代码行数:25,代码来源:test_SQS.py

示例5: envoyerPiece

 def envoyerPiece(self):
     numeroMachine = random.randint(0,1);
     if numeroMachine == 0:
         typeMachine = "mA"
     else:
         typeMachine = "mB"
     #print("fileMachine ; "+typeMachine+" ; "+self.type)
     Message.send("fileMachine",typeMachine,self.type)
开发者ID:Epimanjr,项目名称:S7-Usinage,代码行数:8,代码来源:Piece.py

示例6: Accept

 def Accept( q, socket, port, id ):
   conn, addr = socket.accept()
   message = Message.fromRaw( conn.recv(1024) )
   if message.type == MessageType.AUTH:
     response = Message( MessageType.CONNECT, { "port" : port, "id" : id, "name" : message.get("name") } )
     q.put( response )
     conn.send( response.raw() )
     conn.close()
开发者ID:Alfwich,项目名称:school,代码行数:8,代码来源:Server.py

示例7: openProcess

def openProcess(processName, title, message, argument):
    if getPid(processName) == "":
        command = processName + " " + argument
        subprocess.Popen(processName)
#        subprocess.call(command, shell=True)
#        subprocess.Popen([processName, argument], creationflags=DETACHED_PROCESS)

        if Message != "":
            Message.hint(message)
    else:
        os.popen("wmctrl -R '" + title + "'")
开发者ID:AndrewTerekhine,项目名称:xkeys,代码行数:11,代码来源:Common.py

示例8: OnBeforeRemove

def OnBeforeRemove(self, arg, extra):

	idx = extra["idx"]	  
	takeData = Archive("Take").getValues(idx, "Parent4,CreateBy,Name")
	
	if takeData["CreateBy"] != session["UserID"]:	 
		msg = u"[%s] : 작업물이 삭제되었습니다." % takeData["Name"]
		# 컨퍼머 한테도 가도록
		Message.sendMessage(takeData["CreateBy"], msg, "<a href='/task/view/%d'>%s</a>" % (takeData["Parent4"], msg) )
	
	deleteChildren( idx )	 
	return arg
开发者ID:onetera,项目名称:sp,代码行数:12,代码来源:Take.py

示例9: broadcast

    def broadcast(self, message_text): #, pos, neg):
        if self.producer is None:
            print "Cannot send because self.producer is None"
            return False

        m = Message("twitter-volume", message_text)
        #m.add_field("pos_sent", str(pos))
        #m.add_field("neg_sent", str(neg))

        if self.producer.send(m.str()):
            print "[%d] Transmission successful" % m.get_time()
        else:
            print "[%d] Transmission failed" % m.get_time()
开发者ID:canselcik,项目名称:CoinStat,代码行数:13,代码来源:twitter.py

示例10: display_start_tournament

    def display_start_tournament(msg):
        """
        :param msg: message to be displayed

        """
        indent_cushion()
        print(' Tournament Start! ')
        indent_cushion()
        m = Message.get_players(msg)
        print('\nPlayers: ' + m)
        #assuming for the time being that info will hold the specified game
        m = Message.get_info(msg)
        print('\nGame: ' + m)
开发者ID:rikachan58,项目名称:game-framework,代码行数:13,代码来源:Display.py

示例11: processusMachine

def processusMachine(nom, listePiecesTraitables, listeAutresMachines, nb):
    print("LISTE DES MESSAGES INITIALE")
    Message.afficherListeMessages()
    machine = Machine(nom, listePiecesTraitables, listeAutresMachines)
    i = 0
    while i<nb:
        machine.fonctionner()
        i = i + 1
        print(" ");
    print("LISTE DES MESSAGES FINALE")
    Message.afficherListeMessages()


#processusMachine("mA",["pA", "pB"],["mB"])
开发者ID:Epimanjr,项目名称:S7-Usinage,代码行数:14,代码来源:Machine.py

示例12: btnSearch_pushed

	def btnSearch_pushed(self):
		#Clearing the list
		self.searchList.clear()
		#Retrieving all visitors from the database
		visitors = g_database.GetAllEntries()
		#Converting the users entry to text
		term = self.searchTerm.text()
		#converting the term to lower to allow for user input error
		term = term.lower()
		termFound = False
		for visitor in visitors:
			#Obtaing the surname from the database
			surname = visitor[2]
			#converting the surname to lower to allow for user input error
			surname = surname.lower()
			#Checking the search term matches the term in the database and the visitor isnt signed out
			if term == surname and visitor[7] == "N/A":
				#Creating a full name
				name = ""
				#Adding the forename and a space to the string
				name= name + (visitor[1]) + " "
				#Adding a surname
				name = name + (visitor[2])
				#Adding the full name to the list
				self.searchList.addItem(name)
				termFound = True
		#If the term isnt found
		if termFound == False:
			#Calling the error window, passing in the message to display
			self.message=Message(self,"No entries found, please search again")
			#Showing the window
			self.message.show()
			#Raising the window the front of the screen
			self.message.raise_()
开发者ID:44746,项目名称:VisitorBook,代码行数:34,代码来源:OutSign.py

示例13: OnBeforeRemove

def OnBeforeRemove(self, arg, extra):
	
	idx = extra["idx"]
	
	# 알림 처리 
	r1 = self.getValues(idx, "Name,Parent3,AssignUser")    
	tName = r1["Name"] 
	aUser = r1["AssignUser"]
	shotidx = r1["Parent3"]
	
	if (aUser):						   
		msg = u"[%s] : 배정 되었던 작업이 삭제 되었습니다." % (tName)		   
		Message.sendMessage(aUser, msg, "<a href='/shot/view/%d'>%s</a>" % (shotidx,msg) )
	
	deleteChildren( idx )
	
	return arg
开发者ID:onetera,项目名称:sp,代码行数:17,代码来源:Task.py

示例14: OnAfterModify

def OnAfterModify(self, arg, extra):   
	
	idx = extra["idx"]	  
	gOut = arg["_out_"]
	
	diffData = gOut["diffData"]
	taskData = gOut["taskData"]
	
	sName = taskData["Shot.Name"]
	tName = taskData["Name"]
	
	# 배정에서 변경이 이루어짐
	if "AssignUser" in diffData and type(diffData["AssignUser"]) is tuple:
		assignUser	= diffData["AssignUser"]  #ex. (None,id)
		
		# 신규 배정
		if (assignUser[0] == None) and (assignUser[1] != None):
			# 메세지 발송
			msg = u"[%s/%s] : %s님에 의해 작업에  배정되었습니다." % (sName, tName, session["UserName"])
			Message.sendMessage(assignUser[1], msg, "<a href='/task/view/%s'>%s</a>" % (idx,msg) )
		
		# 배정 해제				
		elif (assignUser[0] != None) and (assignUser[1] == None):
			# 메세지 발송
			msg = u"[%s/%s] : %s님에 의해 작업배정이 해제되었습니다." % (sName, tName, session["UserName"])
			Message.sendMessage(assignUser[1], msg, "<a href='/task/view/%s'>%s</a>" % (idx,msg) )
			
		# 배정자 교체 
		elif (assignUser[0] != None) and (assignUser[1] != None):
			# 메세지 발송, 둘다
			msg = u"[%s/%s] : %s(%s)님으로 작업배정자가 변경되었습니다." % (sName, tName, arg["AssignUser"], arg["AssignUser2"] )
			Message.sendMessage(assignUser[0], msg, "<a href='/task/view/%s'>%s</a>" % (idx,msg) )
			
			msg = u"[%s/%s] : %s님의 작업배정이 %s님으로 변경되었습니다." % (sName, tName, assignUser[0], assignUser[1])
			Message.sendMessage(assignUser[1], msg, "<a href='/task/view/%s'>%s</a>" % (idx,msg) )
			
		#알수 없는 상황!
		else:
			pass 
	
	# 그외 변경 알림
	# 히스토리 기록		 
	# 이게 오케이가 되면 자동으로 연결된 다른 애가 자동시작? -> 일단 대기	 
	# 시퀀스 변경시 새로운 시퀀스 리카운팅 및 작업 변경 ----------------
	if "Parent2" in arg:
		newSeq = arg["Parent2"]
		
		# 하위 연계 변경 처리 ------------------------------------		  
		RDB = Archive("Take").Search(columns="Take.IDX", where="Take.Parent4 == %s" %(idx) )	
		if (RDB[0] > 0):
			for row in RDB[1]:
				idx = str(row["Take_IDX"])
				Archive("Take").Edit( idx, Parent2=newSeq )		   
	
	return arg
开发者ID:onetera,项目名称:sp,代码行数:55,代码来源:Task.py

示例15: lookup

 def lookup(self):
     s = socket.socket()
     
     conn = self.dc_list[self.dc_Id]
     msg = Message('Lookup', None)
         
     send = pickle.dumps(msg,0)
         
     s.connect(conn)
     s.send(send)
     rcv = s.recv(4096)
     
     msg= pickle.loads(rcv)
     log=msg.getPayload()
     print("Local datacenter: ")
     log.displayPosts()
     
     s.close()
开发者ID:adityahemanth,项目名称:TimeKeeper,代码行数:18,代码来源:Client.py


注:本文中的Message类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。