def __init__(self, parent=None): super(SequencerWidget, self).__init__(parent) self.splitter = QtWidgets.QSplitter(self) self.logger = logging.getLogger() self.logger.setLevel(logging.DEBUG) self.ae_view = AttributeEditor(self) self.dgnodes = [n for n in pm.ls(type='shot')] # self.list_model = DependListModel(self.dgnodes, parent=self) self.dependency_model = DependTableModel(self.dgnodes, parent=parent) self.selection_model = QtCore.QItemSelectionModel(self.dependency_model) self.list_view = QtWidgets.QListView(self) self.table_view = QtWidgets.QTableView(self) self.list_view.setModel(self.dependency_model) self.table_view.setModel(self.dependency_model) self.table_view.setSelectionModel(self.selection_model) self.list_view.setSelectionModel(self.selection_model) self.table_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.table_view.setSortingEnabled(True) self.table_view.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.cameras = cmds.ls(type='camera') self.cameras_delegate = ComboBoxDelegate(self.table_view, self.cameras) self.table_view.setItemDelegateForColumn(3, self.cameras_delegate) self.data_mapper = QtWidgets.QDataWidgetMapper() self.data_mapper.setSubmitPolicy(QtWidgets.QDataWidgetMapper.AutoSubmit) self.data_mapper.setModel(self.dependency_model) self.data_mapper.addMapping(self.ae_view.object_name_txt, 0, 'text') self.data_mapper.addMapping(self.ae_view.start_frame, 1, 'text') self.data_mapper.addMapping(self.ae_view.end_frame, 2, 'text') self.data_mapper.addMapping(self.ae_view.camera_combo, 3, "currentText") self.splitter.addWidget(self.list_view) self.splitter.addWidget(self.table_view) self.splitter.addWidget(self.ae_view) self.splitter.setStretchFactor(0, 0) self.setCentralWidget(self.splitter) self.setWindowTitle("Camera Sequencer") self.resize(800, 500) self.table_view.clicked.connect(self.set_ae_view)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.bend = Backend() self.combobox = QtWidgets.QComboBox() self.combobox.addItems([event.name for event in self.events]) self.lwidget = QtWidgets.QListWidget() # self.lwidget.setSource() # self.model = QtDataVisualization.QStand self.mapper = QtWidgets.QDataWidgetMapper() self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.combobox) self.setLayout(self.layout)
def showUpdateEmpDialog(self): """ Show upon double clicking the employee Table, should already have the current record's entries pre filled into the form. Lets try with Data mapping...later """ dlg = updateEmployee() model = self.empmodel mapper = QtWidgets.QDataWidgetMapper(dlg) mapper.setModel(model) mapper.addMapping(dlg.name, model.fieldIndex("empname")) mapper.addMapping(dlg.depart, model.fieldIndex("department")) mapper.addMapping(dlg.designation, model.fieldIndex("designation")) mapper.addMapping(dlg.salary, model.fieldIndex("salary")) mapper.addMapping(dlg.overtime, model.fieldIndex("overtimerate")) mapper.addMapping(dlg.working, model.fieldIndex("working")) mapper.addMapping(dlg.salarystruct, model.fieldIndex("salaryint")) mapper.setCurrentIndex(self.ui.empTable.currentIndex().row()) dlg.show()