def check_modifiers(org_meth):
    """Add modifiers kwarg to a method that contains a tuple of currently pressed modifiers."""

    @functools.wraps(org_meth)
    def wrapper(*args, **kwargs):
        curr = QApplication.keyboardModifiers()
        kwargs['modifiers'] = tuple( name for name, which in modies.items() if curr & which == which )

        org_meth(*args, **kwargs)

    return wrapper
Add modifiers kwarg to a method that contains a tuple of currently pressed modifiers.
recipes/Python/578675_PyQt4_pressed_modifier_keys_names_method/recipe-578675.py