def getCurrentSelectedNodeWrappers(self): """ Returns the current selected nodeWrappers as a QObjectListModel. """ currentSelectedNodeWrappers = QObjectListModel(self) currentSelectedNodeWrappers.setObjectList([self.getGraphWrapper().getNodeWrapper(nodeName) for nodeName in self.getCurrentSelectedNodeNames()]) return currentSelectedNodeWrappers
def getQObjectPluginsIdentifiersByParentPath(self, pathname): """ Returns a QObjectListModel of all the PluginsIdentifiers (String) we expect to find after the submenu 'pathname'. """ pluginsIds = QObjectListModel(self) pluginsIds.setObjectList(tuttleTools.getPluginsIdentifiersByParentPath(pathname)) return pluginsIds
def getSrcClips(self): """ Returns a QObjectListModel of ClipWrappers of the input clips of this node. """ srcClips = QObjectListModel(self) srcClips.setObjectList([ClipWrapper(clip, self.getName(), self._view) for clip in self._node.getClips() if not clip == "Output"]) return srcClips
def getQObjectPluginsIdentifiersByParentPath(self, pathname): """ Returns a QObjectListModel of all the PluginsIdentifiers (String) we expect to find after the submenu 'pathname'. """ pluginsIds = QObjectListModel(self) pluginsIds.setObjectList( tuttleTools.getPluginsIdentifiersByParentPath(pathname)) return pluginsIds
def getSrcClips(self): """ Returns a QObjectListModel of ClipWrappers of the input clips of this node. """ srcClips = QObjectListModel(self) srcClips.setObjectList([ ClipWrapper(clip, self.getName(), self._view) for clip in self._node.getClips() if not clip == "Output" ]) return srcClips
def getCurrentSelectedNodeWrappers(self): """ Returns the current selected nodeWrappers as a QObjectListModel. """ currentSelectedNodeWrappers = QObjectListModel(self) currentSelectedNodeWrappers.setObjectList([ self.getGraphWrapper().getNodeWrapper(nodeName) for nodeName in self.getCurrentSelectedNodeNames() ]) return currentSelectedNodeWrappers
class MainWrapper(QtCore.QObject): def __init__(self, parent): super(MainWrapper, self).__init__(parent) self._clips = QObjectListModel(self) self._clips.setObjectList([ClipWrapper(parent, "Clip0", 2.2), ClipWrapper(parent, "Clip1", 10.0)]) def getClips(self): return self._clips modelChanged = QtCore.pyqtSignal() clips = QtCore.pyqtProperty(QtCore.QObject, getClips, notify=modelChanged)
class ParamEditorWrapper(QtCore.QObject): def __init__(self, parent, paramList): super(ParamEditorWrapper, self).__init__(parent) # the QObjectListModel self._paramElmts = QObjectListModel(self) # the map : correspondances between core params and wrapper params self.mapTypeToWrapper = { ParamInt: IntWrapper, ParamInt2D: Int2DWrapper, ParamInt3D: Int3DWrapper, ParamString: StringWrapper, ParamDouble: DoubleWrapper, ParamDouble2D: Double2DWrapper, ParamDouble3D: Double3DWrapper, ParamBoolean: BooleanWrapper, ParamChoice: ChoiceWrapper, ParamPushButton: PushButtonWrapper, ParamRGBA: RGBAWrapper, ParamRGB: RGBWrapper, ParamGroup: GroupWrapper, ParamPage: PageWrapper, } # the list of param wrappers self._paramListModel = [ self.mapTypeToWrapper[paramElt.__class__](paramElt) for paramElt in paramList ] # convert wrappers to qObject (for the listView) self._paramElmts.setObjectList(self._paramListModel) def getParamElts(self): """ Returns the list of params, ready for QML (QObjectListModel) """ return self._paramElmts
class MainWrapper(QtCore.QObject): def __init__(self, parent): super(MainWrapper, self).__init__(parent) self._qtParent = parent self._clips = QObjectListModel(self) self._clips.setObjectList([ ClipWrapper(self._qtParent, "Clip0", 2.2), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0) ]) def getClips(self): return self._clips @QtCore.pyqtSlot(int) def remove(self, index): print("Python : start removing element at index %s" % index) self._clips.removeAt(index) print("Python : end removing element at index %s" % index) @QtCore.pyqtSlot() def add(self): print("Python : start adding element") self._clips.append(ClipWrapper(self._qtParent, "ClipDynamic", 2.2)) print("Python : end adding element") @QtCore.pyqtSlot(int) def insertAt(self, index): print("Python : start insertAt %s element" % index) self._clips.insert(index, ClipWrapper(self._qtParent, "ClipDynamic", 2.2)) print("Python : end insertAt element") modelChanged = QtCore.pyqtSignal() clips = QtCore.pyqtProperty(QtCore.QObject, getClips, notify=modelChanged)
class MainWrapper(QtCore.QObject): def __init__(self, parent): super(MainWrapper, self).__init__(parent) self._qtParent = parent self._clips = QObjectListModel(self) self._clips.setObjectList( [ClipWrapper(self._qtParent, "Clip0", 2.2), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0), ClipWrapper(self._qtParent, "Clip1", 10.0)] ) def getClips(self): return self._clips @QtCore.pyqtSlot(int) def remove(self, index): print("Python : start removing element at index %s" % index) self._clips.removeAt(index) print("Python : end removing element at index %s" % index) @QtCore.pyqtSlot() def add(self): print("Python : start adding element") self._clips.append(ClipWrapper(self._qtParent, "ClipDynamic", 2.2) ) print("Python : end adding element") @QtCore.pyqtSlot(int) def insertAt(self, index): print("Python : start insertAt %s element" % index) self._clips.insert(index, ClipWrapper(self._qtParent, "ClipDynamic", 2.2) ) print("Python : end insertAt element") modelChanged = QtCore.pyqtSignal() clips = QtCore.pyqtProperty(QtCore.QObject, getClips, notify=modelChanged)
class ParamEditorWrapper(QtCore.QObject): def __init__(self, parent, paramList): super(ParamEditorWrapper, self).__init__(parent) # the QObjectListModel self._paramElmts = QObjectListModel(self) # the map : correspondances between core params and wrapper params self.mapTypeToWrapper = { ParamInt: IntWrapper, ParamInt2D: Int2DWrapper, ParamInt3D: Int3DWrapper, ParamString: StringWrapper, ParamDouble: DoubleWrapper, ParamDouble2D: Double2DWrapper, ParamDouble3D: Double3DWrapper, ParamBoolean: BooleanWrapper, ParamChoice: ChoiceWrapper, ParamPushButton: PushButtonWrapper, ParamRGBA: RGBAWrapper, ParamRGB: RGBWrapper, ParamGroup: GroupWrapper, ParamPage: PageWrapper, } # the list of param wrappers self._paramListModel = [self.mapTypeToWrapper[paramElt.__class__](paramElt) for paramElt in paramList] # convert wrappers to qObject (for the listView) self._paramElmts.setObjectList(self._paramListModel) def getParamElts(self): """ Returns the list of params, ready for QML (QObjectListModel) """ return self._paramElmts