|
@@ -10,7 +10,6 @@ from __future__ import annotations
|
|
|
import os
|
|
import os
|
|
|
|
|
|
|
|
from PySide6.QtCore import Qt, QSize, QTimer
|
|
from PySide6.QtCore import Qt, QSize, QTimer
|
|
|
-from src import i18n
|
|
|
|
|
from PySide6.QtWidgets import (
|
|
from PySide6.QtWidgets import (
|
|
|
QApplication,
|
|
QApplication,
|
|
|
QButtonGroup,
|
|
QButtonGroup,
|
|
@@ -25,6 +24,7 @@ from PySide6.QtWidgets import (
|
|
|
QWidget,
|
|
QWidget,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+from src import i18n, theme
|
|
|
from src.tabs.fid_tab import FidTab
|
|
from src.tabs.fid_tab import FidTab
|
|
|
from src.tabs.scanner_tab import ScannerTab
|
|
from src.tabs.scanner_tab import ScannerTab
|
|
|
from src.tabs.scanning_tab import ScanningTab
|
|
from src.tabs.scanning_tab import ScanningTab
|
|
@@ -39,33 +39,60 @@ _TAB_NAV_KEYS = [
|
|
|
"tab_nav_fid",
|
|
"tab_nav_fid",
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
-_SPEC_TAB_IDX = 3 # index of the Spectroscopy tab
|
|
|
|
|
-
|
|
|
|
|
-_NAV_BG = "#0f0f1e"
|
|
|
|
|
|
|
+_SPEC_TAB_IDX = 3
|
|
|
_NAV_H = 38
|
|
_NAV_H = 38
|
|
|
-_TAB_BTN_CSS = """
|
|
|
|
|
-QPushButton {
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+# -- dynamic CSS helpers -------------------------------------------------------
|
|
|
|
|
+
|
|
|
|
|
+def _nav_bg(dark: bool) -> str:
|
|
|
|
|
+ return "#0f0f1e" if dark else "#f0f0f8"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def _nav_toolbar_css(dark: bool) -> str:
|
|
|
|
|
+ bg = _nav_bg(dark)
|
|
|
|
|
+ border = "#1e1e38" if dark else "#d0d0e8"
|
|
|
|
|
+ return (
|
|
|
|
|
+ f"QToolBar {{ background: {bg}; border: none; "
|
|
|
|
|
+ f"border-bottom: 1px solid {border}; spacing: 0px; padding: 0px; }}"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def _tab_btn_css(dark: bool) -> str:
|
|
|
|
|
+ inactive = "#7777aa" if dark else "#666688"
|
|
|
|
|
+ active = "#ffffff" if dark else "#1a1a2e"
|
|
|
|
|
+ accent = "#f0c040" if dark else "#c09000"
|
|
|
|
|
+ hover_bg = "#17172e" if dark else "#e0e0f4"
|
|
|
|
|
+ hover_txt = "#aaaacc" if dark else "#333355"
|
|
|
|
|
+ return f"""
|
|
|
|
|
+QPushButton {{
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
- color: #7777aa;
|
|
|
|
|
|
|
+ color: {inactive};
|
|
|
border: none;
|
|
border: none;
|
|
|
border-bottom: 2px solid transparent;
|
|
border-bottom: 2px solid transparent;
|
|
|
padding: 0px 20px;
|
|
padding: 0px 20px;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
min-height: 36px;
|
|
min-height: 36px;
|
|
|
-}
|
|
|
|
|
-QPushButton:checked {
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
- border-bottom: 2px solid #f0c040;
|
|
|
|
|
-}
|
|
|
|
|
-QPushButton:hover:!checked {
|
|
|
|
|
- color: #aaaacc;
|
|
|
|
|
- background: #17172e;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+}}
|
|
|
|
|
+QPushButton:checked {{
|
|
|
|
|
+ color: {active};
|
|
|
|
|
+ border-bottom: 2px solid {accent};
|
|
|
|
|
+}}
|
|
|
|
|
+QPushButton:hover:!checked {{
|
|
|
|
|
+ color: {hover_txt};
|
|
|
|
|
+ background: {hover_bg};
|
|
|
|
|
+}}
|
|
|
"""
|
|
"""
|
|
|
-_LANG_BTN_CSS = f"""
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def _lang_btn_css(dark: bool) -> str:
|
|
|
|
|
+ inactive = "#555577" if dark else "#666688"
|
|
|
|
|
+ active = "#f0c040" if dark else "#c09000"
|
|
|
|
|
+ hover = "#aaaacc" if dark else "#1a1a2e"
|
|
|
|
|
+ return f"""
|
|
|
QPushButton {{
|
|
QPushButton {{
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
- color: #555577;
|
|
|
|
|
|
|
+ color: {inactive};
|
|
|
border: 1px solid transparent;
|
|
border: 1px solid transparent;
|
|
|
border-radius: 3px;
|
|
border-radius: 3px;
|
|
|
padding: 0px 7px;
|
|
padding: 0px 7px;
|
|
@@ -75,26 +102,21 @@ QPushButton {{
|
|
|
max-height: 22px;
|
|
max-height: 22px;
|
|
|
}}
|
|
}}
|
|
|
QPushButton:checked {{
|
|
QPushButton:checked {{
|
|
|
- color: #f0c040;
|
|
|
|
|
- border-color: #f0c040;
|
|
|
|
|
|
|
+ color: {active};
|
|
|
|
|
+ border-color: {active};
|
|
|
}}
|
|
}}
|
|
|
QPushButton:hover:!checked {{
|
|
QPushButton:hover:!checked {{
|
|
|
- color: #aaaacc;
|
|
|
|
|
|
|
+ color: {hover};
|
|
|
}}
|
|
}}
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
-_NAV_TOOLBAR_CSS = f"""
|
|
|
|
|
-QToolBar {{
|
|
|
|
|
- background: {_NAV_BG};
|
|
|
|
|
- border: none;
|
|
|
|
|
- border-bottom: 1px solid #1e1e38;
|
|
|
|
|
- spacing: 0px;
|
|
|
|
|
- padding: 0px;
|
|
|
|
|
-}}
|
|
|
|
|
-"""
|
|
|
|
|
|
|
|
|
|
-_SPEC_BTN_BLINK_CSS = """
|
|
|
|
|
-QPushButton {
|
|
|
|
|
|
|
+def _spec_btn_blink_css(dark: bool) -> str:
|
|
|
|
|
+ active_txt = "#ffffff" if dark else "#1a1a2e"
|
|
|
|
|
+ accent = "#f0c040" if dark else "#c09000"
|
|
|
|
|
+ hover_bg = "#17172e" if dark else "#e0e0f4"
|
|
|
|
|
+ return f"""
|
|
|
|
|
+QPushButton {{
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
color: #e65100;
|
|
color: #e65100;
|
|
|
border: none;
|
|
border: none;
|
|
@@ -102,15 +124,15 @@ QPushButton {
|
|
|
padding: 0px 20px;
|
|
padding: 0px 20px;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
min-height: 36px;
|
|
min-height: 36px;
|
|
|
-}
|
|
|
|
|
-QPushButton:checked {
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
- border-bottom: 2px solid #f0c040;
|
|
|
|
|
-}
|
|
|
|
|
-QPushButton:hover:!checked {
|
|
|
|
|
|
|
+}}
|
|
|
|
|
+QPushButton:checked {{
|
|
|
|
|
+ color: {active_txt};
|
|
|
|
|
+ border-bottom: 2px solid {accent};
|
|
|
|
|
+}}
|
|
|
|
|
+QPushButton:hover:!checked {{
|
|
|
color: #ff7733;
|
|
color: #ff7733;
|
|
|
- background: #17172e;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ background: {hover_bg};
|
|
|
|
|
+}}
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@@ -155,11 +177,11 @@ class LFMRIWindow(QMainWindow):
|
|
|
self._tabs = QTabWidget()
|
|
self._tabs = QTabWidget()
|
|
|
self._tabs.tabBar().hide()
|
|
self._tabs.tabBar().hide()
|
|
|
self._tabs.setDocumentMode(True)
|
|
self._tabs.setDocumentMode(True)
|
|
|
- self._tabs.addTab(self._scanning_tab, i18n.tr(_TAB_NAV_KEYS[0]))
|
|
|
|
|
- self._tabs.addTab(self._seq_tab, i18n.tr(_TAB_NAV_KEYS[1]))
|
|
|
|
|
- self._tabs.addTab(self._scanner_tab, i18n.tr(_TAB_NAV_KEYS[2]))
|
|
|
|
|
- self._tabs.addTab(self._spectroscopy_tab, i18n.tr(_TAB_NAV_KEYS[3]))
|
|
|
|
|
- self._tabs.addTab(self._fid_tab, i18n.tr(_TAB_NAV_KEYS[4]))
|
|
|
|
|
|
|
+ self._tabs.addTab(self._scanning_tab, i18n.tr(_TAB_NAV_KEYS[0]))
|
|
|
|
|
+ self._tabs.addTab(self._seq_tab, i18n.tr(_TAB_NAV_KEYS[1]))
|
|
|
|
|
+ self._tabs.addTab(self._scanner_tab, i18n.tr(_TAB_NAV_KEYS[2]))
|
|
|
|
|
+ self._tabs.addTab(self._spectroscopy_tab, i18n.tr(_TAB_NAV_KEYS[3]))
|
|
|
|
|
+ self._tabs.addTab(self._fid_tab, i18n.tr(_TAB_NAV_KEYS[4]))
|
|
|
self._tabs.currentChanged.connect(self._on_tab_changed)
|
|
self._tabs.currentChanged.connect(self._on_tab_changed)
|
|
|
self.setCentralWidget(self._tabs)
|
|
self.setCentralWidget(self._tabs)
|
|
|
|
|
|
|
@@ -179,27 +201,30 @@ class LFMRIWindow(QMainWindow):
|
|
|
self._build_status_bar()
|
|
self._build_status_bar()
|
|
|
self._size_and_center()
|
|
self._size_and_center()
|
|
|
|
|
|
|
|
|
|
+ # Apply default dark theme to the whole application
|
|
|
|
|
+ self._apply_theme(theme.is_dark())
|
|
|
|
|
+
|
|
|
if seq_file and os.path.isfile(seq_file):
|
|
if seq_file and os.path.isfile(seq_file):
|
|
|
self._seq_tab.load_seq_file(os.path.abspath(seq_file))
|
|
self._seq_tab.load_seq_file(os.path.abspath(seq_file))
|
|
|
|
|
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+ # Nav bar #
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+
|
|
|
def _build_nav_bar(self) -> None:
|
|
def _build_nav_bar(self) -> None:
|
|
|
- tb = QToolBar("Navigation", self)
|
|
|
|
|
|
|
+ self._nav_toolbar = QToolBar("Navigation", self)
|
|
|
|
|
+ tb = self._nav_toolbar
|
|
|
tb.setMovable(False)
|
|
tb.setMovable(False)
|
|
|
tb.setFloatable(False)
|
|
tb.setFloatable(False)
|
|
|
tb.setIconSize(QSize(0, 0))
|
|
tb.setIconSize(QSize(0, 0))
|
|
|
- tb.setStyleSheet(_NAV_TOOLBAR_CSS)
|
|
|
|
|
tb.setFixedHeight(_NAV_H)
|
|
tb.setFixedHeight(_NAV_H)
|
|
|
self.addToolBar(Qt.TopToolBarArea, tb)
|
|
self.addToolBar(Qt.TopToolBarArea, tb)
|
|
|
|
|
|
|
|
- lbl = QLabel(" LF-MRI ")
|
|
|
|
|
- lbl.setStyleSheet(
|
|
|
|
|
- f"color: #444466; font-weight: bold; font-size: 11px; "
|
|
|
|
|
- f"background: {_NAV_BG}; padding: 0 4px;"
|
|
|
|
|
- )
|
|
|
|
|
- tb.addWidget(lbl)
|
|
|
|
|
|
|
+ self._nav_logo_lbl = QLabel(" LF-MRI ")
|
|
|
|
|
+ tb.addWidget(self._nav_logo_lbl)
|
|
|
|
|
|
|
|
- sep = _VSep(tb)
|
|
|
|
|
- tb.addWidget(sep)
|
|
|
|
|
|
|
+ self._nav_sep1 = _VSep(tb)
|
|
|
|
|
+ tb.addWidget(self._nav_sep1)
|
|
|
|
|
|
|
|
self._nav_btn_group = QButtonGroup(self)
|
|
self._nav_btn_group = QButtonGroup(self)
|
|
|
self._nav_btn_group.setExclusive(True)
|
|
self._nav_btn_group.setExclusive(True)
|
|
@@ -208,7 +233,6 @@ class LFMRIWindow(QMainWindow):
|
|
|
for i, key in enumerate(_TAB_NAV_KEYS):
|
|
for i, key in enumerate(_TAB_NAV_KEYS):
|
|
|
btn = QPushButton(i18n.tr(key))
|
|
btn = QPushButton(i18n.tr(key))
|
|
|
btn.setCheckable(True)
|
|
btn.setCheckable(True)
|
|
|
- btn.setStyleSheet(_TAB_BTN_CSS)
|
|
|
|
|
btn.setFixedHeight(_NAV_H)
|
|
btn.setFixedHeight(_NAV_H)
|
|
|
btn.setCursor(Qt.PointingHandCursor)
|
|
btn.setCursor(Qt.PointingHandCursor)
|
|
|
self._nav_btn_group.addButton(btn, i)
|
|
self._nav_btn_group.addButton(btn, i)
|
|
@@ -218,10 +242,9 @@ class LFMRIWindow(QMainWindow):
|
|
|
|
|
|
|
|
self._nav_tab_buttons[0].setChecked(True)
|
|
self._nav_tab_buttons[0].setChecked(True)
|
|
|
|
|
|
|
|
- spacer = QWidget()
|
|
|
|
|
- spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
|
|
|
|
- spacer.setStyleSheet(f"background: {_NAV_BG};")
|
|
|
|
|
- tb.addWidget(spacer)
|
|
|
|
|
|
|
+ self._nav_spacer = QWidget()
|
|
|
|
|
+ self._nav_spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
|
|
|
|
+ tb.addWidget(self._nav_spacer)
|
|
|
|
|
|
|
|
# Language toggle (EN / RU)
|
|
# Language toggle (EN / RU)
|
|
|
self._lang_btn_group = QButtonGroup(self)
|
|
self._lang_btn_group = QButtonGroup(self)
|
|
@@ -229,11 +252,9 @@ class LFMRIWindow(QMainWindow):
|
|
|
self._btn_lang_en = QPushButton("EN")
|
|
self._btn_lang_en = QPushButton("EN")
|
|
|
self._btn_lang_en.setCheckable(True)
|
|
self._btn_lang_en.setCheckable(True)
|
|
|
self._btn_lang_en.setChecked(True)
|
|
self._btn_lang_en.setChecked(True)
|
|
|
- self._btn_lang_en.setStyleSheet(_LANG_BTN_CSS)
|
|
|
|
|
self._btn_lang_en.setCursor(Qt.PointingHandCursor)
|
|
self._btn_lang_en.setCursor(Qt.PointingHandCursor)
|
|
|
self._btn_lang_ru = QPushButton("RU")
|
|
self._btn_lang_ru = QPushButton("RU")
|
|
|
self._btn_lang_ru.setCheckable(True)
|
|
self._btn_lang_ru.setCheckable(True)
|
|
|
- self._btn_lang_ru.setStyleSheet(_LANG_BTN_CSS)
|
|
|
|
|
self._btn_lang_ru.setCursor(Qt.PointingHandCursor)
|
|
self._btn_lang_ru.setCursor(Qt.PointingHandCursor)
|
|
|
self._lang_btn_group.addButton(self._btn_lang_en)
|
|
self._lang_btn_group.addButton(self._btn_lang_en)
|
|
|
self._lang_btn_group.addButton(self._btn_lang_ru)
|
|
self._lang_btn_group.addButton(self._btn_lang_ru)
|
|
@@ -242,17 +263,84 @@ class LFMRIWindow(QMainWindow):
|
|
|
tb.addWidget(self._btn_lang_en)
|
|
tb.addWidget(self._btn_lang_en)
|
|
|
tb.addWidget(self._btn_lang_ru)
|
|
tb.addWidget(self._btn_lang_ru)
|
|
|
|
|
|
|
|
|
|
+ # Theme toggle (☽ dark / ☀ light)
|
|
|
|
|
+ self._nav_sep2 = _VSep(tb)
|
|
|
|
|
+ tb.addWidget(self._nav_sep2)
|
|
|
|
|
+
|
|
|
|
|
+ self._theme_btn_group = QButtonGroup(self)
|
|
|
|
|
+ self._theme_btn_group.setExclusive(True)
|
|
|
|
|
+ self._btn_theme_dark = QPushButton("☽")
|
|
|
|
|
+ self._btn_theme_light = QPushButton("☀")
|
|
|
|
|
+ self._btn_theme_dark.setCheckable(True)
|
|
|
|
|
+ self._btn_theme_light.setCheckable(True)
|
|
|
|
|
+ self._btn_theme_dark.setChecked(True) # default dark
|
|
|
|
|
+ self._btn_theme_dark.setToolTip("Dark theme")
|
|
|
|
|
+ self._btn_theme_light.setToolTip("Light theme")
|
|
|
|
|
+ self._btn_theme_dark.setCursor(Qt.PointingHandCursor)
|
|
|
|
|
+ self._btn_theme_light.setCursor(Qt.PointingHandCursor)
|
|
|
|
|
+ self._theme_btn_group.addButton(self._btn_theme_dark)
|
|
|
|
|
+ self._theme_btn_group.addButton(self._btn_theme_light)
|
|
|
|
|
+ self._btn_theme_dark.clicked.connect(lambda: self._on_theme_toggle(True))
|
|
|
|
|
+ self._btn_theme_light.clicked.connect(lambda: self._on_theme_toggle(False))
|
|
|
|
|
+ tb.addWidget(self._btn_theme_dark)
|
|
|
|
|
+ tb.addWidget(self._btn_theme_light)
|
|
|
|
|
+
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+ # Theme #
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+
|
|
|
|
|
+ def _on_theme_toggle(self, dark: bool) -> None:
|
|
|
|
|
+ theme.set_dark(dark)
|
|
|
|
|
+ self._apply_theme(dark)
|
|
|
|
|
+
|
|
|
|
|
+ def _apply_theme(self, dark: bool) -> None:
|
|
|
|
|
+ app = QApplication.instance()
|
|
|
|
|
+ if app is not None:
|
|
|
|
|
+ app.setStyleSheet(theme.make_app_stylesheet())
|
|
|
|
|
+
|
|
|
|
|
+ bg = _nav_bg(dark)
|
|
|
|
|
+ border = "#1e1e38" if dark else "#d0d0e8"
|
|
|
|
|
+ sep_clr = "#1e1e38" if dark else "#d0d0e8"
|
|
|
|
|
+ logo_clr = "#444466" if dark else "#555577"
|
|
|
|
|
+ tab_css = _tab_btn_css(dark)
|
|
|
|
|
+ lang_css = _lang_btn_css(dark)
|
|
|
|
|
+
|
|
|
|
|
+ self._nav_toolbar.setStyleSheet(_nav_toolbar_css(dark))
|
|
|
|
|
+ self._nav_sep1.setStyleSheet(f"background: {sep_clr}; border: none;")
|
|
|
|
|
+ self._nav_sep2.setStyleSheet(f"background: {sep_clr}; border: none;")
|
|
|
|
|
+ self._nav_logo_lbl.setStyleSheet(
|
|
|
|
|
+ f"color: {logo_clr}; font-weight: bold; font-size: 11px; "
|
|
|
|
|
+ f"background: {bg}; padding: 0 4px;"
|
|
|
|
|
+ )
|
|
|
|
|
+ self._nav_spacer.setStyleSheet(f"background: {bg};")
|
|
|
|
|
+
|
|
|
|
|
+ for btn in self._nav_tab_buttons:
|
|
|
|
|
+ btn.setStyleSheet(tab_css)
|
|
|
|
|
+
|
|
|
|
|
+ self._btn_lang_en.setStyleSheet(lang_css)
|
|
|
|
|
+ self._btn_lang_ru.setStyleSheet(lang_css)
|
|
|
|
|
+ self._btn_theme_dark.setStyleSheet(lang_css)
|
|
|
|
|
+ self._btn_theme_light.setStyleSheet(lang_css)
|
|
|
|
|
+
|
|
|
|
|
+ sb_bg = "#0c0c1a" if dark else "#e4e4f0"
|
|
|
|
|
+ sb_color = "#555577" if dark else "#666688"
|
|
|
|
|
+ self.statusBar().setStyleSheet(
|
|
|
|
|
+ f"QStatusBar {{ background: {sb_bg}; color: {sb_color}; font-size: 11px; }}"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+ # Navigation #
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+
|
|
|
def _switch_tab(self, index: int) -> None:
|
|
def _switch_tab(self, index: int) -> None:
|
|
|
self._tabs.setCurrentIndex(index)
|
|
self._tabs.setCurrentIndex(index)
|
|
|
self._nav_tab_buttons[index].setChecked(True)
|
|
self._nav_tab_buttons[index].setChecked(True)
|
|
|
|
|
|
|
|
def _build_status_bar(self) -> None:
|
|
def _build_status_bar(self) -> None:
|
|
|
- sb = QStatusBar()
|
|
|
|
|
- sb.setStyleSheet(
|
|
|
|
|
- "QStatusBar { background: #0c0c1a; color: #555577; font-size: 11px; }"
|
|
|
|
|
|
|
+ self.setStatusBar(QStatusBar())
|
|
|
|
|
+ self.statusBar().showMessage(
|
|
|
|
|
+ f"{i18n.tr('active_tab')}: {i18n.tr(_TAB_NAV_KEYS[0])}"
|
|
|
)
|
|
)
|
|
|
- self.setStatusBar(sb)
|
|
|
|
|
- sb.showMessage(f"{i18n.tr('active_tab')}: {i18n.tr(_TAB_NAV_KEYS[0])}")
|
|
|
|
|
|
|
|
|
|
def _size_and_center(self) -> None:
|
|
def _size_and_center(self) -> None:
|
|
|
screen = QApplication.primaryScreen()
|
|
screen = QApplication.primaryScreen()
|
|
@@ -262,7 +350,7 @@ class LFMRIWindow(QMainWindow):
|
|
|
h = min(940, max(640, int(ag.height() * 0.90)))
|
|
h = min(940, max(640, int(ag.height() * 0.90)))
|
|
|
self.resize(w, h)
|
|
self.resize(w, h)
|
|
|
self.move(
|
|
self.move(
|
|
|
- ag.x() + (ag.width() - w) // 2,
|
|
|
|
|
|
|
+ ag.x() + (ag.width() - w) // 2,
|
|
|
ag.y() + (ag.height() - h) // 2,
|
|
ag.y() + (ag.height() - h) // 2,
|
|
|
)
|
|
)
|
|
|
else:
|
|
else:
|
|
@@ -296,6 +384,10 @@ class LFMRIWindow(QMainWindow):
|
|
|
if hasattr(tab, "retranslate_ui"):
|
|
if hasattr(tab, "retranslate_ui"):
|
|
|
tab.retranslate_ui()
|
|
tab.retranslate_ui()
|
|
|
|
|
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+ # Cross-tab signals #
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+
|
|
|
def _on_fid_generated(self, path: str) -> None:
|
|
def _on_fid_generated(self, path: str) -> None:
|
|
|
self._seq_tab.load_seq_file(path)
|
|
self._seq_tab.load_seq_file(path)
|
|
|
self._switch_tab(1)
|
|
self._switch_tab(1)
|
|
@@ -307,19 +399,28 @@ class LFMRIWindow(QMainWindow):
|
|
|
|
|
|
|
|
def _on_scan_raw_data_ready(self, json_path: str) -> None:
|
|
def _on_scan_raw_data_ready(self, json_path: str) -> None:
|
|
|
self._spectroscopy_tab.receive_scan_data(json_path)
|
|
self._spectroscopy_tab.receive_scan_data(json_path)
|
|
|
- # Blink the Spectroscopy nav button until the user opens the tab
|
|
|
|
|
if self._tabs.currentIndex() != _SPEC_TAB_IDX:
|
|
if self._tabs.currentIndex() != _SPEC_TAB_IDX:
|
|
|
self._spec_blink_on = False
|
|
self._spec_blink_on = False
|
|
|
self._spec_blink_timer.start()
|
|
self._spec_blink_timer.start()
|
|
|
|
|
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+ # Spectroscopy blink #
|
|
|
|
|
+ # ------------------------------------------------------------------ #
|
|
|
|
|
+
|
|
|
def _tick_spec_blink(self) -> None:
|
|
def _tick_spec_blink(self) -> None:
|
|
|
self._spec_blink_on = not self._spec_blink_on
|
|
self._spec_blink_on = not self._spec_blink_on
|
|
|
btn = self._nav_tab_buttons[_SPEC_TAB_IDX]
|
|
btn = self._nav_tab_buttons[_SPEC_TAB_IDX]
|
|
|
- btn.setStyleSheet(_SPEC_BTN_BLINK_CSS if self._spec_blink_on else _TAB_BTN_CSS)
|
|
|
|
|
|
|
+ btn.setStyleSheet(
|
|
|
|
|
+ _spec_btn_blink_css(theme.is_dark())
|
|
|
|
|
+ if self._spec_blink_on
|
|
|
|
|
+ else _tab_btn_css(theme.is_dark())
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def _stop_spec_blink(self) -> None:
|
|
def _stop_spec_blink(self) -> None:
|
|
|
self._spec_blink_timer.stop()
|
|
self._spec_blink_timer.stop()
|
|
|
- self._nav_tab_buttons[_SPEC_TAB_IDX].setStyleSheet(_TAB_BTN_CSS)
|
|
|
|
|
|
|
+ self._nav_tab_buttons[_SPEC_TAB_IDX].setStyleSheet(
|
|
|
|
|
+ _tab_btn_css(theme.is_dark())
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
class _VSep(QFrame):
|
|
class _VSep(QFrame):
|