示例#1
0
    def refresh(self):
        #XXX USD Determine whether the revert button should be on
        self._ui.revertButton.setEnabled(False)

        # usually called upon frame change or selected attribute change
        if not self._isSet:
            return

        # attribute connections and relationship targets have no value to display
        # in the value viewer.
        if self._attribute == '':
            return

        frame = self._mainWindow._currentFrame

        # get the value of the attribute
        self._val = self._attribute.Get(frame)

        whichView = self._FindView(self._attribute)
        if whichView:
            self._ui.stackedWidget.setCurrentWidget(whichView)
            whichView.SetAttribute(self._attribute, frame)
        else:
            self._ui.stackedWidget.setCurrentWidget(self._defaultView)
            txtColor = GetAttributeColor(self._attribute, frame)

            # set text and color in the value viewer
            self._ui.valueViewer.setTextColor(txtColor)

            from scalarTypes import ToString
            rowText = ToString(self._val, self._attribute.GetTypeName())
            self._ui.valueViewer.setText(rowText)
示例#2
0
    def data(self, index, role):
        dataVal = self.val[index.row()]

        if role == QtCore.Qt.DisplayRole:
            from scalarTypes import ToString
            return "%d: %s" % (index.row(),
                               ToString(dataVal, self._scalarTypeName))

        elif role == QtCore.Qt.AccessibleTextRole:
            from scalarTypes import ToClipboard
            return ToClipboard(dataVal, self._scalarTypeName)

        return None
示例#3
0
    def data(self, index, role=QtCore.Qt.DisplayRole):
        start, _, step = self._slice.indices(len(self._arrayData))
        idx = start + index.row() * step
        dataVal = self._arrayData[idx]

        if role == QtCore.Qt.DisplayRole:
            from scalarTypes import ToString
            return str(idx) + ": " + ToString(dataVal, self._scalarTypeName)

        elif role == _ArrayAttributeModel.RawDataRole:
            return dataVal

        return None
示例#4
0
def prettyPrint(v):
    """Returns a string representing a "detailed view" of the value v.
    This string is used in the watch window"""

    # Pretty-print a dictionary
    if isinstance(v, dict):
        result = "Dictionary contents:\n"
        for pair in v.items():
            keystring = str(pair[0])
            valstring = prettyPrint(pair[1])
            result += "------\n%s:\n%s\n" % (keystring, valstring)

    # Pretty-print list
    elif isinstance(v, list):
        dialog = progressDialog("Pretty-printing list...", len(v))

        result = "[\n"
        for i in range(len(v)):
            dialog.setValue(i)
            result += str(i) + ": " + prettyPrint(v[i]) + "\n"
            if (dialog.wasCanceled()):
                return "Pretty-printing canceled"
        result += "]\n"
        dialog.done(0)

    # Pretty-print tuple
    elif isinstance(v, tuple):
        dialog = progressDialog("Pretty-printing tuple...", len(v))

        result = "(\n"
        for i in range(len(v)):
            dialog.setValue(i)
            result += str(i) + ": " + prettyPrint(v[i]) + "\n"
            if (dialog.wasCanceled()):
                return "Pretty-printing canceled"
        result += ")\n"
        dialog.done(0)
    else:
        from scalarTypes import ToString
        result = ToString(v)

    return result
示例#5
0
    def refresh(self):
        # usually called upon frame change or selected attribute change
        if not self._isSet:
            return

        # attribute connections and relationship targets have no value to display
        # in the value viewer.
        if self._attribute is None:
            return

        # If the current attribute doesn't belong to the current prim, don't
        # display its value.
        if self._attribute.GetPrimPath() != self._primPath:
            self._ui.valueViewer.setText("")
            return

        frame = self._appController._dataModel.currentFrame

        # get the value of the attribute
        if isinstance(self._attribute, Usd.Relationship):
            self._val = self._attribute.GetTargets()
        else:  # Usd.Attribute or CustomAttribute
            self._val = self._attribute.Get(frame)

        whichView = self._FindView(self._attribute)
        if whichView:
            self._ui.stackedWidget.setCurrentWidget(whichView)
            whichView.SetAttribute(self._attribute, frame)
        else:
            self._ui.stackedWidget.setCurrentWidget(self._defaultView)
            txtColor = GetPropertyColor(self._attribute, frame)

            # set text and color in the value viewer
            self._ui.valueViewer.setTextColor(txtColor)

            if isinstance(self._attribute, Usd.Relationship):
                typeName = None
            else:
                typeName = self._attribute.GetTypeName()
            rowText = ToString(self._val, typeName)
            self._ui.valueViewer.setText(rowText)