Skip to content
Snippets Groups Projects
Commit 46e266ba authored by Lan Dam's avatar Lan Dam
Browse files

change changed status's color to blue

parent cf4192a3
No related branches found
No related tags found
1 merge request!293change changed status's color to blue
......@@ -12,6 +12,7 @@ from sohstationviewer.view.db_config.value_color_helper.value_color_edit \
import ValueColorEdit
from sohstationviewer.view.util.one_instance_at_a_time import \
OneWindowAtATimeDialog
from sohstationviewer.view.util.color import COLOR
class DeleteRowButton(QtWidgets.QPushButton):
......@@ -77,14 +78,16 @@ def set_widget_color(widget, changed=False, read_only=False):
palette.setColor(QtGui.QPalette.ColorRole.Base,
QtGui.QColor(255, 255, 255))
if changed:
# red text
# blue text
palette.setColor(QtGui.QPalette.ColorRole.Text,
QtGui.QColor(255, 0, 0))
QtGui.QColor(COLOR['changedStatus']))
# The selected text in a QComboBox on Linux has ButtonText as its color
# role (probably because the QComboBox on Linux looks like one button,
# while the one on Mac looks like a TextEdit combined with a button).
palette.setColor(QtGui.QPalette.ColorRole.ButtonText,
QtGui.QColor(255, 0, 0))
QtGui.QColor(COLOR['changedStatus']))
palette.setColor(QtGui.QPalette.ColorRole.Base,
QtGui.QColor(COLOR['changedStatusBackground']))
else:
try:
if widget.isReadOnly():
......@@ -96,6 +99,8 @@ def set_widget_color(widget, changed=False, read_only=False):
# black text
palette.setColor(QtGui.QPalette.ColorRole.Text,
QtGui.QColor(0, 0, 0))
palette.setColor(QtGui.QPalette.ColorRole.Base,
QtGui.QColor(255, 255, 255))
except AttributeError:
palette.setColor(QtGui.QPalette.ColorRole.Text,
QtGui.QColor(0, 0, 0))
......
......@@ -23,6 +23,7 @@ from sohstationviewer.view.db_config.value_color_helper.functions import \
from sohstationviewer.view.db_config.param_helper import \
validate_value_color_str
from sohstationviewer.view.util.plot_type_info import plot_types
from sohstationviewer.view.util.color import COLOR
plot_types_with_value_colors = [
......@@ -129,7 +130,7 @@ class ValueColorEdit(QTextEdit):
Set border color for the widget.
:param color: color to set to border
"""
self.setStyleSheet("QTextEdit {border: 2px solid %s;}" % color)
self.setStyleSheet("QTextEdit {border: 4px solid %s;}" % color)
def set_background_color(self, background: str):
"""
......@@ -162,12 +163,12 @@ class ValueColorEdit(QTextEdit):
def set_border_color_according_to_value_color_status(self):
"""
Set border color according to current value color string.
+ Red for changed
+ Blue for changed
+ Same color as background (no border) for other case.
"""
if self.value_color_str != self.org_value_color_str:
# Show that value_color_str has been changed
self.set_border_color('red')
self.set_border_color(COLOR['changedStatus'])
else:
# Reset border the same color as background
self.set_border_color(self.background)
......@@ -187,7 +188,7 @@ class ValueColorEdit(QTextEdit):
'upDownDots': UpDownDialog,
}
# set border color blue showing that the widget is being edited
self.set_border_color('blue')
self.set_border_color(COLOR['changedStatus'])
edit_dialog = plot_type_dialog_map[self.plot_type](
self, self.value_color_str
)
......
# colors that are good for both light and dark mode
COLOR = {
'changedStatus': '#268BD2', # blue
'changedStatusBackground': "#e0ecff", # light blue
}
# Just using RGB for everything since some things don't handle color names
# correctly, like PIL on macOS doesn't handle "green" very well.
# b = dark blue, was the U value for years, but it can be hard to see, so U
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment