Changeset 421:374788cb36e5
- Timestamp:
- 02/14/13 18:41:57 (12 years ago)
- Branch:
- xplane
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/xplane.py
r420 r421 218 218 return cmp(self._nextFire, other._nextFire) 219 219 220 class ShowMessageRequest(object): 221 """Request to show a message in the simulator window.""" 222 def __init__(self, handler, message, duration, callback, extra): 223 """Construct the request.""" 224 self._handler = handler 225 self._message = message 226 self._duration = duration 227 self._callback = callback 228 self._extra = extra 229 230 def process(self, time): 231 """Process the request. 232 233 Return True if the request has succeeded. An exception may also be 234 thrown if there is some lower-level communication problem.""" 235 self._handler._xplane.showMessage(self._message, self._duration) 236 Handler._callSafe(lambda: self._callback(True, self._extra)) 237 return True 238 239 def fail(self): 240 """Handle the failure of this request.""" 241 Handler._callSafe(lambda: self._callback(False, self._extra)) 242 220 243 def __init__(self, connectionListener, 221 244 connectAttempts = -1, connectInterval = 0.2): … … 302 325 return True 303 326 return False 327 328 def requestShowMessage(self, message, duration, callback, extra = None): 329 """Request showing a message in the simulator.""" 330 with self._requestCondition: 331 self._requests.append(Handler.ShowMessageRequest(self, 332 message, duration, 333 callback, extra)) 334 self._requestCondition.notify() 304 335 305 336 def connect(self): … … 673 704 674 705 duration is the number of seconds to keep the message displayed.""" 675 676 # TODO: implement this for X-Plane677 706 print "xplra.Simulator.sendMessage:", message 678 pass 679 # if self._scroll: 680 # if duration==0: duration = -1 681 # elif duration == 1: duration = -2 682 # else: duration = -duration 683 684 # data = [(0x3380, -1 - len(message), message), 685 # (0x32fa, 'h', duration)] 686 687 # #if _disconnect: 688 # # print "xplra.Simulator.sendMessage(disconnect)", message 689 690 # self._handler.requestWrite(data, self._handleMessageSent, 691 # extra = _disconnect) 707 self._handler.requestShowMessage(message, duration, 708 self._handleMessageSent, 709 extra = _disconnect) 692 710 693 711 def getFuel(self, callback):
Note:
See TracChangeset
for help on using the changeset viewer.