'Update the visible columns of the scores view.'

def updateVisibleScoreColumns(self):

    for (i, measure) in enumerate(self.measures):
        shown = self.selectedMeasures.get(measure.name)
        self.ranksView.setColumnHidden((i + 1), (not shown))
        self.ranksView.setColumnWidth((i + 1), 100)
    index = self.ranksView.horizontalHeader().sortIndicatorSection()
    if self.ranksView.isColumnHidden(index):
        self.headerState[self.rankMode] = None
    if (self.headerState[self.rankMode] is None):
        def get_sort_by_col(measures, selected_measures):
            cols = [(i + 1) for (i, m) in enumerate(measures) if (m.name in selected_measures)]
            return (cols[0] if cols else (len(measures) + 1))
        col = get_sort_by_col(self.measures, self.selected_checks)
        self.ranksView.sortByColumn(col, Qt.DescendingOrder)
        self.autoSelection()
