Package SpecClient :: Module SpecReply
[hide private]
[frames] | no frames]

Source Code for Module SpecClient.SpecReply

 1  #$Id: SpecReply.py,v 1.1 2004/08/23 11:16:09 guijarro Exp $ 
 2  """SpecReply module 
 3   
 4  This module defines the SpecReply class 
 5  """ 
 6   
 7  __author__ = 'Matias Guijarro' 
 8  __version__ = '1.0' 
 9   
10  import SpecEventsDispatcher 
11   
12  REPLY_ID_LIMIT = 2**30 
13  current_id = 0 
14   
15   
16 -def getNextReplyId():
17 global current_id 18 current_id = (current_id + 1) % REPLY_ID_LIMIT 19 return current_id
20 21
22 -class SpecReply:
23 """SpecReply class 24 25 Represent a reply received from a remote Spec server 26 27 Signals: 28 replyFromSpec(self) -- emitted on update 29 """
30 - def __init__(self):
31 """Constructor.""" 32 self.data = None 33 self.error = False 34 self.error_code = 0 #no error 35 self.id = getNextReplyId()
36 37
38 - def update(self, data, error, error_code):
39 """Emit the 'replyFromSpec' signal.""" 40 self.data = data 41 self.error = error 42 self.error_code = error_code 43 44 SpecEventsDispatcher.emit(self, 'replyFromSpec', (self, ))
45 46
47 - def getValue(self):
48 """Return the value of the reply object (data field).""" 49 return self.data
50