Skip to content

Commit

Permalink
Implemented shape column. This refs #134
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Apr 16, 2019
1 parent fceb529 commit 1182c08
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions addie/processing/mantid/master_table/column_highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def apply_cell_background(self, are_all_the_same=False):
COLUMNS_SAME_VALUES_COLOR[1],
COLUMNS_SAME_VALUES_COLOR[2])

pen_color = "black"
selection_color = "white"
selection_background_color = "blue"

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

if (self.column in INDEX_OF_COLUMNS_WITH_CHEMICAL_FORMULA) or \
Expand All @@ -101,9 +105,18 @@ def apply_cell_background(self, are_all_the_same=False):
(self.column == LIST_COLUMNS_TO_SEARCH_FOR_FULL_HIGHLIGTHING):
main_widget = self.main_window.processing_ui.h3_table.cellWidget(_row, self.column)
main_widget.setAutoFillBackground(True)
main_widget.setStyleSheet("background-color: {};".format(background_color_stylesheet))
# main_widget.setStyleSheet("background-color: {};".format(background_color_stylesheet))
else:
self.main_window.processing_ui.h3_table.item(_row, self.column).setBackground(background_color)
main_widget.setAutoFillBackground(False)
# main_widget.setStyleSheet("background-color: {};".format(background_color_stylesheet))
# self.main_window.processing_ui.h3_table.item(_row, self.column).setBackground(background_color)
main_widget.setStyleSheet("color: {}; "
"background-color: {};"
"selection-color: {};"
"selection-background-color: {};".format(pen_color,
background_color_stylesheet,
selection_color,
selection_background_color))

def are_cells_identical(self):
def _get_item_value(row=-1, column=-1):
Expand Down Expand Up @@ -133,6 +146,11 @@ def are_mass_density_identical(self):
return True

def are_shape_identical(self):
ref_value = self._get_shape_value(row=0)
for _row in np.arange(1, self.nbr_row):
_value = self._get_shape_value(row=_row)
if _value != ref_value:
return False
return True

def are_geometry_identical(self):
Expand All @@ -149,8 +167,8 @@ def are_align_and_focus_args_identical(self):

def _get_master_table_list_ui_for_row(self, row=-1):
o_utilities = Utilities(parent=self.main_window)
key_row = o_utilities.get_row_key_from_row_index(row=row)
master_table_list_ui = self.main_window.master_table_list_ui[key_row]
key_from_row = o_utilities.get_row_key_from_row_index(row=row)
master_table_list_ui = self.main_window.master_table_list_ui[key_from_row]
return master_table_list_ui

def _get_chemical_formula_widget_value(self, row=-1):
Expand All @@ -162,3 +180,9 @@ def _get_mass_density_widget_value(self, row=-1):
master_table_list_ui_for_row = self._get_master_table_list_ui_for_row(row=row)
widget_ui = master_table_list_ui_for_row[self.data_type]['mass_density']['text']
return str(widget_ui.text())

def _get_shape_value(self, row=-1):
master_table_list_ui_for_row = self._get_master_table_list_ui_for_row(row=row)
widget_ui = master_table_list_ui_for_row[self.data_type]['shape']
return str(widget_ui.currentText())

0 comments on commit 1182c08

Please sign in to comment.