(self, button, action)
Attempts to identify a mouse button click as a double click event.
Attempts to identify a mouse button click as a double click event.
Attempts to identify a mouse button click as a double click event .
def process(self, button, action):
    """Attempts to identify a mouse button click as a double click event."""
    if action != user_input.PRESS:
      return False

    curr_time = time.time()
    timestamp = self._double_clicks.get(button, None)
    if timestamp is None:
      # No previous click registered.
      self._double_clicks[button] = curr_time
      return False
    else:
      time_elapsed = curr_time - timestamp
      if time_elapsed < _DOUBLE_CLICK_INTERVAL:
        # Double click discovered.
        self._double_clicks[button] = None
        return True
      else:
        # The previous click was too long ago, so discard it and start a fresh
        # timer.
        self._double_clicks[button] = curr_time
        return False
def process ( self , button , action ) : if action != user_input . PRESS : return False curr_time = time . time ( ) timestamp = self . _double_clicks . get ( button , None ) if timestamp is None : # No previous click registered. self . _double_clicks [ button ] = curr_time return False else : time_elapsed = curr_time - timestamp if time_elapsed < _DOUBLE_CLICK_INTERVAL : # Double click discovered. self . _double_clicks [ button ] = None return True else : # The previous click was too long ago, so discard it and start a fresh # timer. self . _double_clicks [ button ] = curr_time return False