File: context.py

package info (click to toggle)
setools 4.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,600 kB
  • sloc: python: 24,485; makefile: 14
file content (21 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# SPDX-License-Identifier: LGPL-2.1-only

from PyQt6 import QtGui, QtWidgets
import setools

from .role import role_detail_action
from .type import type_detail_action
from .user import user_detail_action

__all__ = ("context_detail_action",)


def context_detail_action(context: setools.Context,
                          parent: QtWidgets.QWidget | None = None) -> tuple[QtGui.QAction,
                                                                            QtGui.QAction,
                                                                            QtGui.QAction]:

    """Return a tuple of QActions that, when triggered, opens a detail popup for the context."""
    return (user_detail_action(context.user, parent),
            role_detail_action(context.role, parent),
            type_detail_action(context.type_, parent))