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

P11 char Qt #460

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
21 changes: 21 additions & 0 deletions mxcubeqt/bricks/desy/p11_machine_info_brick.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,24 @@ def set_value(self, values_dict):
self.lifetime_label.setText(f"{lifetime_value} hours")
self.energy_label.setText(f"{energy_value} GeV")
self.message_label.setText(f"{message_value}")

# Check if machine current is <= 99, change color
if current_value != "N/A" and float(current_value) <= 99:
Comment on lines +131 to +132
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 99? Can it be configurable or even better, got from the HO as limits?

self.set_all_labels_color("salmon")
else:
self.reset_all_labels_color()

def set_all_labels_color(self, color):
"""Set all label backgrounds to the specified color."""
self.current_label.setStyleSheet(f"background-color: {color};")
self.message_label.setStyleSheet(f"background-color: {color};")
self.lifetime_label.setStyleSheet(f"background-color: {color};")
self.energy_label.setStyleSheet(f"background-color: {color};")

def reset_all_labels_color(self):
"""Reset all label backgrounds to their default color."""
default_color = "#6cb2f8"
self.current_label.setStyleSheet(f"background-color: {default_color};")
self.message_label.setStyleSheet(f"background-color: {default_color};")
self.lifetime_label.setStyleSheet(f"background-color: {default_color};")
self.energy_label.setStyleSheet(f"background-color: {default_color};")