A visible MainWindow currently editing ``path``, or None.
(path: Path)
| 648 | |
| 649 | @staticmethod |
| 650 | def _window_showing(path: Path) -> "MainWindow | None": |
| 651 | """A visible MainWindow currently editing ``path``, or None.""" |
| 652 | from PySide6.QtWidgets import QApplication |
| 653 | target = Path(path).resolve() |
| 654 | for w in QApplication.topLevelWidgets(): |
| 655 | if (isinstance(w, MainWindow) and w.isVisible() |
| 656 | and w._current_path is not None |
| 657 | and Path(w._current_path).resolve() == target): |
| 658 | return w |
| 659 | return None |
| 660 | |
| 661 | def changeEvent(self, event): |
| 662 | # Re-establish this window's context when it becomes the active window: |