def on_copy(self): self.ds_model.sort(DSManagerModel.COLUMN_GROUP_DS) select_data_sources_dialog = QDialog(self) select_data_sources_dialog.setWindowTitle( self.tr("Choose source service")) layout = QVBoxLayout(select_data_sources_dialog) select_data_sources_dialog.setLayout(layout) list_view = QTreeView(self) layout.addWidget(list_view) list_view.setModel(self.ds_model) list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY, True) list_view.setAlternatingRowColors(True) list_view.header().setResizeMode(DSManagerModel.COLUMN_GROUP_DS, QHeaderView.ResizeToContents) list_view.clicked.connect( lambda index: select_data_sources_dialog.accept() \ if not self.ds_model.isGroup(index) and \ index.column() == DSManagerModel.COLUMN_GROUP_DS \ else None ) if select_data_sources_dialog.exec_() == QDialog.Accepted: data_source = self.ds_model.data(list_view.currentIndex(), Qt.UserRole) data_source.id += "_copy" edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr('Create service from existing')) edit_dialog.fill_ds_info(data_source) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_edit(self): item = self.lstServices.currentItem().data(Qt.UserRole) edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr('Edit service')) edit_dialog.set_ds_info(item) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_copy(self): self.ds_model.sort(DSManagerModel.COLUMN_GROUP_DS) select_data_sources_dialog = QDialog(self) select_data_sources_dialog.setWindowTitle(self.tr("Choose source service")) layout = QVBoxLayout(select_data_sources_dialog) select_data_sources_dialog.setLayout(layout) list_view = QTreeView(self) layout.addWidget(list_view) list_view.setModel(self.ds_model) list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY, True) list_view.setAlternatingRowColors(True) list_view.header().setResizeMode(DSManagerModel.COLUMN_GROUP_DS, QHeaderView.ResizeToContents) list_view.clicked.connect( lambda index: select_data_sources_dialog.accept() if not self.ds_model.isGroup(index) and index.column() == DSManagerModel.COLUMN_GROUP_DS else None ) if select_data_sources_dialog.exec_() == QDialog.Accepted: data_source = self.ds_model.data(list_view.currentIndex(), Qt.UserRole) data_source.id += "_copy" edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr("Create service from existing")) edit_dialog.fill_ds_info(data_source) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_edit(self): item = self.lstServices.currentItem().data(Qt.UserRole) edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr("Edit service")) edit_dialog.set_ds_info(item) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_add(self): edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr("Create service")) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_add(self): edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr('Create new user data source')) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()
def on_add(self): edit_dialog = DsEditDialog() edit_dialog.setWindowTitle(self.tr('Create service')) if edit_dialog.exec_() == QDialog.Accepted: self.feel_list() self.ds_model.resetModel()