Esempio n. 1
0
 def parse_buffer(self):
     self.buffer = \
             self.buffer[len(self.buffer)-3:len(self.buffer)]        # Delete buffer[0]
     self.buffer.append(self.charbuf)                                # Append charbuf to buffer
     self.charbuf = ''                                               # Empty charbuf
                                                                     # To execute in another child, just ad & at 
                                                                     # the end of command in config file
     print('[DEBUG]' + str(self.buffer), file=sys.stderr)            # Print the keycode
     cp = ConfigParser(config_path)                                  # ReParse the Config file as it permits user
                                                                     # to modify it on the fly
     action = cp.get_config_action(self.buffer)                      # Try the current buffer
     if action is not None:                                          # Did anything match ?
         print('[DEBUG]' + str(action), file=sys.stderr)             # Debugging informations: what did match
         os.system(action)                                           # Execute the command 
         if time.time() - self.lastinputtimestamp > 0.5:             # Authorize a maximum of 0.5s between two keystrokes
             self.buffer = ['', '', '', '']                          # If not, empty buffer
     self.lastinputtimestamp = time.time()