Пример #1
0
class Recorder(object):
    trans = None
    
    def __init__(self):
        log.msg('Starting recorder.')
        self.x = XClass()
        pass

    def set_transport(self,transport):
        if not self.trans:
            self.trans = transport
    
    def _handler_move(self, data_str):
        x,y = data_str.split(',')
        self.x.set_pointer(int(x), int(y))

    def _handler_start_record(self, value):
        global recording
        recording = []
        self.trans.write('Recording..')

    def _handler_track(self, data_str):
        recording.append(data_str.split(','))

    def _handler_stop_record(self, value):
        log.msg("playing back %s movements" % len(recording))
        _x = XClass()
        self.trans.write('Recording stopped...')
        time.sleep(3)
        for x, y in recording:
            #log.msg('%s, %s' % (int(x),int(y)))
            _x.set_pointer(int(x), int(y))
            time.sleep(0.01)
Пример #2
0
 def _handler_stop_record(self, value):
     log.msg("playing back %s movements" % len(recording))
     _x = XClass()
     self.trans.write('Recording stopped...')
     time.sleep(3)
     for x, y in recording:
         #log.msg('%s, %s' % (int(x),int(y)))
         _x.set_pointer(int(x), int(y))
         time.sleep(0.01)
Пример #3
0
 def __init__(self):
     log.msg('Starting recorder.')
     self.x = XClass()
     pass