Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNAPRed stylesheets #38670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading