def __init__(self, parent, title): super(MainWindow, self).__init__(parent, title=title, size=(900, 550)) self.panel = wx.Panel(self, -1) self.__Action = True self.Tour =1 self.__Obstacle = False self.Dessin = False self.Chemin = False self.gap = 20 self.t1= 0 self.__robotx = 175*2 self.__roboty = 53*2 self.__angleActuelle = 0 self.__coordx1 = -1 self.__coordy1 = -1 self.__coordx2 = -1 self.__coordy2 = 1 self.__base = Base() wx.FutureCall(2000, self.__DrawLine) self.Centre() self.Show() LogEvent.addHandler(self.__logReceived) PoseEvent.addHandler(self.__PoseReceived) TrajectoireEvent.addHandler(self.__TrajectoireReceived) DessinEvent.addHandler(self.__DessinReceived) EndEvent.addHandler(self.__endReceived) ConfirmEvent.addHandler(self.__ConfirmReceived)
def dispatch(self, msg): obj = cPickle.loads(msg) moduleName = obj.__module__ if moduleName == log.__name__: LogEvent.fire("'Received message:'") LogEvent.fire(obj.message) elif moduleName == sendpose.__name__: LogEvent.fire('Received pose:') PoseEvent.fire(obj) elif moduleName == senddesssin.__name__: LogEvent.fire('Received draw:') DessinEvent.fire(obj) elif moduleName == sendtrajectoire.__name__: LogEvent.fire('Received path:') TrajectoireEvent.fire(obj) elif moduleName == sendConfirm.__name__: LogEvent.fire('Received Confirmation:') ConfirmEvent.fire(obj.message) elif moduleName == sendEnd.__name__: LogEvent.fire('Received Fin:') EndEvent.fire(obj)