예제 #1
0
    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()
예제 #2
0
    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