def selectVariableFromListEvent(self, modelIndex):
        item = self.varList.item(modelIndex.row())
        selectedItems = self.varList.selectedItems()

        # If the item is unselected then change the selection str back to '--'
        # and decrement all the numbers of the other selected vars that are
        # less than the number of the item that was unselected
        if item not in selectedItems:
            unselectedNum = item.getSelectNum()            
            item.updateVariableString(None)
            self.numVarsSelected -= 1
            
            for item in selectedItems:
                num = item.getSelectNum()
                if num > unselectedNum:
                    item.updateVariableString(item.getSelectNum() - 1)
        # If item is selected, change the selection str to a number
        else:
            self.numVarsSelected += 1
            item.updateVariableString(self.numVarsSelected)

        # Send signal of all selected vars to qvariableview and bring up the
        # most recently selected variable's tab
        var = item.getVariable()
        cdmsFile = item.getFile()
        selectedVars = [item.getVariable() for item in selectedItems]
        tabName = item.getVarName()
        
        if item.isQuickplotItem():
            self.emit(QtCore.SIGNAL('selectDefinedVariableEvent'), 'quickplot',
                      cdmsFile, selectedVars)
        else:
            self.emit(QtCore.SIGNAL('selectDefinedVariableEvent'), tabName,
                      cdmsFile, selectedVars)
Update the number next to the selected defined variable and
dataset/ETHPy150Open VisTrails/VisTrails/contrib/cdat/cdat_window.py/QDefinedVariable.selectVariableFromListEvent