def updateRecordsMallas(self): try: fila = [] for col in range(self.modelMallas.columnCount()): index = self.modelMallas.index( self.ui.viewMalla.currentIndex().row(), col) fila.append(str(self.modelMallas.data(index).toString())) mal = DTO.Malla() mal.setIdMalla(fila[0]) mal.setTipo(str(fila[1])) mal.setInterno(bool(fila[2])) dialog = editarMalla.vEditarMalla() dialog.ui.leTipoMalla.setText(mal.getTipo()) dialog.ui.rbInterno.setChecked(False) if mal.getInterno(): dialog.ui.rbInterno.setChecked(True) dialog.exec_() except Exception as e: MostrarError(str(e.message)) else: if dialog.mallaEditada is not None: if (dialog.aceptado): mal.setTipo(dialog.ui.leTipoMalla.text()) mal.setInterno(dialog.ui.rbInterno.isChecked()) DAO.Malla(mal).modificarMalla() self.cargarviewmallas()
def deleteRecordsMallas(self): try: fila = [] for col in range(self.modelMallas.columnCount()): index = self.modelMallas.index( self.ui.viewMalla.currentIndex().row(), col) fila.append(str(self.modelMallas.data(index).toString())) mal = DTO.Malla() mal.setIdMalla(fila[0]) DAO.MallaFicha().eliminarReferencia(fila[0], self.edicion) DAO.Tinta(mal).eliminarTinta() except Exception as e: MostrarError(str(e.message)) else: self.cargarviewmallas() pass
def insertRecordsMallas(self): try: mal = DTO.Malla() mal.setTipo(self.ui.leTipoMallaMod.text()) if self.ui.rbInterno_2.isChecked(): mal.setInterno(True) else: mal.setInterno(False) DAO.Malla(mal).ingresarMalla() "crear referencia de forma inmediata" mf = DAO.MallaFicha() mf.setIdFicha(self.edicion) mf.setIdMalla(DAO.Malla().idUltimaMallaInsertada()) mf.insertarMallaFicha() self.cargarviewmallas() except Exception as e: MostrarError(str(e.message)) else: self.cargarviewmallas() pass