def check_singlekey(self):
        """Check if the first sub-sequence of the new key sequence is valid."""
        if len(self._qsequences) == 0:
            return True
        else:
            keystr = self._qsequences[0]
            valid_single_keys = (EDITOR_SINGLE_KEYS if
                                 self.context == 'editor' else SINGLE_KEYS)
            if any((m in keystr for m in ('Ctrl', 'Alt', 'Shift', 'Meta'))):
                return True
            else:
                # This means that the the first subsequence is composed of
                # a single key with no modifier.
                valid_single_keys = (EDITOR_SINGLE_KEYS if
                                     self.context == 'editor' else SINGLE_KEYS)
                if any((k == keystr for k in valid_single_keys)):
                    return True
                else:
                    return False
def check_singlekey ( self ) : if len ( self . _qsequences ) == 0 : return True else : keystr = self . _qsequences [ 0 ] valid_single_keys = ( EDITOR_SINGLE_KEYS if self . context == 'editor' else SINGLE_KEYS ) if any ( ( m in keystr for m in ( 'Ctrl' , 'Alt' , 'Shift' , 'Meta' ) ) ) : return True else : valid_single_keys = ( EDITOR_SINGLE_KEYS if self . context == 'editor' else SINGLE_KEYS ) if any ( ( k == keystr for k in valid_single_keys ) ) : return True else : return False
Check if the first sub-sequence of the new key sequence is valid.