Skip to content

Commit

Permalink
Try having QMainWindow refresh storage when gaining focus
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Jan 14, 2025
1 parent 04ae79d commit 5226e19
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ert/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import webbrowser

from qtpy.QtCore import QCoreApplication, QEvent, QSize, Qt, Signal, Slot
from qtpy.QtGui import QCloseEvent, QCursor, QIcon, QMouseEvent
from qtpy.QtGui import QCloseEvent, QCursor, QFocusEvent, QIcon, QMouseEvent
from qtpy.QtWidgets import (
QAction,
QButtonGroup,
Expand Down Expand Up @@ -105,7 +105,8 @@ def __init__(
self.side_frame = QFrame(self)
self.button_group = QButtonGroup(self.side_frame)
self._external_plot_windows: list[PlotWindow] = []

self.setFocusPolicy(Qt.FocusPolicy.TabFocus)
self.central_widget.setFocusPolicy(Qt.FocusPolicy.TabFocus)
if self.is_dark_mode():
self.side_frame.setStyleSheet("background-color: rgb(64, 64, 64);")
else:
Expand Down Expand Up @@ -365,3 +366,7 @@ def closeEvent(self, closeEvent: QCloseEvent | None) -> None:
def __showAboutMessage(self) -> None:
diag = AboutDialog(self)
diag.show()

def focusInEvent(self, event: QFocusEvent) -> None:

Check failure on line 370 in src/ert/gui/main_window.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Argument 1 of "focusInEvent" is incompatible with supertype "QWidget"; supertype defines the argument type as "QFocusEvent | None"
self.notifier.refresh()
QMainWindow.focusInEvent(self, event)

0 comments on commit 5226e19

Please sign in to comment.