|
| 1 | +from typing import TYPE_CHECKING, Any, Protocol |
| 2 | + |
| 3 | +if TYPE_CHECKING: |
| 4 | + from PyQt6 import QtCore, QtGui, QtWidgets |
| 5 | + |
| 6 | + |
| 7 | +class RuleOperatorLike(Protocol): |
| 8 | + operand: str |
| 9 | + data: str | None |
| 10 | + list: list["RuleOperatorLike"] |
| 11 | + |
| 12 | + |
| 13 | +class RuleLike(Protocol): |
| 14 | + name: str | None |
| 15 | + enabled: bool |
| 16 | + operator: RuleOperatorLike |
| 17 | + |
| 18 | + |
| 19 | +class StatsDialogProto(Protocol): |
| 20 | + """Typed subset of StatsDialog used by the plugin. |
| 21 | +
|
| 22 | + actionsButton is injected by uic from stats.ui and otherwise appears |
| 23 | + as unknown to static analyzers. |
| 24 | + """ |
| 25 | + |
| 26 | + actionsButton: "QtWidgets.QPushButton" |
| 27 | + |
| 28 | + def windowIcon(self) -> "QtGui.QIcon": ... |
| 29 | + |
| 30 | + |
| 31 | +class RulesEditorDialogProto(Protocol): |
| 32 | + """Typed subset of RulesEditorDialog used by the plugin controllers.""" |
| 33 | + |
| 34 | + _old_rule_name: str |
| 35 | + buttonBox: "QtWidgets.QDialogButtonBox" |
| 36 | + ruleNameEdit: "QtWidgets.QLineEdit" |
| 37 | + ruleDescEdit: "QtWidgets.QPlainTextEdit" |
| 38 | + nodesCombo: "QtWidgets.QComboBox" |
| 39 | + nodeApplyAllCheck: "QtWidgets.QCheckBox" |
| 40 | + uidCombo: "QtWidgets.QComboBox" |
| 41 | + uidCheck: "QtWidgets.QCheckBox" |
| 42 | + enableCheck: "QtWidgets.QCheckBox" |
| 43 | + durationCombo: "QtWidgets.QComboBox" |
| 44 | + dstListsCheck: "QtWidgets.QCheckBox" |
| 45 | + dstListsLine: "QtWidgets.QLineEdit" |
| 46 | + |
| 47 | + def installEventFilter(self, filterObj: "QtCore.QObject") -> None: ... |
| 48 | + |
| 49 | + def hide(self) -> None: ... |
| 50 | + |
| 51 | + def raise_(self) -> None: ... |
| 52 | + |
| 53 | + def activateWindow(self) -> None: ... |
| 54 | + |
| 55 | + def new_rule(self) -> None: ... |
| 56 | + |
| 57 | + def edit_rule(self, records: Any, _addr: str | None = None) -> None: ... |
0 commit comments