1
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
20
21
23 """SpecReply class
24
25 Represent a reply received from a remote Spec server
26
27 Signals:
28 replyFromSpec(self) -- emitted on update
29 """
31 """Constructor."""
32 self.data = None
33 self.error = False
34 self.error_code = 0
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
48 """Return the value of the reply object (data field)."""
49 return self.data
50