コード例 #1
0
 def load(self):
         # metodo para cargar la grilla con los pacientes
         pacientes = Controller.pacientes()
         self.model = QtGui.QStandardItemModel(len(pacientes), 5)
         self.model.setHorizontalHeaderItem(0, QtGui.QStandardItem(u"Rut"))
         self.model.setHorizontalHeaderItem(1, QtGui.QStandardItem
                                           (u"Nombres"))
         self.model.setHorizontalHeaderItem(2, QtGui.QStandardItem
                                           (u"Apellidos"))
         self.model.setHorizontalHeaderItem(3, QtGui.QStandardItem
                                           (u"Ficha Medica"))
         self.model.setHorizontalHeaderItem(4, QtGui.QStandardItem
                                           (u"N Horas Medicas"))
         r = 0
         for row in pacientes:
             fk_rut_paciente = row['rut']
             index = self.model.index(r, 0, QtCore.QModelIndex())
             self.model.setData(index, row['Rut'])
             index = self.model.index(r, 1, QtCore.QModelIndex())
             self.model.setData(index, row['Nombres'])
             index = self.model.index(r, 2, QtCore.QModelIndex())
             self.model.setData(index, row['Apellidos'])
             index = self.model.index(r, 3, QtCore.QModelIndex())
             self.model.setData(index, row['Ficha_Medica'])
             index = self.model.index(r, 4, QtCore.QModelIndex())
             self.model.setData(index, Controller.obtenerNCitas(fk_rut_paciente))
             r = r + 1
         self.table.setModel(self.model)
コード例 #2
0
 def load(self):
         # metodo para cargar la grilla con los medicos
         medicos = Controller.medicos()
         self.model = QtGui.QStandardItemModel(len(medicos), 5)
         self.model.setHorizontalHeaderItem(0, QtGui.QStandardItem(u"Rut"))
         self.model.setHorizontalHeaderItem(1, QtGui.QStandardItem
                                            (u"Nombres"))
         self.model.setHorizontalHeaderItem(2, QtGui.QStandardItem
                                            (u"Apellidos"))
         self.model.setHorizontalHeaderItem(3, QtGui.QStandardItem
                                            (u"Especialidad"))
         self.model.setHorizontalHeaderItem(4, QtGui.QStandardItem
                                            (u"N Horas Medicas"))
         r = 0
         for row in medicos:
             fk_rut_medico = row['rut']
             index = self.model.index(r, 0, QtCore.QModelIndex())
             self.model.setData(index, row['Rut'])
             index = self.model.index(r, 1, QtCore.QModelIndex())
             self.model.setData(index, row['Nombres'])
             index = self.model.index(r, 2, QtCore.QModelIndex())
             self.model.setData(index, row['Apellidos'])
             index = self.model.index(r, 3, QtCore.QModelIndex())
             self.model.setData(index, row['Especialidad'])
             index = self.model.index(r, 4, QtCore.QModelIndex())
             self.model.setData(index, Controller.obtenerNCitas(fk_rut_medico))
             r = r + 1
         self.table.setModel(self.model)