def indexEnabled(self, index): row_index = index.row() column_index = index.column() node = self._node_list[row_index] if node.enabled() is False: return False column_names = self.columnNames() column_name = self.getColumnNameFromIndex(index) enabled = False if column_name == 'Enabled': enabled = True else: stepEnabled = node.stepEnabled() stepEnabled = converttypes.stringToBoolean(stepEnabled) if stepEnabled is False: enabled = False else: # The step is enabled! if column_name in ['Frames', 'Attributes']: enabled = True elif column_name == 'Strategy': # The 'strategy' column should be disabled if # 'attrs' is set to use either 'No Attributes' or # 'Animated Only'. attrs = node.attrs() if attrs in [ const.ATTR_FILTER_STATIC_ONLY_LABEL, const.ATTR_FILTER_STATIC_AND_ANIM_LABEL ]: enabled = True return enabled
def setStepEnabled(self, value): v = converttypes.stringToBoolean(value) if v is None: return n = self.stepNode() n.set_enabled(v) self.setStepNode(n) return
def indexEnabled(self, index): """ Control if the given index is enabled or not. """ row_index = index.row() column_index = index.column() node = self._node_list[row_index] if node.enabled() is False: return False column_names = self.columnNames() column_name = self.getColumnNameFromIndex(index) enabled = False if column_name == const.SOLVER_COLUMN_NAME_ENABLED: return True else: stepEnabled = node.stepEnabled() stepEnabled = converttypes.stringToBoolean(stepEnabled) if stepEnabled is False: return False # The step is enabled! if column_name in [ const.SOLVER_COLUMN_NAME_FRAMES, const.SOLVER_COLUMN_NAME_ATTRIBUTES ]: enabled = True elif column_name == const.SOLVER_COLUMN_NAME_STRATEGY: # The 'strategy' column should be disabled if # 'attrs' is set to use either 'No Attributes' or # 'Animated Only'. attrs = node.attrs() if attrs in [ const.ATTR_FILTER_STATIC_ONLY_LABEL, const.ATTR_FILTER_STATIC_AND_ANIM_LABEL ]: enabled = True # When 'Override Current Frame' is on, frames and strategy # should be editable. if column_name in [ const.SOLVER_COLUMN_NAME_FRAMES, const.SOLVER_COLUMN_NAME_STRATEGY ]: col = node.collectionNode() cur_frame = lib_collection.get_override_current_frame_from_collection( col) if cur_frame is True: return False return enabled
def data(self, index, role): if not index.isValid(): return None row_index = index.row() node = self._node_list[row_index] roles = [ QtCore.Qt.DisplayRole, QtCore.Qt.EditRole, QtCore.Qt.CheckStateRole, ] if role in roles: get_attr_func = self.getGetAttrFuncFromIndex(index) value = None if get_attr_func is not None: value = get_attr_func() # For check states, we must return a 'CheckState' of # Checked or Unchecked. if role == QtCore.Qt.CheckStateRole: index_checkable = self.indexCheckable(index) if index_checkable is True: value = converttypes.stringToBoolean(value) if isinstance(value, bool): value = converttypes.booleanToCheckState(value) else: # If the column is not checkable we make sure it's # not displayed as checkable by returning a # 'None' value = None # value may be bool, string or None type. return value if role == QtCore.Qt.DecorationRole: if index.column() == 0 and node is not None: return self.indexIcon(index) if role == QtCore.Qt.ToolTipRole: if node is not None: return node.toolTip() if role == QtCore.Qt.StatusTipRole: if node is not None: return node.statusTip() if role == QtCore.Qt.FontRole: if self._font is not None: return self._font return