mantidimaging.gui.windows.spectrum_viewer.roi_table_model module#

class mantidimaging.gui.windows.spectrum_viewer.roi_table_model.TableModel[source]#

Bases: QAbstractTableModel

A subclass of QAbstractTableModel. Model for table view of ROI names and colours in Spectrum Viewer window to allow user to select which ROIs to plot.

appendNewRow(roi_name: str, roi_colour: tuple, visible: bool)[source]#

Append new row to table

@param roi_name: ROI name @param roi_colour: ROI colour

clear_table() None[source]#

Clear all data in table except ‘roi’ (first element in _data list)

columnCount(*args, **kwargs)[source]#

Return number of columns in table

@return: number of columns in table

column_data(column: int) list[source]#

Return data from selected column

@param column: column number @return: data from selected column

data(index, role)[source]#

Set data in table roi name and colour - str and Tuple(int,int,int) and set background colour of colour column

@param index: index of selected row @param role: Qt.DisplayRole or Qt.BackgroundRole @return: ROI name or colour values and background colour of colour column

flags(index)[source]#

Handle selection of table rows to disable selection of ROI colour column if index is equal to roi, item not editable

@param index: index of selected row @return: Qt.ItemIsEnabled | Qt.ItemIsSelectable

headerData(section, orientation, role)[source]#

Set horizontal colum header names to ROI and Colour

@param section: column number @param orientation: horizontal @param role: Qt.DisplayRole @return: ROI or Colour

remove_row(row: int) None[source]#

Remove selected row from table

@param row: row number

rename_row(row: int, new_name: str) None[source]#

Rename selected row if new name does not already exist in table and is not default ‘roi’ ROI or duplicate

@param row: row number @param new_name: new ROI name @raise ValueError: if new name already exists or is default ‘roi’ ROI

roi_names() list[source]#

Return list of ROI names

@return: list of ROI names

rowCount(*args, **kwargs)[source]#

Return number of rows in table

@return: number of rows in table

row_data(row: int) list[source]#

Return data from selected row

@param row: row number @return: data from selected rows

setData(index, value, role)[source]#

Set data in table

@param index: index of selected row @param value: new value @param role: Qt.EditRole @return: True

update_color(row, new_color)[source]#