def writeToMatrix(self,
                      matrix,
                      row,
                      col,
                      langDict={},
                      answerMatrix=None
                      ):
        self._store_metadata()
        startrow = row
        startcol = col
        mergeLH = 0
        mergeLV = 0
        maxWidth = 20
        endrow = row
        endcol = col
        lwidth = 10
        lheight = 1
        iwidth = 0
        iheight = 0
        if self.label:
            _TQstn = self._Tquestion(langDict)
            cell = survey_MatrixElement(row,
                                        col,
                                        _TQstn,
                                        style="styleSubHeader"
                                        )
            (lwidth, lheight) = self.getLabelSize()
            mergeLH = lwidth - 1
            mergeLV = lheight - 1
            cell.merge(mergeLH, mergeLV)
            matrix.addElement(cell)
            if self.labelLeft:
                col += lwidth
            else:
                row += lheight
            endrow = startrow + lheight
            endcol = startcol + lwidth
            if self.selectionInstructions != None:
                cell = survey_MatrixElement(row,
                                            col,
                                            survey_T(self.selectionInstructions,
                                                     langDict),
                                            style="styleInstructions")
                iheight = len(self.selectionInstructions) / maxWidth + 1
                mergeIV = iheight - 1
                cell.merge(mergeLH, mergeIV)
                matrix.addElement(cell)
                row += iheight
        list = self.getList()
        if answerMatrix != None:
            answerRow = answerMatrix.lastRow+1
            cell = survey_MatrixElement(answerRow, 0, self.question["code"],
                                        style="styleSubHeader")
            answerMatrix.addElement(cell)
            cell = survey_MatrixElement(answerRow,
                                        1,
                                        len(list),
                                        style="styleSubHeader")
            answerMatrix.addElement(cell)
            cell = survey_MatrixElement(answerRow, 2, "|#|".join(list),
                                        style="styleSubHeader")
            answerMatrix.addElement(cell)
            answerCol = 3
        wwidth = lwidth
        mergeWH = lwidth - 1
        wheight = len(list)
        if self.singleRow:
            wwidthpart = (wwidth - len(list)) / len(list)
            mergeWH = wwidthpart - 1
            wheight = 1
        for option in list:
            _TQstn = survey_T(option, langDict)
            cell = survey_MatrixElement(row,
                                        col,
                                        _TQstn,
                                        style="styleText")
            oheight = len(_TQstn) / maxWidth + 1
            cell.merge(mergeWH - 1, oheight - 1)
            matrix.addElement(cell)
            cell = survey_MatrixElement(row, col + mergeWH, "",
                                        style="styleInput")
            matrix.addElement(cell)
            if answerMatrix != None:
                cell = survey_MatrixElement(answerRow, answerCol,
                                            self.rowcol_to_cell(row, col + mergeWH),
                                            style="styleText")
                answerMatrix.addElement(cell)
                answerCol += 1
            if self.singleRow:
                col += 1 + wwidthpart
            else:
                row += oheight
        if self.singleRow:
            if endrow < row + 1:
                endrow = row + 1
            if endcol < col:
                endcol = col
        else:
            if endrow < row:
                endrow = row
            if endcol < col + 1 + mergeWH:
                endcol = col + 1 + mergeWH
        self.addPaddingAroundWidget(matrix, startrow, startcol, lwidth, lheight, wwidth, iheight+wheight)
        self.addPaddingToCell(matrix, startrow, startcol, endrow, endcol)
        endrow += self.xlsMargin[1]
        endcol += self.xlsMargin[0]
        if DEBUG:
            # Only for debugging purposes
            self.verifyCoords(endrow, endcol)
        return (endrow, endcol)

    # -------------------------------------------------------------------------
Activate scene. Try to get entities into requested state.
dataset/ETHPy150Open sahana/eden/modules/s3db/survey.py/S3QuestionTypeOptionWidget.writeToMatrix--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/scene/homeassistant.py/HomeAssistantScene.activate