Skip to content

Commit

Permalink
Centralized where the color of the columns is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Apr 15, 2019
1 parent f1b1faf commit 62b1bc4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
18 changes: 14 additions & 4 deletions addie/processing/mantid/master_table/column_highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
INDEX_OF_MULTI_SCATTERING_CORRECTION,
INDEX_OF_INELASTIC_CORRECTION,
LIST_COLUMNS_TO_SEARCH_FOR_FULL_HIGHLIGTHING)
from addie.processing.mantid.master_table.tree_definition import (COLUMNS_IDENTICAL_VALUES_COLOR,
COLUMNS_SAME_VALUES_COLOR)


class ColumnHighlighting:
Expand Down Expand Up @@ -61,11 +63,19 @@ def check(self):

def apply_cell_background(self, are_all_the_same=False):
if are_all_the_same:
background_color = QtGui.QColor(255, 255, 0)
background_color_stylesheet = "rgb(255, 255, 0)"
background_color = QtGui.QColor(COLUMNS_IDENTICAL_VALUES_COLOR[0],
COLUMNS_IDENTICAL_VALUES_COLOR[1],
COLUMNS_IDENTICAL_VALUES_COLOR[2])
background_color_stylesheet = "rgb({}, {}, {})".format(COLUMNS_IDENTICAL_VALUES_COLOR[0],
COLUMNS_IDENTICAL_VALUES_COLOR[1],
COLUMNS_IDENTICAL_VALUES_COLOR[2])
else:
background_color = QtGui.QColor(255, 255, 255)
background_color_stylesheet = "rgb(255, 255, 255)"
background_color = QtGui.QColor(COLUMNS_SAME_VALUES_COLOR[0],
COLUMNS_SAME_VALUES_COLOR[1],
COLUMNS_SAME_VALUES_COLOR[2])
background_color_stylesheet = "rgb({}, {}, {})".format(COLUMNS_SAME_VALUES_COLOR[0],
COLUMNS_SAME_VALUES_COLOR[1],
COLUMNS_SAME_VALUES_COLOR[2])

for _row in np.arange(self.nbr_row):

Expand Down
3 changes: 3 additions & 0 deletions addie/processing/mantid/master_table/tree_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
user_home = expanduser("~")
CONFIG_FILE = os.path.join(user_home, '.addie_config.cfg')

COLUMNS_IDENTICAL_VALUES_COLOR = [0, 255, 255] # cyan
COLUMNS_SAME_VALUES_COLOR = [255, 25, 25] # white

COLUMN_DEFAULT_WIDTH = 90
COLUMN_DEFAULT_HEIGHT = 120
CONFIG_BUTTON_HEIGHT = 20
Expand Down

0 comments on commit 62b1bc4

Please sign in to comment.