mantidimaging.gui.windows.spectrum_viewer.roi_table_model module

class mantidimaging.gui.windows.spectrum_viewer.roi_table_model.TableModel(data)[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.

@param data: list of lists of ROI names and colours [str, tuple(int,int,int)]

appendNewRow(roi_name: str, roi_colour: tuple)[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

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) tuple[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

sort_points()[source]

Sort table by ROI name