Skip to content

Commit

Permalink
Highlights selected tab in main window
Browse files Browse the repository at this point in the history
Co-authored-by: Eivind Jahren <[email protected]>
  • Loading branch information
AugustoMagalhaes and eivindjahren authored Nov 19, 2024
1 parent 0d2c4c8 commit 2a40bed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ert/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from qtpy.QtGui import QCloseEvent, QCursor, QIcon, QMouseEvent
from qtpy.QtWidgets import (
QAction,
QButtonGroup,
QFrame,
QHBoxLayout,
QMainWindow,
Expand Down Expand Up @@ -51,13 +52,15 @@
BUTTON_STYLE_SHEET
+ """
QToolButton:hover {background-color: rgba(50, 50, 50, 90);}
QToolButton:checked {background-color: rgba(50, 50, 50, 120);}
"""
)

BUTTON_STYLE_SHEET_DARK: str = (
BUTTON_STYLE_SHEET
+ """
QToolButton:hover {background-color: rgba(30, 30, 30, 150);}
QToolButton:checked {background-color: rgba(30, 30, 30, 120);}
"""
)

Expand Down Expand Up @@ -101,6 +104,7 @@ def __init__(
self.central_widget.setLayout(self.central_layout)
self.facade = LibresFacade(self.ert_config)
self.side_frame = QFrame(self)
self.button_group = QButtonGroup(self.side_frame)
self._external_plot_windows: List[PlotWindow] = []

if self.is_dark_mode():
Expand Down Expand Up @@ -256,6 +260,7 @@ def post_init(self) -> None:

def _add_sidebar_button(self, name: str, icon: QIcon) -> SidebarToolButton:
button = SidebarToolButton(self.side_frame)
button.setCheckable(True)
button.setFixedSize(85, 95)
button.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))

Expand All @@ -278,6 +283,7 @@ def _add_sidebar_button(self, name: str, icon: QIcon) -> SidebarToolButton:
button.clicked.connect(self.select_central_widget)
button.right_clicked.connect(self.right_clicked)
button.setProperty("index", name)
self.button_group.addButton(button)
return button

def __add_help_menu(self) -> None:
Expand Down

0 comments on commit 2a40bed

Please sign in to comment.