Skip to content

Commit

Permalink
Merge pull request #38774 from mantidproject/EWM9132_SNAPRed_stylesheets
Browse files Browse the repository at this point in the history
SNAPRed stylesheets
  • Loading branch information
ekapadi authored Jan 31, 2025
2 parents 2ca5c9b + ef5548d commit 21a3edf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions qt/python/mantidqtinterfaces/mantidqtinterfaces/SNAPRed.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name,unused-import
from pathlib import Path
import sys

from mantidqt.gui_helper import get_qapplication

try:
Expand All @@ -26,15 +28,18 @@
else:
parent, flags = None, None

if not within_mantid:
# set the super-awesome color scheme
from snapred.meta.Config import Resource

with Resource.open("style.qss", "r") as styleSheet:
app.setStyleSheet(styleSheet.read())
# Recent versions of SNAPRed have required stylesheet settings, but it's important to apply these
# only to the SNAPRed GUI and its children.
from snapred.meta.Config import Resource

# turn off tranlucent when running in mantid
# turn off translucent background when running in mantid
s = SNAPRedGUI(parent, window_flags=flags, translucentBackground=(not within_mantid))

# "workbench_style.qss" may not exist in all versions of SNAPRed.
qssFilePath = Resource.getPath("workbench_style.qss" if within_mantid else "style.qss")
if Path(qssFilePath).exists():
with open(qssFilePath, "r") as styleSheet:
s.setStyleSheet(styleSheet.read())
s.show()

if not within_mantid:
Expand Down

0 comments on commit 21a3edf

Please sign in to comment.