Skip to content

Commit b5c07b2

Browse files
Merge pull request #1561 from nvandamme/list_subscriptions
[Feature] Blocklist subscriptions plugin with auto scheduled downloads and management UI
2 parents f2ce074 + 8a3be74 commit b5c07b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+13846
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
.vscode/
66
.idea/
7-
.DS_Store
7+
.DS_Store
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is part of OpenSnitch.
2+
#
3+
# OpenSnitch is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# OpenSnitch is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with OpenSnitch. If not, see <http://www.gnu.org/licenses/>.
15+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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: ...
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Runtime compatibility shim for StatsDialog across OpenSnitch versions."""
2+
3+
4+
# Runtime class kept for isinstance checks.
5+
try:
6+
from opensnitch.dialogs.events import StatsDialog
7+
except ImportError:
8+
from opensnitch.dialogs.stats import StatsDialog # type: ignore[assignment]
9+
10+
__all__ = ["StatsDialog"]

0 commit comments

Comments
 (0)