Пример #1
0
    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
Пример #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
Пример #3
0
    def cargarviewmallas(self):
        self.modelMallas = QtSql.QSqlTableModel(self)
        self.modelMallas.setTable("malla")
        self.modelMallas.setHeaderData(2, QtCore.Qt.Horizontal,
                                       'Interna/Externa')
        listaref = self.cadenadereferencias(DAO.MallaFicha().leerMallaEnFicha(
            self.edicion))

        self.modelMallas.setFilter("idMalla  in {0}".format(listaref))
        self.modelMallas.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
        self.modelMallas.select()
        self.ui.viewMalla.setModel(self.modelMallas)

        self.ui.viewMalla.hideColumn(0)
        "Se modifica la presentacion de la informacion para que se entendible"
        for row in range(self.modelMallas.rowCount()):
            index = self.modelMallas.index(row, 2)
            estado = self.modelMallas.data(index).toBool()
            if estado == True:
                self.ui.viewMalla.model().setData(index, "INTERNA")
            else:
                self.ui.viewMalla.model().setData(index, "EXTERNA")
            pass