|
22 | 22 | except Exception: |
23 | 23 | from PyQt5 import QtCore, QtGui |
24 | 24 |
|
25 | | -from opensnitch.dialogs.stats import StatsDialog |
| 25 | +try: |
| 26 | + from opensnitch.dialogs.events import StatsDialog |
| 27 | +except ImportError: |
| 28 | + from opensnitch.dialogs.stats import StatsDialog |
26 | 29 | from opensnitch.config import Config |
27 | 30 | from opensnitch.nodes import Nodes |
28 | 31 | from opensnitch.notifications import DesktopNotifications |
@@ -507,8 +510,8 @@ def _reload_rules_for_updated_subscription(self, sub: SubscriptionSpec): |
507 | 510 | if not matched: |
508 | 511 | continue |
509 | 512 |
|
510 | | - notification = ui_pb2.Notification( |
511 | | - type=ui_pb2.CHANGE_RULE, |
| 513 | + notification = ui_pb2.Notification( # type: ignore |
| 514 | + type=ui_pb2.CHANGE_RULE, # type: ignore |
512 | 515 | rules=[rule], |
513 | 516 | ) |
514 | 517 | self._nodes.send_notification(addr, notification, None) |
@@ -538,7 +541,7 @@ def _sub_key(self, sub: SubscriptionSpec): |
538 | 541 | return hashlib.sha1(base.encode("utf-8")).hexdigest()[:16] |
539 | 542 |
|
540 | 543 | def configure(self, parent: Any = None): |
541 | | - if type(parent) == StatsDialog: # noqa: E721 |
| 544 | + if isinstance(parent, StatsDialog): |
542 | 545 | if self._cfg_action is not None: |
543 | 546 | return |
544 | 547 |
|
@@ -662,7 +665,7 @@ def run(self, parent: Any = None, args: tuple[Any, ...] = ()): # type: ignore[o |
662 | 665 | Start timers. |
663 | 666 | """ |
664 | 667 |
|
665 | | - if parent == StatsDialog: |
| 668 | + if isinstance(parent, StatsDialog): |
666 | 669 | pass |
667 | 670 | self._start_runtime(recheck=True) |
668 | 671 |
|
|
0 commit comments