| 1 | #!/usr/bin/python |
|---|
| 2 | # -*- coding: UTF8 -*- |
|---|
| 3 | # |
|---|
| 4 | ############################################################################### |
|---|
| 5 | # |
|---|
| 6 | # |
|---|
| 7 | # Sancabase - Administrador general para centros de Formación Profesional |
|---|
| 8 | # Copyleft (c) 2007 Javier Castrillo // riverplatense at gmail dot com |
|---|
| 9 | #Este programa es software libre; usted puede redistruirlo y/o modificarlo bajo |
|---|
| 10 | #los términos de la Licencia Pública General GNU, tal y como está publicada |
|---|
| 11 | #por la Free Software Foundation; ya sea la versión 2 de la Licencia, o (a su |
|---|
| 12 | #elección) cualquier versión posterior. |
|---|
| 13 | # |
|---|
| 14 | #Este programa se distribuye con la intención de ser útil, pero SIN NINGUNA |
|---|
| 15 | #GARANTÃA; incluso sin la garantÃa implÃcita de USABILIDAD O UTILIDAD PARA UN |
|---|
| 16 | #FIN PARTICULAR. Vea la Licencia Pública General GNU para más detalles. |
|---|
| 17 | # |
|---|
| 18 | #Usted deberÃa haber recibido una copia de la Licencia Pública General GNU |
|---|
| 19 | #junto a este programa; si no es asÃ, escriba a la Free Software Foundation, |
|---|
| 20 | #Inc. 675 Mass Ave, Cambridge, MA 02139, EEUU. |
|---|
| 21 | # |
|---|
| 22 | # |
|---|
| 23 | ############################################################################### |
|---|
| 24 | |
|---|
| 25 | # Imports |
|---|
| 26 | import wx |
|---|
| 27 | import sys |
|---|
| 28 | import MySQLdb |
|---|
| 29 | import wx.lib.mixins.listctrl |
|---|
| 30 | import pickle |
|---|
| 31 | import imp |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | # Clase App |
|---|
| 35 | class App(wx.App): |
|---|
| 36 | def OnInit(self): |
|---|
| 37 | frame = Frame(u'SancaBase - Administrador general para Centros de Formación Profesional (Beta)', (30, 30), (800, 600)) |
|---|
| 38 | frame.CenterOnScreen() |
|---|
| 39 | frame.Show() |
|---|
| 40 | self.SetTopWindow(frame) |
|---|
| 41 | return True |
|---|
| 42 | |
|---|
| 43 | # Clase Frame |
|---|
| 44 | class Frame(wx.Frame): |
|---|
| 45 | def __init__(self, title, pos, size): |
|---|
| 46 | wx.Frame.__init__(self, None, -1, title, pos, size) |
|---|
| 47 | |
|---|
| 48 | # Conexión a la base de datos |
|---|
| 49 | self.db = MySQLdb.connect('localhost', 'javier', 'javier', 'escuela', charset='UTF8') |
|---|
| 50 | |
|---|
| 51 | # Menúes |
|---|
| 52 | menuBar = wx.MenuBar() |
|---|
| 53 | menuArchivo = wx.Menu() |
|---|
| 54 | menuBar.Append(menuArchivo, u'&Archivo') |
|---|
| 55 | salir = menuArchivo.Append(-1, u'&Salir', u'Salir de Sancabase') |
|---|
| 56 | menuABM = wx.Menu() |
|---|
| 57 | menuBar.Append(menuABM, u'A&BM') |
|---|
| 58 | submenuAltas = wx.Menu() |
|---|
| 59 | alta_alumno = submenuAltas.Append(-1, u'&Alumnos', u'Altas de alumnos') |
|---|
| 60 | alta_curso = submenuAltas.Append(-1, u'&Cursos', u'Altas de cursos') |
|---|
| 61 | alta_instructor = submenuAltas.Append(-1, u'&Instructores', u'Altas de instructores') |
|---|
| 62 | alta_coordinador = submenuAltas.Append(-1, u'C&oordinadores', u'Altas de coordinadores') |
|---|
| 63 | alta_centro = submenuAltas.Append(-1, u'C&entros', u'Altas de Centros') |
|---|
| 64 | alta_autoridades = submenuAltas.Append(-1, u'Ad&ministrativos', u'Alta de administrativo') |
|---|
| 65 | menuABM.AppendMenu(-1, u'Altas', submenuAltas) |
|---|
| 66 | submenuModificaciones = wx.Menu() |
|---|
| 67 | mod_alumnos = submenuModificaciones.Append(-1, u'&Alumnos', u'Modificación de alumnos') |
|---|
| 68 | mod_cursos = submenuModificaciones.Append(-1, u'&Cursos', u'Modificación de cursos') |
|---|
| 69 | mod_instructor = submenuModificaciones.Append(-1, u'&Instructores', u'Modificación de instructores') |
|---|
| 70 | mod_centros = submenuModificaciones.Append(-1, u'C&entros', u'Modificación de centros') |
|---|
| 71 | mod_coord = submenuModificaciones.Append(-1, u'C&oordinadores', u'Modificación de coordinadores') |
|---|
| 72 | mod_autoridades = submenuModificaciones.Append(-1, u'Ad&ministrativos', u'Modificación de administrativos') |
|---|
| 73 | menuABM.AppendMenu(-1, u'Modificaciones', submenuModificaciones) |
|---|
| 74 | menuABM.AppendSeparator() |
|---|
| 75 | datos_centro = menuABM.Append(-1, u'&Datos del Centro', u'Datos del Centro FP') |
|---|
| 76 | menuListados = wx.Menu() |
|---|
| 77 | menuBar.Append(menuListados, u'&Listados') |
|---|
| 78 | submenuListados = wx.Menu() |
|---|
| 79 | submenuFichas = wx.Menu() |
|---|
| 80 | list_alumnos = submenuListados.Append(-1, u'A&lumnos', u'Lista los alumnos') |
|---|
| 81 | list_cursos = submenuListados.Append(-1, u'&Cursos', u'Listado de cursos') |
|---|
| 82 | list_inst = submenuListados.Append(-1, u'&Instructores', u'Listado de instructores') |
|---|
| 83 | list_coord = submenuListados.Append(-1, u'C&oordinadores', u'Listado de coordinadores') |
|---|
| 84 | list_centros = submenuListados.Append(-1, u'C&entros', u'Listado de centros de FP') |
|---|
| 85 | list_autoridades = submenuListados.Append(-1, u'A&dministrativos', u'Listado de administrativos') |
|---|
| 86 | menuListados.AppendMenu(-1, u'Listados', submenuListados) |
|---|
| 87 | ficha_alumnos = submenuFichas.Append(-1, u'A&lumnos', u'Ficha de alumno') |
|---|
| 88 | ficha_cursos = submenuFichas.Append(-1, u'C&ursos', u'Ficha de curso') |
|---|
| 89 | menuListados.AppendMenu(-1, u'Fichas', submenuFichas) |
|---|
| 90 | menuGastos = wx.Menu() |
|---|
| 91 | menuBar.Append(menuGastos, u'&Gastos') |
|---|
| 92 | gastos_nuevos_per = menuGastos.Append(-1, u'&Nuevo por perÃodo', |
|---|
| 93 | u'Abre una planilla de gastos nueva por perÃodo') |
|---|
| 94 | gastos_nuevos_proy = menuGastos.Append(-1, u'N&uevo por proyecto', |
|---|
| 95 | u'Abre una planilla de gastos nueva por proyecto') |
|---|
| 96 | menuGastos.AppendSeparator() |
|---|
| 97 | abrir_gastos_per = menuGastos.Append(-1, u'Abrir p&erÃodo', |
|---|
| 98 | u'Abre una planilla de gastos existente por perÃodo') |
|---|
| 99 | abrir_gastos_proy = menuGastos.Append(-1, u'Abrir p&royecto', |
|---|
| 100 | u'Abre una planilla de gastos existente por proyecto') |
|---|
| 101 | menuGestiones = wx.Menu() |
|---|
| 102 | menuBar.Append(menuGestiones, u'G&estiones') |
|---|
| 103 | menuGestiones.Append(-1, u'Agen&da', u'Calendario y agenda') |
|---|
| 104 | nuevagestion = menuGestiones.Append(-1, u'&Nueva gestión', u'Abre un documento en blanco') |
|---|
| 105 | menuGestiones.AppendSeparator() |
|---|
| 106 | menuGestiones.Append(-1, u'&Abrir', u'Abre un documento existente') |
|---|
| 107 | menuPlanillas = wx.Menu() |
|---|
| 108 | menuBar.Append(menuPlanillas, u'&Planillas') |
|---|
| 109 | temario = menuPlanillas.Append(-1, u'&Temario', u'Genera una planilla de temario vacÃa') |
|---|
| 110 | menuAyuda = wx.Menu() |
|---|
| 111 | menuBar.Append(menuAyuda, u'Ay&uda') |
|---|
| 112 | menuAyuda.Append(-1, u'&Ayuda...', u'Ayuda') |
|---|
| 113 | menuAyuda.AppendSeparator() |
|---|
| 114 | about = menuAyuda.Append(-1, u'A&cerca de...', u'Info de esta aplicación') |
|---|
| 115 | self.SetMenuBar(menuBar) |
|---|
| 116 | self.CreateStatusBar() |
|---|
| 117 | self.SetStatusText(u'Sancabase - Administrador de alumnos para Centros de FP') |
|---|
| 118 | |
|---|
| 119 | # Bindeo de funciones del menú |
|---|
| 120 | self.Bind(wx.EVT_MENU, self.OnExit, salir) |
|---|
| 121 | self.Bind(wx.EVT_MENU, self.OnAltaAlumno, alta_alumno) |
|---|
| 122 | self.Bind(wx.EVT_MENU, self.OnAltaCurso, alta_curso) |
|---|
| 123 | self.Bind(wx.EVT_MENU, self.OnAltaInstructor, alta_instructor) |
|---|
| 124 | self.Bind(wx.EVT_MENU, self.OnAltaCoordinador, alta_coordinador) |
|---|
| 125 | self.Bind(wx.EVT_MENU, self.OnAltaCentro, alta_centro) |
|---|
| 126 | self.Bind(wx.EVT_MENU, self.OnAltaAdministrativos, alta_autoridades) |
|---|
| 127 | self.Bind(wx.EVT_MENU, self.OnModAlumnos, mod_alumnos) |
|---|
| 128 | self.Bind(wx.EVT_MENU, self.OnModCursos,mod_cursos) |
|---|
| 129 | self.Bind(wx.EVT_MENU, self.OnModInstructores, mod_instructor) |
|---|
| 130 | self.Bind(wx.EVT_MENU, self.OnModCoordinadores, mod_coord) |
|---|
| 131 | self.Bind(wx.EVT_MENU, self.OnModCentros, mod_centros) |
|---|
| 132 | self.Bind(wx.EVT_MENU, self.OnModAdministrativos, mod_autoridades) |
|---|
| 133 | self.Bind(wx.EVT_MENU, self.OnFichaAlumnos, ficha_alumnos) |
|---|
| 134 | self.Bind(wx.EVT_MENU, self.OnFichaCursos, ficha_cursos) |
|---|
| 135 | self.Bind(wx.EVT_MENU, self.OnListAlumnos, list_alumnos) |
|---|
| 136 | self.Bind(wx.EVT_MENU, self.OnListCursos, list_cursos) |
|---|
| 137 | self.Bind(wx.EVT_MENU, self.OnListInstruc, list_inst) |
|---|
| 138 | self.Bind(wx.EVT_MENU, self.OnListCoord, list_coord) |
|---|
| 139 | self.Bind(wx.EVT_MENU, self.OnListCentros, list_centros) |
|---|
| 140 | self.Bind(wx.EVT_MENU, self.OnListAdministrativos, list_autoridades) |
|---|
| 141 | self.Bind(wx.EVT_MENU, self.OnDatosInstitucion, datos_centro) |
|---|
| 142 | self.Bind(wx.EVT_MENU, self.OnGastNuPer, gastos_nuevos_per) |
|---|
| 143 | self.Bind(wx.EVT_MENU, self.OnAbrGastPer, abrir_gastos_per) |
|---|
| 144 | self.Bind(wx.EVT_MENU, self.OnGastNuProy, gastos_nuevos_proy) |
|---|
| 145 | self.Bind(wx.EVT_MENU, self.OnAbrGastProy, abrir_gastos_proy) |
|---|
| 146 | self.Bind(wx.EVT_MENU, self.OnNuevaGestion, nuevagestion) |
|---|
| 147 | self.Bind(wx.EVT_MENU, self.OnTemario, temario) |
|---|
| 148 | self.Bind(wx.EVT_MENU, self.OnAbout, about) |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | # Salir |
|---|
| 152 | def OnExit(self, evt): |
|---|
| 153 | self.Close() |
|---|
| 154 | |
|---|
| 155 | # Alta de alumno |
|---|
| 156 | def OnAltaAlumno(self, evt): |
|---|
| 157 | try: |
|---|
| 158 | self.frame.Close() |
|---|
| 159 | finally: |
|---|
| 160 | self.frame = wx.Frame(self, -1, u'Alta de Estudiante', size=(800, 600)) |
|---|
| 161 | self.frame.CenterOnScreen() |
|---|
| 162 | panel = wx.Panel(self.frame) |
|---|
| 163 | topLbl = wx.StaticText(panel, -1, u'Alta de Estudiante') |
|---|
| 164 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 165 | apellidosLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 166 | self.apellidos = wx.TextCtrl(panel, -1, u'') |
|---|
| 167 | self.apellidos.SetFocus() |
|---|
| 168 | nombresLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 169 | self.nombres = wx.TextCtrl(panel, -1, u'') |
|---|
| 170 | sexoLbl = wx.StaticText(panel, -1, u'Sexo:') |
|---|
| 171 | StrSexo = [u'M', u'F'] |
|---|
| 172 | self.sexo = wx.ComboBox(panel, -1, u'M', (-1, -1), (-1, -1), StrSexo, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 173 | tipodocLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 174 | StrTipoDoc = [u'DNI', u'LE', u'LC', u'PAS', u'ET'] |
|---|
| 175 | self.tipodoc = wx.ComboBox(panel, -1, u'DNI', (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 176 | numdocLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 177 | self.numdoc = wx.TextCtrl(panel, -1, u'') |
|---|
| 178 | nacionalidadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 179 | StrNacionalidad = [u'AR', u'BO', u'BR', u'CL', u'CO', u'EC', u'ES', u'IT', u'PE', u'PY', u'UY', u'VE'] |
|---|
| 180 | self.nacionalidad = wx.ComboBox(panel, -1, u'AR', (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 181 | fechanacLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 182 | self.fechanac = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 183 | day = 01 |
|---|
| 184 | month = 01 |
|---|
| 185 | year = 1980 |
|---|
| 186 | dateTime = wx.DateTimeFromDMY(day, month-1, year) |
|---|
| 187 | self.fechanac.SetValue(dateTime) |
|---|
| 188 | lugarnacLbl = wx.StaticText(panel, -1, u'Lugar nac:') |
|---|
| 189 | self.lugarnac = wx.TextCtrl(panel, -1, u'') |
|---|
| 190 | datosdomLbl = wx.StaticText(panel, -1, u'Domicilio') |
|---|
| 191 | calleLbl = wx.StaticText(panel, -1, u'Calle:') |
|---|
| 192 | self.calle = wx.TextCtrl(panel, -1, u'') |
|---|
| 193 | numLbl = wx.StaticText(panel, -1, u'Número:') |
|---|
| 194 | self.num = wx.TextCtrl(panel, -1, u'') |
|---|
| 195 | pisoLbl = wx.StaticText(panel, -1, u'Piso:') |
|---|
| 196 | self.piso = wx.TextCtrl(panel, -1, u'') |
|---|
| 197 | dptoLbl = wx.StaticText(panel, -1, u'Dpto:') |
|---|
| 198 | self.dpto = wx.TextCtrl(panel, -1, u'') |
|---|
| 199 | cpLbl = wx.StaticText(panel, -1, u'Código Postal:') |
|---|
| 200 | self.cp = wx.TextCtrl(panel, -1, u'') |
|---|
| 201 | localidadLbl = wx.StaticText(panel, -1, u'Localidad:') |
|---|
| 202 | self.localidad = wx.TextCtrl(panel, -1, u'') |
|---|
| 203 | provinciaLbl = wx.StaticText(panel, -1, u'Provincia:') |
|---|
| 204 | self.provincia = wx.TextCtrl(panel, -1, u'Buenos Aires') |
|---|
| 205 | teLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 206 | self.te = wx.TextCtrl(panel, -1, u'') |
|---|
| 207 | estudiosLbl = wx.StaticText(panel, -1, u'Estudios:') |
|---|
| 208 | StrEstudios = [u'Primarios', u'Secundarios', u'Terciarios', u'Universitarios'] |
|---|
| 209 | self.estudios = wx.ComboBox(panel, -1, u'Primarios', (-1, -1), (-1, -1), StrEstudios, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 210 | hastaLbl = wx.StaticText(panel, -1, u'Hasta:') |
|---|
| 211 | StrHasta = [u'Completo', u'Primero', u'Segundo', u'Tercero', u'Cuarto', u'Quinto', u'Sexto', u'Séptimo', u'Octavo', u'Noveno',] |
|---|
| 212 | self.hasta = wx.ComboBox(panel, -1, u'', (-1, -1), (-1, -1), StrHasta, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 213 | correoLbl = wx.StaticText(panel, -1, u'E-correo:') |
|---|
| 214 | self.correo = wx.TextCtrl(panel, -1, u'') |
|---|
| 215 | tratmedLbl = wx.StaticText(panel, -1, u'Trat. méd:') |
|---|
| 216 | self.tratmed = wx.TextCtrl(panel, -1, u'', size=(150, 50), style=wx.TE_MULTILINE) |
|---|
| 217 | obsLbl = wx.StaticText(panel, -1, u'Obs:') |
|---|
| 218 | self.obs = wx.TextCtrl(panel, -1, u'', size=(100, 83), style=wx.TE_MULTILINE) |
|---|
| 219 | madreLbl = wx.StaticText(panel, -1, u'Madre:') |
|---|
| 220 | self.madre = wx.CheckBox(panel, -1, u'Vive') |
|---|
| 221 | nombmadLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 222 | self.nombmad = wx.TextCtrl(panel, -1, u'') |
|---|
| 223 | tipodocmadLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 224 | self.tipodocmad = wx.ComboBox(panel, -1, u'DNI', (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 225 | numdocmadLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 226 | self.numdocmad = wx.TextCtrl(panel, -1, u'') |
|---|
| 227 | nacmadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 228 | self.nacmad = wx.ComboBox(panel, -1, u'AR', (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 229 | fechanacmadLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 230 | self.fechanacmad = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 231 | self.fechanacmad.SetValue(dateTime) |
|---|
| 232 | ocupacionmadLbl = wx.StaticText(panel, -1, u'Ocupación:') |
|---|
| 233 | self.ocupacionmad = wx.TextCtrl(panel, -1, u'') |
|---|
| 234 | telefonomadLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 235 | self.telefonomad = wx.TextCtrl(panel, -1, u'') |
|---|
| 236 | self.textRelMad = {"Vive" : self.nombmad, "Vive" : self.tipodocmad, "Vive" : self.numdocmad, "Vive" : self.nacmad, "Vive" : self.fechanacmad, "Vive" : self.ocupacionmad, "Vive" : self.telefonomad} |
|---|
| 237 | for cadaobj in [self.nombmad, self.tipodocmad, self.numdocmad, self.nacmad, self.fechanacmad, self.ocupacionmad, self.telefonomad]: |
|---|
| 238 | cadaobj.Enable(False) |
|---|
| 239 | padreLbl = wx.StaticText(panel, -1, u'Padre:') |
|---|
| 240 | self.padre = wx.CheckBox(panel, -1, u'Vive') |
|---|
| 241 | nombpadLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 242 | self.nombpad = wx.TextCtrl(panel, -1, u'') |
|---|
| 243 | tipodocpadLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 244 | self.tipodocpad = wx.ComboBox(panel, -1, u'DNI', (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 245 | numdocpadLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 246 | self.numdocpad = wx.TextCtrl(panel, -1, u'') |
|---|
| 247 | nacpadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 248 | self.nacpad = wx.ComboBox(panel, -1, u'AR', (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 249 | fechanacpadLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 250 | self.fechanacpad = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 251 | self.fechanacpad.SetValue(dateTime) |
|---|
| 252 | ocupacionpadLbl = wx.StaticText(panel, -1, u'Ocupación:') |
|---|
| 253 | self.ocupacionpad = wx.TextCtrl(panel, -1, u'') |
|---|
| 254 | telefonopadLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 255 | self.telefonopad = wx.TextCtrl(panel, -1, u'') |
|---|
| 256 | self.textRelPad = {"Vive" : self.nombpad, "Vive" : self.tipodocpad, "Vive" : self.numdocpad, "Vive" : self.nacpad, "Vive" : self.fechanacpad, "Vive" : self.ocupacionpad, "Vive" : self.telefonopad} |
|---|
| 257 | for cadaobj in [self.nombpad, self.tipodocpad, self.numdocpad, self.nacpad, self.fechanacpad, self.ocupacionpad, self.telefonopad]: |
|---|
| 258 | cadaobj.Enable(False) |
|---|
| 259 | cancelarBtn = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 260 | aceptarBtn = wx.Button(panel, wx.ID_OK) |
|---|
| 261 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 262 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 263 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 264 | granSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 265 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 266 | datosSizer.Add(apellidosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 267 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 268 | datosSizer.Add(nombresLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 269 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 270 | datosSizer.Add(sexoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 271 | datosSizer.Add(self.sexo, 0, wx.EXPAND) |
|---|
| 272 | datosSizer.Add(tipodocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 273 | datosSizer.Add(self.tipodoc, 0, wx.EXPAND) |
|---|
| 274 | datosSizer.Add(numdocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 275 | datosSizer.Add(self.numdoc, 0, wx.EXPAND) |
|---|
| 276 | datosSizer.Add(nacionalidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 277 | datosSizer.Add(self.nacionalidad, 0, wx.EXPAND) |
|---|
| 278 | datosSizer.Add(fechanacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 279 | datosSizer.Add(self.fechanac, 0, wx.EXPAND) |
|---|
| 280 | datosSizer.Add(lugarnacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 281 | datosSizer.Add(self.lugarnac, 0, wx.EXPAND) |
|---|
| 282 | datosSizer.Add(datosdomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 283 | datosSizer.Add((10, 20)) |
|---|
| 284 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 285 | datosSizer.Add(self.calle, 0, wx.EXPAND) |
|---|
| 286 | datosSizer.Add(numLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 287 | datosSizer.Add(self.num, 0, wx.EXPAND) |
|---|
| 288 | datosSizer.Add(pisoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 289 | datosSizer.Add(self.piso, 0, wx.EXPAND) |
|---|
| 290 | datosSizer.Add(dptoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 291 | datosSizer.Add(self.dpto, 0, wx.EXPAND) |
|---|
| 292 | datosSizer.Add(cpLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 293 | datosSizer.Add(self.cp, 0, wx.EXPAND) |
|---|
| 294 | datosSizer.Add(localidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 295 | datosSizer.Add(self.localidad, 0, wx.EXPAND) |
|---|
| 296 | datosSizer.Add(provinciaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 297 | datosSizer.Add(self.provincia, 0, wx.EXPAND) |
|---|
| 298 | datosSizer.Add(teLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 299 | datosSizer.Add(self.te, 0, wx.EXPAND) |
|---|
| 300 | datosSizer2 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 301 | datosSizer2.Add(estudiosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 302 | datosSizer2.Add(self.estudios, 0, wx.EXPAND) |
|---|
| 303 | datosSizer2.Add(hastaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 304 | datosSizer2.Add(self.hasta, 0, wx.EXPAND) |
|---|
| 305 | datosSizer2.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 306 | datosSizer2.Add(self.correo, 0, wx.EXPAND) |
|---|
| 307 | datosSizer2.Add((10, 20)) |
|---|
| 308 | datosSizer2.Add((10, 20)) |
|---|
| 309 | datosSizer2.Add((10, 20)) |
|---|
| 310 | datosSizer2.Add((10, 20)) |
|---|
| 311 | datosSizer2.Add((10, 20)) |
|---|
| 312 | datosSizer2.Add((10, 20)) |
|---|
| 313 | datosSizer2.Add(madreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 314 | datosSizer2.Add(self.madre, 0, wx.EXPAND) |
|---|
| 315 | datosSizer2.Add(nombmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 316 | datosSizer2.Add(self.nombmad, 0, wx.EXPAND) |
|---|
| 317 | datosSizer2.Add(tipodocmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 318 | datosSizer2.Add(self.tipodocmad, 0, wx.EXPAND) |
|---|
| 319 | datosSizer2.Add(numdocmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 320 | datosSizer2.Add(self.numdocmad, 0, wx.EXPAND) |
|---|
| 321 | datosSizer2.Add(nacmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 322 | datosSizer2.Add(self.nacmad, 0, wx.EXPAND) |
|---|
| 323 | datosSizer2.Add(fechanacmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 324 | datosSizer2.Add(self.fechanacmad, 0, wx.EXPAND) |
|---|
| 325 | datosSizer2.Add(ocupacionmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 326 | datosSizer2.Add(self.ocupacionmad, 0, wx.EXPAND) |
|---|
| 327 | datosSizer2.Add(telefonomadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 328 | datosSizer2.Add(self.telefonomad, 0, wx.EXPAND) |
|---|
| 329 | datosSizer2.Add((10, 20)) |
|---|
| 330 | datosSizer2.Add((10, 20)) |
|---|
| 331 | datosSizer2.Add((10, 20)) |
|---|
| 332 | datosSizer2.Add(cancelarBtn, 0, wx.ALIGN_RIGHT) |
|---|
| 333 | datosSizer3 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 334 | datosSizer3.Add(tratmedLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 335 | datosSizer3.Add(self.tratmed, 0, wx.EXPAND) |
|---|
| 336 | datosSizer3.Add(obsLbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) |
|---|
| 337 | datosSizer3.Add(self.obs, 0, wx.EXPAND) |
|---|
| 338 | datosSizer3.Add((10, 20)) |
|---|
| 339 | datosSizer3.Add((10, 20)) |
|---|
| 340 | datosSizer3.Add(padreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 341 | datosSizer3.Add(self.padre, 0, wx.EXPAND) |
|---|
| 342 | datosSizer3.Add(nombpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 343 | datosSizer3.Add(self.nombpad, 0, wx.EXPAND) |
|---|
| 344 | datosSizer3.Add(tipodocpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 345 | datosSizer3.Add(self.tipodocpad, 0, wx.EXPAND) |
|---|
| 346 | datosSizer3.Add(numdocpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 347 | datosSizer3.Add(self.numdocpad, 0, wx.EXPAND) |
|---|
| 348 | datosSizer3.Add(nacpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 349 | datosSizer3.Add(self.nacpad, 0, wx.EXPAND) |
|---|
| 350 | datosSizer3.Add(fechanacpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 351 | datosSizer3.Add(self.fechanacpad, 0, wx.EXPAND) |
|---|
| 352 | datosSizer3.Add(ocupacionpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 353 | datosSizer3.Add(self.ocupacionpad, 0, wx.EXPAND) |
|---|
| 354 | datosSizer3.Add(telefonopadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 355 | datosSizer3.Add(self.telefonopad, 0, wx.EXPAND) |
|---|
| 356 | datosSizer3.Add((10, 20)) |
|---|
| 357 | datosSizer3.Add((10, 20)) |
|---|
| 358 | datosSizer3.Add((10, 20)) |
|---|
| 359 | datosSizer3.Add(aceptarBtn, 0, wx.ALIGN_LEFT) |
|---|
| 360 | granSizer.Add(datosSizer, 1, wx.EXPAND) |
|---|
| 361 | granSizer.Add(datosSizer2, 1, wx.EXPAND) |
|---|
| 362 | granSizer.Add(datosSizer3, 1, wx.EXPAND) |
|---|
| 363 | ppalSizer.Add(granSizer, 1, wx.EXPAND) |
|---|
| 364 | panel.SetSizer(ppalSizer) |
|---|
| 365 | ppalSizer.Fit(panel) |
|---|
| 366 | self.Bind(wx.EVT_CHECKBOX, self.OnviveMad, self.madre) |
|---|
| 367 | self.Bind(wx.EVT_CHECKBOX, self.OnvivePad, self.padre) |
|---|
| 368 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelarBtn) |
|---|
| 369 | self.Bind(wx.EVT_BUTTON, self.OnIngresarAlumno, aceptarBtn) |
|---|
| 370 | self.frame.Show() |
|---|
| 371 | |
|---|
| 372 | # Madre vive |
|---|
| 373 | def OnviveMad(self, event): |
|---|
| 374 | if self.madre.IsChecked(): |
|---|
| 375 | for cadaobj in [self.nombmad, self.tipodocmad, self.numdocmad, self.nacmad, self.fechanacmad, self.ocupacionmad, self.telefonomad]: |
|---|
| 376 | cadaobj.Enable(True) |
|---|
| 377 | else: |
|---|
| 378 | for cadaobj in [self.nombmad, self.tipodocmad, self.numdocmad, self.nacmad, self.fechanacmad, self.ocupacionmad, self.telefonomad]: |
|---|
| 379 | cadaobj.Enable(False) |
|---|
| 380 | |
|---|
| 381 | # Padre vive |
|---|
| 382 | def OnvivePad(self, event): |
|---|
| 383 | if self.padre.IsChecked(): |
|---|
| 384 | for cadaobj in [self.nombpad, self.tipodocpad, self.numdocpad, self.nacpad, self.fechanacpad, self.ocupacionpad, self.telefonopad]: |
|---|
| 385 | cadaobj.Enable(True) |
|---|
| 386 | else: |
|---|
| 387 | for cadaobj in [self.nombpad, self.tipodocpad, self.numdocpad, self.nacpad, self.fechanacpad, self.ocupacionpad, self.telefonopad]: |
|---|
| 388 | cadaobj.Enable(False) |
|---|
| 389 | |
|---|
| 390 | # Ingreso de alumno |
|---|
| 391 | def OnIngresarAlumno(self, event): |
|---|
| 392 | apellidos = self.apellidos.GetValue() |
|---|
| 393 | nombres = self.nombres.GetValue() |
|---|
| 394 | sexo = self.sexo.GetValue() |
|---|
| 395 | tipodoc = self.tipodoc.GetValue() |
|---|
| 396 | numdoc = self.numdoc.GetValue() |
|---|
| 397 | nacionalidad = self.nacionalidad.GetValue() |
|---|
| 398 | dia = self.fechanac.GetValue() |
|---|
| 399 | fechanac = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 400 | lugarnac = self.lugarnac.GetValue() |
|---|
| 401 | calle = self.calle.GetValue() |
|---|
| 402 | num = self.num.GetValue() |
|---|
| 403 | piso = self.piso.GetValue() |
|---|
| 404 | dpto = self.dpto.GetValue() |
|---|
| 405 | cp = self.cp.GetValue() |
|---|
| 406 | localidad = self.localidad.GetValue() |
|---|
| 407 | provincia = self.provincia.GetValue() |
|---|
| 408 | te = self.te.GetValue() |
|---|
| 409 | estudios = self.estudios.GetValue() |
|---|
| 410 | hasta = str(self.hasta.GetSelection()) |
|---|
| 411 | if hasta == u'-1': |
|---|
| 412 | hasta = u'0' |
|---|
| 413 | correo = self.correo.GetValue() |
|---|
| 414 | tratmed = self.tratmed.GetValue() |
|---|
| 415 | obs = self.obs.GetValue() |
|---|
| 416 | madre = self.madre.GetValue() |
|---|
| 417 | nombmad = self.nombmad.GetValue() |
|---|
| 418 | tipodocmad = self.tipodocmad.GetValue() |
|---|
| 419 | numdocmad = self.numdocmad.GetValue() |
|---|
| 420 | nacmad = self.nacmad.GetValue() |
|---|
| 421 | dia = self.fechanacmad.GetValue() |
|---|
| 422 | fechanacmad = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 423 | ocupacionmad = self.ocupacionmad.GetValue() |
|---|
| 424 | telefonomad = self.telefonomad.GetValue() |
|---|
| 425 | padre = self.padre.GetValue() |
|---|
| 426 | nombpad = self.nombpad.GetValue() |
|---|
| 427 | tipodocpad = self.tipodocpad.GetValue() |
|---|
| 428 | numdocpad = self.numdocpad.GetValue() |
|---|
| 429 | nacpad = self.nacpad.GetValue() |
|---|
| 430 | dia = self.fechanacpad.GetValue() |
|---|
| 431 | fechanacpad = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 432 | ocupacionpad = self.ocupacionpad.GetValue() |
|---|
| 433 | telefonopad = self.telefonopad.GetValue() |
|---|
| 434 | c = self.db.cursor() |
|---|
| 435 | c.execute('''INSERT INTO alumnos (apellidos, nombres, sexo, tipo_doc, num_doc, |
|---|
| 436 | nacionalidad, fecha_nac, lugar_nac, calle_dom, num_dom, piso_dom, dpto_dom, |
|---|
| 437 | cp_dom, localidad_dom, pcia_dom, tel_dom, estudios, hasta_est, correo, |
|---|
| 438 | nombre_madre, tipo_doc_madre, num_doc_madre, nac_madre, fecha_nac_madre, |
|---|
| 439 | ocupacion_madre, vive_madre, tel_contacto_madre, nombre_padre, tipo_doc_padre, |
|---|
| 440 | num_doc_padre, nac_padre, fecha_nac_padre, ocupacion_padre, vive_padre, |
|---|
| 441 | tel_contacto_padre, trat_medico, observaciones) VALUES (%s, %s, %s, %s, %s, |
|---|
| 442 | %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, |
|---|
| 443 | %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ''', (apellidos, nombres, |
|---|
| 444 | sexo, tipodoc, numdoc, nacionalidad, fechanac, lugarnac, calle, num, |
|---|
| 445 | piso, dpto, cp, localidad, provincia, te, estudios, hasta, |
|---|
| 446 | correo, nombmad, tipodocmad, numdocmad, nacmad, fechanacmad, |
|---|
| 447 | ocupacionmad, madre, telefonomad, nombpad, tipodocpad, |
|---|
| 448 | numdocpad, nacpad, fechanacpad, ocupacionpad, padre, |
|---|
| 449 | telefonopad, tratmed, obs)) |
|---|
| 450 | c.close() |
|---|
| 451 | self.frame.Close() |
|---|
| 452 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Alumno', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 453 | |
|---|
| 454 | # Alta de cursos |
|---|
| 455 | def OnAltaCurso(self, evt): |
|---|
| 456 | try: |
|---|
| 457 | self.frame.Close() |
|---|
| 458 | finally: |
|---|
| 459 | self.frame = wx.Frame(self, -1, u'Alta de Curso', size=(500, 350)) |
|---|
| 460 | self.frame.CenterOnScreen() |
|---|
| 461 | panel = wx.Panel(self.frame) |
|---|
| 462 | topLbl = wx.StaticText(panel, -1, u'Alta de Curso') |
|---|
| 463 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 464 | cursoLbl = wx.StaticText(panel, -1, u'Curso N°:') |
|---|
| 465 | self.numcurso = wx.TextCtrl(panel, -1, u'') |
|---|
| 466 | self.numcurso.SetFocus() |
|---|
| 467 | c = self.db.cursor() |
|---|
| 468 | c.execute('''SELECT denominacion FROM especialidades ORDER BY denominacion ASC''') |
|---|
| 469 | especialidades = c.fetchall() |
|---|
| 470 | d = len(especialidades) |
|---|
| 471 | StrEsp=[] |
|---|
| 472 | for denominacion in range(0, d): |
|---|
| 473 | StrEsp.append(especialidades[denominacion][0]) |
|---|
| 474 | especialidadLbl = wx.StaticText(panel, -1, u'Especialidad:') |
|---|
| 475 | self.especialidad = wx.ComboBox(panel, -1, u'', (-1, -1), (-1, -1), StrEsp, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 476 | tipoLbl = wx.StaticText(panel, -1, u'Tipo:') |
|---|
| 477 | self.tipo = wx.ComboBox(panel, -1, '', (-1, -1), (-1, -1), '', wx.CB_DROPDOWN) |
|---|
| 478 | instructorLbl = wx.StaticText(panel, -1, u'Instructor:') |
|---|
| 479 | c.execute('''SELECT nombres, apellidos FROM instructores ORDER BY apellidos asc''') |
|---|
| 480 | Instructores = c.fetchall() |
|---|
| 481 | d = len(Instructores) |
|---|
| 482 | StrIns=[] |
|---|
| 483 | for instructor in range (0, d): |
|---|
| 484 | StrIns.append(Instructores[instructor][0] + u' ' + Instructores[instructor][1]) |
|---|
| 485 | self.instructor = wx.ComboBox(panel, -1, '', (-1, -1), (-1, -1), StrIns, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 486 | comienzoLbl = wx.StaticText(panel, -1, u'Fecha de inicio:') |
|---|
| 487 | self.comienzo = wx.DatePickerCtrl(panel, -1, size=(120,-1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 488 | finalLbl = wx.StaticText(panel, -1, u'Fecha de finalización:') |
|---|
| 489 | self.final = wx.DatePickerCtrl(panel, -1, size=(120,-1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 490 | horasLbl = wx.StaticText(panel, -1, u'Horas reloj') |
|---|
| 491 | self.horas = wx.SpinCtrl(panel, -1) |
|---|
| 492 | self.horas.SetRange(0, 1000) |
|---|
| 493 | centroLbl = wx.StaticText(panel, -1, u'Centro:') |
|---|
| 494 | c.execute("""SELECT nombre FROM establecimientos ORDER BY id_establecimiento""") |
|---|
| 495 | centros = c.fetchall() |
|---|
| 496 | c.close() |
|---|
| 497 | d = len(centros) |
|---|
| 498 | StrCentros=[] |
|---|
| 499 | for centro in range (0, d): |
|---|
| 500 | StrCentros.append(centros[centro][0]) |
|---|
| 501 | self.centro = wx.ComboBox(panel, -1, '', (-1, -1), wx.DefaultSize, StrCentros, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 502 | asignaLbl = wx.StaticText(panel, -1, u'Asigna Alumnos') |
|---|
| 503 | self.asigna = wx.CheckBox(panel, -1, '') |
|---|
| 504 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 505 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 506 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 507 | ppalSizer.Add(topLbl, 0, wx.ALL, 9) |
|---|
| 508 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 509 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 510 | datosSizer.AddGrowableCol(1) |
|---|
| 511 | datosSizer.Add(cursoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 512 | datosSizer.Add(self.numcurso, 0, wx.EXPAND) |
|---|
| 513 | datosSizer.Add(especialidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 514 | datosSizer.Add(self.especialidad , 0, wx.EXPAND) |
|---|
| 515 | datosSizer.Add(tipoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 516 | datosSizer.Add(self.tipo, 0, wx.EXPAND) |
|---|
| 517 | datosSizer.Add(instructorLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 518 | datosSizer.Add(self.instructor, 0, wx.EXPAND) |
|---|
| 519 | datosSizer.Add(comienzoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 520 | datosSizer.Add(self.comienzo, 0, wx.EXPAND) |
|---|
| 521 | datosSizer.Add(finalLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 522 | datosSizer.Add(self.final, 0, wx.EXPAND) |
|---|
| 523 | datosSizer.Add(horasLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 524 | datosSizer.Add(self.horas, 0, wx.EXPAND) |
|---|
| 525 | datosSizer.Add(centroLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 526 | datosSizer.Add(self.centro, 0, wx.EXPAND) |
|---|
| 527 | datosSizer.Add(asignaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 528 | datosSizer.Add(self.asigna, 0, wx.EXPAND) |
|---|
| 529 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 530 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 531 | btnSizer.Add((20,20), 1) |
|---|
| 532 | btnSizer.Add(saveBtn) |
|---|
| 533 | btnSizer.Add((20,20), 1) |
|---|
| 534 | btnSizer.Add(cancelBtn) |
|---|
| 535 | btnSizer.Add((20,20), 1) |
|---|
| 536 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 537 | panel.SetSizer(ppalSizer) |
|---|
| 538 | ppalSizer.Fit(self.frame) |
|---|
| 539 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 540 | self.Bind(wx.EVT_COMBOBOX, self.OnSetEspecialidades, self.especialidad) |
|---|
| 541 | self.Bind(wx.EVT_BUTTON, self.OnIngresarCurso, saveBtn) |
|---|
| 542 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 543 | self.frame.Show() |
|---|
| 544 | |
|---|
| 545 | def OnSetEspecialidades(self, evt): |
|---|
| 546 | especialidad = self.especialidad.GetValue() |
|---|
| 547 | c = self.db.cursor() |
|---|
| 548 | c.execute('''SELECT tipo, duracion FROM especialidades WHERE denominacion = %s''', (especialidad)) |
|---|
| 549 | q = c.fetchall() |
|---|
| 550 | c.close() |
|---|
| 551 | tipo = q[0][0] |
|---|
| 552 | duracion = q[0][1] |
|---|
| 553 | self.tipo.SetValue(tipo) |
|---|
| 554 | self.horas.SetValue(duracion) |
|---|
| 555 | return |
|---|
| 556 | |
|---|
| 557 | def OnIngresarCurso(self, evt): |
|---|
| 558 | self.num_curso = self.numcurso.GetValue() |
|---|
| 559 | tipo = self.tipo.GetValue() |
|---|
| 560 | especialidad = self.especialidad.GetValue() |
|---|
| 561 | instructor = self.instructor.GetValue() |
|---|
| 562 | dia = self.comienzo.GetValue() |
|---|
| 563 | ciclo = dia.GetYear() |
|---|
| 564 | fecha_inicio = ('%04d/%02d/%02d' % (dia.GetYear(), |
|---|
| 565 | dia.GetMonth()+1, |
|---|
| 566 | dia.GetDay())) |
|---|
| 567 | dia = self.final.GetValue() |
|---|
| 568 | fecha_final = ('%04d/%02d/%02d' % (dia.GetYear(), |
|---|
| 569 | dia.GetMonth()+1, |
|---|
| 570 | dia.GetDay())) |
|---|
| 571 | horas = self.horas.GetValue() |
|---|
| 572 | establecimiento = self.centro.GetValue() |
|---|
| 573 | c = self.db.cursor() |
|---|
| 574 | # Si se quiere asignar los alumnos ahora |
|---|
| 575 | if self.asigna.IsChecked(): |
|---|
| 576 | c.execute('''SELECT id_alumno, apellidos, nombres, |
|---|
| 577 | num_doc FROM alumnos order by apellidos ASC''') |
|---|
| 578 | q = c.fetchall() |
|---|
| 579 | StrAlum = [(u'%d %s %s %s' % tuple(a)) for a in q] |
|---|
| 580 | dlg = wx.MultiChoiceDialog( self, u'Alumnos asignados al curso:', |
|---|
| 581 | u'Asignación de alumnos', StrAlum) |
|---|
| 582 | # Asigno los alumnos creando una tabla con el número de curso y la lleno |
|---|
| 583 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 584 | selections = dlg.GetSelections() |
|---|
| 585 | c.execute('''CREATE TABLE curso_%s (`id_alumno` VARCHAR(11) NOT NULL, `abandono` BOOL NOT NULL DEFAULT '0', `dia` DATE NULL, `causa` TINYTEXT NULL, PRIMARY KEY (`id_alumno`))'''% str(self.num_curso)) |
|---|
| 586 | for x in selections: |
|---|
| 587 | id_alumno = q[x][0] |
|---|
| 588 | c.execute('''INSERT INTO curso_%s (id_alumno) VALUES (%s)'''% (str(self.num_curso), id_alumno)) |
|---|
| 589 | c.execute('''INSERT INTO cursos (num_curso, tipo, especialidad, instructor, ciclo, fecha_inicio, fecha_final, horas, establecimiento) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''', (self.num_curso, tipo, especialidad, instructor, ciclo, fecha_inicio, fecha_final, horas, establecimiento)) |
|---|
| 590 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Curso %s' % self.num_curso, wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 591 | # Si me echo atrás mato todo |
|---|
| 592 | else: |
|---|
| 593 | dlg.Destroy() |
|---|
| 594 | self.frame.Close() |
|---|
| 595 | # Si no asigné alumnos creo el curso y una tabla vacÃa con el número del mismo |
|---|
| 596 | else: |
|---|
| 597 | c.execute('''CREATE TABLE curso_%s (`id_alumno` VARCHAR(11) NOT NULL, `abandono` BOOL NOT NULL DEFAULT '0', `dia` DATE NULL, `causa` TINYTEXT NULL, PRIMARY KEY (`id_alumno`));'''% str(self.num_curso)) |
|---|
| 598 | c.execute('''INSERT INTO cursos (num_curso, tipo, especialidad, instructor, ciclo, fecha_inicio, fecha_final, horas, establecimiento) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s);''', (self.num_curso, tipo, especialidad, instructor, ciclo, fecha_inicio, fecha_final, horas, establecimiento)) |
|---|
| 599 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Curso %s' % self.num_curso, |
|---|
| 600 | wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 601 | c.close() |
|---|
| 602 | self.frame.Close() |
|---|
| 603 | |
|---|
| 604 | # Alta de instructores |
|---|
| 605 | def OnAltaInstructor(self, evt): |
|---|
| 606 | try: |
|---|
| 607 | self.frame.Close() |
|---|
| 608 | finally: |
|---|
| 609 | self.frame = wx.Frame(self, -1, u'Alta de Instructor', size=(500, 350)) |
|---|
| 610 | self.frame.CenterOnScreen() |
|---|
| 611 | panel = wx.Panel(self.frame) |
|---|
| 612 | topLbl = wx.StaticText(panel, -1, u'Alta de Instructor') |
|---|
| 613 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 614 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 615 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 616 | self.apellidos.SetFocus() |
|---|
| 617 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 618 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 619 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 620 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 621 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 622 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 623 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 624 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 625 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 626 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 627 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 628 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 629 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 630 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 631 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 632 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 633 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 634 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 635 | datosSizer.AddGrowableCol(1) |
|---|
| 636 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 637 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 638 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 639 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 640 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 641 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 642 | domicilioSizer.Add(self.calle, 1) |
|---|
| 643 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 644 | domicilioSizer.Add(self.localidad) |
|---|
| 645 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 646 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 647 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 648 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 649 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 650 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 651 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 652 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 653 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 654 | btnSizer.Add((20,20), 1) |
|---|
| 655 | btnSizer.Add(saveBtn) |
|---|
| 656 | btnSizer.Add((20,20), 1) |
|---|
| 657 | btnSizer.Add(cancelBtn) |
|---|
| 658 | btnSizer.Add((20,20), 1) |
|---|
| 659 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 660 | panel.SetSizer(ppalSizer) |
|---|
| 661 | ppalSizer.Fit(self.frame) |
|---|
| 662 | self.Bind(wx.EVT_BUTTON, self.OnIngresarInstructor, saveBtn) |
|---|
| 663 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 664 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 665 | self.frame.Show() |
|---|
| 666 | |
|---|
| 667 | def OnIngresarInstructor(self, event): |
|---|
| 668 | apellidos = self.apellidos.GetValue() |
|---|
| 669 | nombres = self.nombres.GetValue() |
|---|
| 670 | calle = self.calle.GetValue() |
|---|
| 671 | numero = self.numero.GetValue() |
|---|
| 672 | localidad = self.localidad.GetValue() |
|---|
| 673 | telefono = self.telefono.GetValue() |
|---|
| 674 | celular = self.celular.GetValue() |
|---|
| 675 | correo = self.correo.GetValue() |
|---|
| 676 | c = self.db.cursor() |
|---|
| 677 | c.execute('''INSERT INTO instructores (apellidos, nombres, calle, numero, localidad, te_contacto, celular, correo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)''', (apellidos, nombres, calle, numero, localidad, telefono, celular, correo,)) |
|---|
| 678 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Instructor ', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 679 | c.close() |
|---|
| 680 | self.frame.Close() |
|---|
| 681 | |
|---|
| 682 | |
|---|
| 683 | |
|---|
| 684 | # Alta de coordinador |
|---|
| 685 | def OnAltaCoordinador(self, evt): |
|---|
| 686 | try: |
|---|
| 687 | self.frame.Close() |
|---|
| 688 | finally: |
|---|
| 689 | self.frame = wx.Frame(self, -1, u'Alta de Coordinador', size=(500, 350)) |
|---|
| 690 | self.frame.CenterOnScreen() |
|---|
| 691 | panel = wx.Panel(self.frame) |
|---|
| 692 | topLbl = wx.StaticText(panel, -1, u'Alta de Coordinador') |
|---|
| 693 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 694 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 695 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 696 | self.apellidos.SetFocus() |
|---|
| 697 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 698 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 699 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 700 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 701 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 702 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 703 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 704 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 705 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 706 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 707 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 708 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 709 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 710 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 711 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 712 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 713 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 714 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 715 | datosSizer.AddGrowableCol(1) |
|---|
| 716 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 717 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 718 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 719 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 720 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 721 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 722 | domicilioSizer.Add(self.calle, 1) |
|---|
| 723 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 724 | domicilioSizer.Add(self.localidad) |
|---|
| 725 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 726 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 727 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 728 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 729 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 730 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 731 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 732 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 733 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 734 | btnSizer.Add((20,20), 1) |
|---|
| 735 | btnSizer.Add(saveBtn) |
|---|
| 736 | btnSizer.Add((20,20), 1) |
|---|
| 737 | btnSizer.Add(cancelBtn) |
|---|
| 738 | btnSizer.Add((20,20), 1) |
|---|
| 739 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 740 | panel.SetSizer(ppalSizer) |
|---|
| 741 | ppalSizer.Fit(self.frame) |
|---|
| 742 | self.Bind(wx.EVT_BUTTON, self.OnIngresarCoordinador, saveBtn) |
|---|
| 743 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 744 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 745 | self.frame.Show() |
|---|
| 746 | |
|---|
| 747 | def OnIngresarCoordinador(self, event): |
|---|
| 748 | apellidos = self.apellidos.GetValue() |
|---|
| 749 | nombres = self.nombres.GetValue() |
|---|
| 750 | calle = self.calle.GetValue() |
|---|
| 751 | numero = self.numero.GetValue() |
|---|
| 752 | localidad = self.localidad.GetValue() |
|---|
| 753 | telefono = self.telefono.GetValue() |
|---|
| 754 | celular = self.celular.GetValue() |
|---|
| 755 | correo = self.correo.GetValue() |
|---|
| 756 | c = self.db.cursor() |
|---|
| 757 | c.execute('''INSERT INTO coordinadores (apellidos, nombres, calle, numero, localidad, te_contacto, celular, correo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)''', (apellidos, nombres, calle, numero, localidad, telefono, celular, correo,)) |
|---|
| 758 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Coordinador ', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 759 | c.close() |
|---|
| 760 | self.frame.Close() |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | # Alta de Centro |
|---|
| 764 | def OnAltaCentro(self, evt): |
|---|
| 765 | try: |
|---|
| 766 | self.frame.Close() |
|---|
| 767 | finally: |
|---|
| 768 | self.frame = wx.Frame(self, -1, u'Alta de Centro', size=(500, 350)) |
|---|
| 769 | self.frame.CenterOnScreen() |
|---|
| 770 | panel = wx.Panel(self.frame) |
|---|
| 771 | topLbl = wx.StaticText(panel, -1, u'Alta de Centro') |
|---|
| 772 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 773 | escuelaLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 774 | self.escuela = wx.TextCtrl(panel, -1, u'') |
|---|
| 775 | self.escuela.SetFocus() |
|---|
| 776 | calleLbl = wx.StaticText(panel, -1, u'Calle, N°:') |
|---|
| 777 | self.calle = wx.TextCtrl(panel, -1, u'') |
|---|
| 778 | self.numero = wx.TextCtrl(panel, -1, u'') |
|---|
| 779 | domicLbl = wx.StaticText(panel, -1, u'Localidad, CP:') |
|---|
| 780 | self.localidad = wx.TextCtrl(panel, -1, u'', size=(150,-1)) |
|---|
| 781 | self.codigo = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 782 | telLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 783 | self.telefono = wx.TextCtrl(panel, -1, u'') |
|---|
| 784 | correoLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 785 | self.correo = wx.TextCtrl(panel, -1, u'') |
|---|
| 786 | siteLbl = wx.StaticText(panel, -1, u'Web site:') |
|---|
| 787 | self.site = wx.TextCtrl(panel, -1, u'') |
|---|
| 788 | coordLbl = wx.StaticText(panel, -1, u'Coordinador') |
|---|
| 789 | c = self.db.cursor() |
|---|
| 790 | c.execute("""SELECT nombres, apellidos FROM coordinadores ORDER BY id_coordinador""") |
|---|
| 791 | coords = c.fetchall() |
|---|
| 792 | c.close() |
|---|
| 793 | StrCoord = [("%s %s" % tuple(a)) for a in coords] |
|---|
| 794 | self.coordinador = wx.ComboBox(panel, -1, '', (-1, -1), wx.DefaultSize, StrCoord, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 795 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 796 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 797 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 798 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 799 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 800 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 801 | datosSizer.AddGrowableCol(1) |
|---|
| 802 | datosSizer.Add(escuelaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 803 | datosSizer.Add(self.escuela, 1, wx.EXPAND) |
|---|
| 804 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 805 | cpSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 806 | cpSizer.Add(self.calle, 1) |
|---|
| 807 | cpSizer.Add(self.numero, 1) |
|---|
| 808 | datosSizer.Add(cpSizer, 0, wx.EXPAND) |
|---|
| 809 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 810 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 811 | domicilioSizer.Add(self.localidad, 1) |
|---|
| 812 | domicilioSizer.Add(self.codigo, 1) |
|---|
| 813 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 814 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 815 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 816 | datosSizer.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 817 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 818 | datosSizer.Add(siteLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 819 | datosSizer.Add(self.site, 0, wx.EXPAND) |
|---|
| 820 | datosSizer.Add(coordLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 821 | datosSizer.Add(self.coordinador, 0, wx.EXPAND) |
|---|
| 822 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 823 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 824 | btnSizer.Add((20,20), 1) |
|---|
| 825 | btnSizer.Add(saveBtn) |
|---|
| 826 | btnSizer.Add((20,20), 1) |
|---|
| 827 | btnSizer.Add(cancelBtn) |
|---|
| 828 | btnSizer.Add((20,20), 1) |
|---|
| 829 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 830 | panel.SetSizer(ppalSizer) |
|---|
| 831 | ppalSizer.Fit(self.frame) |
|---|
| 832 | self.Bind(wx.EVT_BUTTON, self.OnIngresarCentro, saveBtn) |
|---|
| 833 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 834 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 835 | self.frame.Show() |
|---|
| 836 | |
|---|
| 837 | def OnIngresarCentro(self, event): |
|---|
| 838 | escuela = self.escuela.GetValue() |
|---|
| 839 | calle = self.calle.GetValue() |
|---|
| 840 | numero = self.numero.GetValue() |
|---|
| 841 | localidad = self.localidad.GetValue() |
|---|
| 842 | codigo = self.codigo.GetValue() |
|---|
| 843 | telefono = self.telefono.GetValue() |
|---|
| 844 | correo = self.correo.GetValue() |
|---|
| 845 | site = self.site.GetValue() |
|---|
| 846 | coordinador = self.coordinador.GetValue() |
|---|
| 847 | c = self.db.cursor() |
|---|
| 848 | c.execute('''INSERT INTO establecimientos (nombre, calle, num_puerta, localidad, cp, telefono, correo, site, coordinador) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''', (escuela, calle, numero, localidad, codigo, telefono, correo, site, coordinador)) |
|---|
| 849 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Centro ', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 850 | c.close() |
|---|
| 851 | self.frame.Close() |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | # Alta de Administrativos |
|---|
| 855 | def OnAltaAdministrativos(self, evt): |
|---|
| 856 | try: |
|---|
| 857 | self.frame.Close() |
|---|
| 858 | finally: |
|---|
| 859 | self.frame = wx.Frame(self, -1, u'Alta de Administrativo', size=(500, 350)) |
|---|
| 860 | self.frame.CenterOnScreen() |
|---|
| 861 | panel = wx.Panel(self.frame) |
|---|
| 862 | topLbl = wx.StaticText(panel, -1, u'Alta de Administrativo') |
|---|
| 863 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 864 | cargoLbl = wx.StaticText(panel, -1, u'Cargo:') |
|---|
| 865 | StrCargos = [u'Director', u'Regente', u'Secretario', u'Preceptor'] |
|---|
| 866 | self.cargo = wx.ComboBox(panel, -1, '', (-1, -1), wx.DefaultSize, StrCargos, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 867 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 868 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 869 | self.apellidos.SetFocus() |
|---|
| 870 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 871 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 872 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 873 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 874 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 875 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 876 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 877 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 878 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 879 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 880 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 881 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 882 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 883 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 884 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 885 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 886 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 887 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 888 | datosSizer.AddGrowableCol(1) |
|---|
| 889 | datosSizer.Add(cargoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 890 | datosSizer.Add(self.cargo, 0, wx.EXPAND) |
|---|
| 891 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 892 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 893 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 894 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 895 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 896 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 897 | domicilioSizer.Add(self.calle, 1) |
|---|
| 898 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 899 | domicilioSizer.Add(self.localidad) |
|---|
| 900 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 901 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 902 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 903 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 904 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 905 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 906 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 907 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 908 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 909 | btnSizer.Add((20,20), 1) |
|---|
| 910 | btnSizer.Add(saveBtn) |
|---|
| 911 | btnSizer.Add((20,20), 1) |
|---|
| 912 | btnSizer.Add(cancelBtn) |
|---|
| 913 | btnSizer.Add((20,20), 1) |
|---|
| 914 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 915 | panel.SetSizer(ppalSizer) |
|---|
| 916 | ppalSizer.Fit(self.frame) |
|---|
| 917 | self.Bind(wx.EVT_BUTTON, self.OnIngresarAdministrativo, saveBtn) |
|---|
| 918 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 919 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 920 | self.frame.Show() |
|---|
| 921 | |
|---|
| 922 | def OnIngresarAdministrativo(self, event): |
|---|
| 923 | cargo = self.cargo.GetValue() |
|---|
| 924 | apellidos = self.apellidos.GetValue() |
|---|
| 925 | nombres = self.nombres.GetValue() |
|---|
| 926 | calle = self.calle.GetValue() |
|---|
| 927 | numero = self.numero.GetValue() |
|---|
| 928 | localidad = self.localidad.GetValue() |
|---|
| 929 | telefono = self.telefono.GetValue() |
|---|
| 930 | celular = self.celular.GetValue() |
|---|
| 931 | correo = self.correo.GetValue() |
|---|
| 932 | c = self.db.cursor() |
|---|
| 933 | c.execute('''INSERT INTO administrativos (cargo, apellidos, nombres, calle, numero, localidad, telefono, celular, correo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''', (cargo, apellidos, nombres, calle, numero, localidad, telefono, celular, correo)) |
|---|
| 934 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Administrativo ', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 935 | c.close() |
|---|
| 936 | self.frame.Close() |
|---|
| 937 | |
|---|
| 938 | |
|---|
| 939 | # Datos de la Institución |
|---|
| 940 | def OnDatosInstitucion(self, evt): |
|---|
| 941 | try: |
|---|
| 942 | self.frame.Close() |
|---|
| 943 | finally: |
|---|
| 944 | self.frame = wx.Frame(self, -1, u'Datos de la Institución', size=(500, 350)) |
|---|
| 945 | self.frame.CenterOnScreen() |
|---|
| 946 | panel = wx.Panel(self.frame) |
|---|
| 947 | topLbl = wx.StaticText(panel, -1, u'Datos de la Institución') |
|---|
| 948 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 949 | escuelaLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 950 | self.escuela = wx.TextCtrl(panel, -1, '') |
|---|
| 951 | self.escuela.SetFocus() |
|---|
| 952 | calleLbl = wx.StaticText(panel, -1, u'Calle, N°:') |
|---|
| 953 | self.calle = wx.TextCtrl(panel, -1, '') |
|---|
| 954 | self.numero = wx.TextCtrl(panel, -1, '') |
|---|
| 955 | domicLbl = wx.StaticText(panel, -1, u'Localidad, CP:') |
|---|
| 956 | self.localidad = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 957 | self.codigo = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 958 | telLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 959 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 960 | correoLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 961 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 962 | siteLbl = wx.StaticText(panel, -1, u'Web site:') |
|---|
| 963 | self.site = wx.TextCtrl(panel, -1, '') |
|---|
| 964 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 965 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 966 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 967 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 968 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 969 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 970 | datosSizer.AddGrowableCol(1) |
|---|
| 971 | datosSizer.Add(escuelaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 972 | datosSizer.Add(self.escuela, 1, wx.EXPAND) |
|---|
| 973 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 974 | cpSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 975 | cpSizer.Add(self.calle, 1) |
|---|
| 976 | cpSizer.Add(self.numero, 1) |
|---|
| 977 | datosSizer.Add(cpSizer, 0, wx.EXPAND) |
|---|
| 978 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 979 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 980 | domicilioSizer.Add(self.localidad, 1) |
|---|
| 981 | domicilioSizer.Add(self.codigo, 1) |
|---|
| 982 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 983 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 984 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 985 | datosSizer.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 986 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 987 | datosSizer.Add(siteLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 988 | datosSizer.Add(self.site, 0, wx.EXPAND) |
|---|
| 989 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 990 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 991 | btnSizer.Add((20,20), 1) |
|---|
| 992 | btnSizer.Add(saveBtn) |
|---|
| 993 | btnSizer.Add((20,20), 1) |
|---|
| 994 | btnSizer.Add(cancelBtn) |
|---|
| 995 | btnSizer.Add((20,20), 1) |
|---|
| 996 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 997 | panel.SetSizer(ppalSizer) |
|---|
| 998 | ppalSizer.Fit(self.frame) |
|---|
| 999 | self.Bind(wx.EVT_BUTTON, self.OnIngresarInstitucion, saveBtn) |
|---|
| 1000 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 1001 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 1002 | self.frame.Show() |
|---|
| 1003 | |
|---|
| 1004 | def OnIngresarInstitucion(self, event): |
|---|
| 1005 | escuela = self.escuela.GetValue() |
|---|
| 1006 | calle = self.calle.GetValue() |
|---|
| 1007 | numero = self.numero.GetValue() |
|---|
| 1008 | localidad = self.localidad.GetValue() |
|---|
| 1009 | codigo = self.codigo.GetValue() |
|---|
| 1010 | telefono = self.telefono.GetValue() |
|---|
| 1011 | correo = self.correo.GetValue() |
|---|
| 1012 | site = self.site.GetValue() |
|---|
| 1013 | c = self.db.cursor() |
|---|
| 1014 | c.execute('''INSERT INTO miescuela (nombre, calle, numpuerta, localidad, cp, telefono, correo, site) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)''', (escuela, calle, numero, localidad, codigo, telefono, correo, site)) |
|---|
| 1015 | wx.MessageBox(u'Operación realizada con éxito', u'Alta de Institución ', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1016 | c.close() |
|---|
| 1017 | self.frame.Close() |
|---|
| 1018 | |
|---|
| 1019 | |
|---|
| 1020 | # Modificación de Alumnos |
|---|
| 1021 | def OnModAlumnos(self, evt): |
|---|
| 1022 | try: |
|---|
| 1023 | self.frame.Close() |
|---|
| 1024 | finally: |
|---|
| 1025 | # Creo el diálogo para entrar el apellido del alumno a modificar |
|---|
| 1026 | self.dialog = wx.TextEntryDialog(None, u'Ingrese el Apellido del alumno', u'Modificación de alumnos', u'', style=wx.OK|wx.CANCEL) |
|---|
| 1027 | if self.dialog.ShowModal() == wx.ID_OK: |
|---|
| 1028 | self.apellido = self.dialog.GetValue() |
|---|
| 1029 | else: |
|---|
| 1030 | self.dialog.Destroy() |
|---|
| 1031 | return |
|---|
| 1032 | self.dialog.Destroy() |
|---|
| 1033 | # Creo el diálogo para seleccionar entre todos los que tienen el mismo apellido |
|---|
| 1034 | c = self.db.cursor() |
|---|
| 1035 | c.execute('''SELECT id_alumno, apellidos, nombres, num_doc FROM alumnos WHERE apellidos = %s''', (self.apellido)) |
|---|
| 1036 | q = c.fetchall() |
|---|
| 1037 | StrAlum = [("%d %s %s %s" % tuple(a)) for a in q] |
|---|
| 1038 | dlg = wx.SingleChoiceDialog(self, u'Alumnos que cumplen el criterio de búsqueda:', u'Modificación de alumnos', StrAlum) |
|---|
| 1039 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1040 | selections = dlg.GetSelection() |
|---|
| 1041 | self.alumnoAmodificar = q[selections][0] |
|---|
| 1042 | c. execute('''SELECT * FROM alumnos WHERE id_alumno = %s''', (self.alumnoAmodificar)) |
|---|
| 1043 | q = c.fetchall() |
|---|
| 1044 | c.close() |
|---|
| 1045 | self.frame = wx.Frame(self, -1, u'Modificación de estudiante %s' % q[0][1], size=(800, 600)) |
|---|
| 1046 | self.frame.CenterOnScreen() |
|---|
| 1047 | panel = wx.Panel(self.frame) |
|---|
| 1048 | topLbl = wx.StaticText(panel, -1, u'Modificación de Estudiante %s' % q[0][1]) |
|---|
| 1049 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1050 | apellidosLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 1051 | self.apellidos = wx.TextCtrl(panel, -1, q[0][1]) |
|---|
| 1052 | self.apellidos.SetFocus() |
|---|
| 1053 | nombresLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 1054 | self.nombres = wx.TextCtrl(panel, -1, q[0][2]) |
|---|
| 1055 | sexoLbl = wx.StaticText(panel, -1, u'Sexo:') |
|---|
| 1056 | StrSexo = [u'M', u'F'] |
|---|
| 1057 | self.sexo = wx.ComboBox(panel, -1, q[0][3], (-1, -1), (-1, -1), StrSexo, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1058 | tipodocLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 1059 | StrTipoDoc = [u'DNI', u'LE', u'LC', u'ET'] |
|---|
| 1060 | self.tipodoc = wx.ComboBox(panel, -1, q[0][4], (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1061 | numdocLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 1062 | self.numdoc = wx.TextCtrl(panel, -1, q[0][5]) |
|---|
| 1063 | nacionalidadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 1064 | StrNacionalidad = [u'AR', u'BO', u'BR', u'CH', u'CO', u'EC', u'ES', u'IT', u'PE', u'PY', u'UY', u'VE'] |
|---|
| 1065 | self.nacionalidad = wx.ComboBox(panel, -1, q[0][6], (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 1066 | fechanacLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 1067 | self.fechanac = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 1068 | nac = q[0][7] |
|---|
| 1069 | dia = nac.day |
|---|
| 1070 | mes = nac.month |
|---|
| 1071 | anio = nac.year |
|---|
| 1072 | nacimiento = wx.DateTimeFromDMY(dia,mes-1,anio) |
|---|
| 1073 | self.fechanac.SetValue(nacimiento) |
|---|
| 1074 | lugarnacLbl = wx.StaticText(panel, -1, u'Lugar nac:') |
|---|
| 1075 | self.lugarnac = wx.TextCtrl(panel, -1, q[0][8]) |
|---|
| 1076 | datosdomLbl = wx.StaticText(panel, -1, u'Domicilio') |
|---|
| 1077 | calleLbl = wx.StaticText(panel, -1, u'Calle:') |
|---|
| 1078 | self.calle = wx.TextCtrl(panel, -1, q[0][9]) |
|---|
| 1079 | numLbl = wx.StaticText(panel, -1, u'Número:') |
|---|
| 1080 | self.num = wx.TextCtrl(panel, -1, q[0][10]) |
|---|
| 1081 | pisoLbl = wx.StaticText(panel, -1, u'Piso:') |
|---|
| 1082 | self.piso = wx.TextCtrl(panel, -1, q[0][11]) |
|---|
| 1083 | dptoLbl = wx.StaticText(panel, -1, u'Dpto:') |
|---|
| 1084 | self.dpto = wx.TextCtrl(panel, -1, q[0][12]) |
|---|
| 1085 | cpLbl = wx.StaticText(panel, -1, u'Código Postal:') |
|---|
| 1086 | self.cp = wx.TextCtrl(panel, -1, q[0][13]) |
|---|
| 1087 | localidadLbl = wx.StaticText(panel, -1, u'Localidad:') |
|---|
| 1088 | self.localidad = wx.TextCtrl(panel, -1, q[0][14]) |
|---|
| 1089 | provinciaLbl = wx.StaticText(panel, -1, u'Provincia:') |
|---|
| 1090 | self.provincia = wx.TextCtrl(panel, -1, q[0][15]) |
|---|
| 1091 | teLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 1092 | self.te = wx.TextCtrl(panel, -1, q[0][16]) |
|---|
| 1093 | estudiosLbl = wx.StaticText(panel, -1, u'Estudios:') |
|---|
| 1094 | StrEstudios = [u'Primarios', u'Secundarios', u'Terciarios', u'Universitarios'] |
|---|
| 1095 | self.estudios = wx.ComboBox(panel, -1, q[0][17], (-1, -1), (-1, -1), StrEstudios, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1096 | hastaLbl = wx.StaticText(panel, -1, u'Hasta:') |
|---|
| 1097 | StrHasta = [u'Completo', u'Primero', u'Segundo', u'Tercero', u'Cuarto', u'Quinto', u'Sexto', u'Séptimo', u'Octavo', u'Noveno',] |
|---|
| 1098 | self.hasta = wx.ComboBox(panel, -1, q[0][18], (-1, -1), (-1, -1), StrHasta, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1099 | correoLbl = wx.StaticText(panel, -1, u'E-correo:') |
|---|
| 1100 | self.correo = wx.TextCtrl(panel, -1, q[0][19]) |
|---|
| 1101 | tratmedLbl = wx.StaticText(panel, -1, u'Trat. méd:') |
|---|
| 1102 | self.tratmed = wx.TextCtrl(panel, -1, u'', size=(150, 50), style=wx.TE_MULTILINE) |
|---|
| 1103 | obsLbl = wx.StaticText(panel, -1, u'Obs:') |
|---|
| 1104 | self.obs = wx.TextCtrl(panel, -1, u'', size=(100, 83), style=wx.TE_MULTILINE) |
|---|
| 1105 | madreLbl = wx.StaticText(panel, -1, u'Madre:') |
|---|
| 1106 | self.madre = wx.CheckBox(panel, -1, u'Vive') |
|---|
| 1107 | nombmadLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 1108 | self.nombmad = wx.TextCtrl(panel, -1, q[0][20]) |
|---|
| 1109 | tipodocmadLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 1110 | self.tipodocmad = wx.ComboBox(panel, -1, q[0][21], (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1111 | numdocmadLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 1112 | self.numdocmad = wx.TextCtrl(panel, -1, q[0][22]) |
|---|
| 1113 | nacmadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 1114 | self.nacmad = wx.ComboBox(panel, -1, q[0][23], (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 1115 | fechanacmadLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 1116 | self.fechanacmad = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 1117 | nac = q[0][24] |
|---|
| 1118 | dia = nac.day |
|---|
| 1119 | mes = nac.month |
|---|
| 1120 | anio = nac.year |
|---|
| 1121 | nacimiento = wx.DateTimeFromDMY(dia,mes-1,anio) |
|---|
| 1122 | print nacimiento |
|---|
| 1123 | self.fechanacmad.SetValue(nacimiento) |
|---|
| 1124 | ocupacionmadLbl = wx.StaticText(panel, -1, u'Ocupación:') |
|---|
| 1125 | self.ocupacionmad = wx.TextCtrl(panel, -1, q[0][25]) |
|---|
| 1126 | telefonomadLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 1127 | self.telefonomad = wx.TextCtrl(panel, -1, q[0][27]) |
|---|
| 1128 | self.textRelMad = {"Vive" : self.nombmad, "Vive" : self.tipodocmad, "Vive" : self.numdocmad, "Vive" : self.nacmad, "Vive" : self.fechanacmad, "Vive" : self.ocupacionmad, "Vive" : self.telefonomad} |
|---|
| 1129 | if q[0][26] == 1: |
|---|
| 1130 | self.madre.SetValue(True) |
|---|
| 1131 | for cadaobj in [self.nombmad, self.tipodocmad, self.numdocmad, self.nacmad, self.fechanacmad, self.ocupacionmad, self.telefonomad]: |
|---|
| 1132 | cadaobj.Enable(True) |
|---|
| 1133 | else: |
|---|
| 1134 | for cadaobj in [self.nombmad, self.tipodocmad, self.numdocmad, self.nacmad, self.fechanacmad, self.ocupacionmad, self.telefonomad]: |
|---|
| 1135 | cadaobj.Enable(False) |
|---|
| 1136 | padreLbl = wx.StaticText(panel, -1, u'Padre:') |
|---|
| 1137 | self.padre = wx.CheckBox(panel, -1, u'Vive') |
|---|
| 1138 | nombpadLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 1139 | self.nombpad = wx.TextCtrl(panel, -1, q[0][28]) |
|---|
| 1140 | tipodocpadLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 1141 | self.tipodocpad = wx.ComboBox(panel, -1, q[0][29], (-1, -1), (-1, -1), StrTipoDoc, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1142 | numdocpadLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 1143 | self.numdocpad = wx.TextCtrl(panel, -1, q[0][30]) |
|---|
| 1144 | nacpadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 1145 | self.nacpad = wx.ComboBox(panel, -1, q[0][31], (-1, -1), (-1, -1), StrNacionalidad, wx.CB_DROPDOWN) |
|---|
| 1146 | fechanacpadLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 1147 | self.fechanacpad = wx.DatePickerCtrl(panel, -1, size=(-1,-1), pos=(-1, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) |
|---|
| 1148 | nac = q[0][32] |
|---|
| 1149 | dia = nac.day |
|---|
| 1150 | mes = nac.month |
|---|
| 1151 | anio = nac.year |
|---|
| 1152 | nacimiento = wx.DateTimeFromDMY(dia,mes-1,anio) |
|---|
| 1153 | self.fechanacpad.SetValue(nacimiento) |
|---|
| 1154 | ocupacionpadLbl = wx.StaticText(panel, -1, u'Ocupación:') |
|---|
| 1155 | self.ocupacionpad = wx.TextCtrl(panel, -1, q[0][33]) |
|---|
| 1156 | telefonopadLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 1157 | self.telefonopad = wx.TextCtrl(panel, -1, q[0][35]) |
|---|
| 1158 | self.textRelPad = {"Vive" : self.nombpad, "Vive" : self.tipodocpad, "Vive" : self.numdocpad, "Vive" : self.nacpad, "Vive" : self.fechanacpad, "Vive" : self.ocupacionpad, "Vive" : self.telefonopad} |
|---|
| 1159 | if q[0][34] == 1: |
|---|
| 1160 | self.padre.SetValue(True) |
|---|
| 1161 | for cadaobj in [self.nombpad, self.tipodocpad, self.numdocpad, self.nacpad, self.fechanacpad, self.ocupacionpad, self.telefonopad]: |
|---|
| 1162 | cadaobj.Enable(True) |
|---|
| 1163 | else: |
|---|
| 1164 | for cadaobj in [self.nombpad, self.tipodocpad, self.numdocpad, self.nacpad, self.fechanacpad, self.ocupacionpad, self.telefonopad]: |
|---|
| 1165 | cadaobj.Enable(False) |
|---|
| 1166 | cancelarBtn = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 1167 | aceptarBtn = wx.Button(panel, wx.ID_OK) |
|---|
| 1168 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 1169 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 1170 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 1171 | granSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1172 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1173 | datosSizer.Add(apellidosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1174 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 1175 | datosSizer.Add(nombresLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1176 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 1177 | datosSizer.Add(sexoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1178 | datosSizer.Add(self.sexo, 0, wx.EXPAND) |
|---|
| 1179 | datosSizer.Add(tipodocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1180 | datosSizer.Add(self.tipodoc, 0, wx.EXPAND) |
|---|
| 1181 | datosSizer.Add(numdocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1182 | datosSizer.Add(self.numdoc, 0, wx.EXPAND) |
|---|
| 1183 | datosSizer.Add(nacionalidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1184 | datosSizer.Add(self.nacionalidad, 0, wx.EXPAND) |
|---|
| 1185 | datosSizer.Add(fechanacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1186 | datosSizer.Add(self.fechanac, 0, wx.EXPAND) |
|---|
| 1187 | datosSizer.Add(lugarnacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1188 | datosSizer.Add(self.lugarnac, 0, wx.EXPAND) |
|---|
| 1189 | datosSizer.Add(datosdomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1190 | datosSizer.Add((10, 20)) |
|---|
| 1191 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1192 | datosSizer.Add(self.calle, 0, wx.EXPAND) |
|---|
| 1193 | datosSizer.Add(numLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1194 | datosSizer.Add(self.num, 0, wx.EXPAND) |
|---|
| 1195 | datosSizer.Add(pisoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1196 | datosSizer.Add(self.piso, 0, wx.EXPAND) |
|---|
| 1197 | datosSizer.Add(dptoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1198 | datosSizer.Add(self.dpto, 0, wx.EXPAND) |
|---|
| 1199 | datosSizer.Add(cpLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1200 | datosSizer.Add(self.cp, 0, wx.EXPAND) |
|---|
| 1201 | datosSizer.Add(localidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1202 | datosSizer.Add(self.localidad, 0, wx.EXPAND) |
|---|
| 1203 | datosSizer.Add(provinciaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1204 | datosSizer.Add(self.provincia, 0, wx.EXPAND) |
|---|
| 1205 | datosSizer.Add(teLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1206 | datosSizer.Add(self.te, 0, wx.EXPAND) |
|---|
| 1207 | datosSizer2 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1208 | datosSizer2.Add(estudiosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1209 | datosSizer2.Add(self.estudios, 0, wx.EXPAND) |
|---|
| 1210 | datosSizer2.Add(hastaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1211 | datosSizer2.Add(self.hasta, 0, wx.EXPAND) |
|---|
| 1212 | datosSizer2.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1213 | datosSizer2.Add(self.correo, 0, wx.EXPAND) |
|---|
| 1214 | datosSizer2.Add((10, 20)) |
|---|
| 1215 | datosSizer2.Add((10, 20)) |
|---|
| 1216 | datosSizer2.Add((10, 20)) |
|---|
| 1217 | datosSizer2.Add((10, 20)) |
|---|
| 1218 | datosSizer2.Add((10, 20)) |
|---|
| 1219 | datosSizer2.Add((10, 20)) |
|---|
| 1220 | datosSizer2.Add(madreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1221 | datosSizer2.Add(self.madre, 0, wx.EXPAND) |
|---|
| 1222 | datosSizer2.Add(nombmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1223 | datosSizer2.Add(self.nombmad, 0, wx.EXPAND) |
|---|
| 1224 | datosSizer2.Add(tipodocmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1225 | datosSizer2.Add(self.tipodocmad, 0, wx.EXPAND) |
|---|
| 1226 | datosSizer2.Add(numdocmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1227 | datosSizer2.Add(self.numdocmad, 0, wx.EXPAND) |
|---|
| 1228 | datosSizer2.Add(nacmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1229 | datosSizer2.Add(self.nacmad, 0, wx.EXPAND) |
|---|
| 1230 | datosSizer2.Add(fechanacmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1231 | datosSizer2.Add(self.fechanacmad, 0, wx.EXPAND) |
|---|
| 1232 | datosSizer2.Add(ocupacionmadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1233 | datosSizer2.Add(self.ocupacionmad, 0, wx.EXPAND) |
|---|
| 1234 | datosSizer2.Add(telefonomadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1235 | datosSizer2.Add(self.telefonomad, 0, wx.EXPAND) |
|---|
| 1236 | datosSizer2.Add((10, 20)) |
|---|
| 1237 | datosSizer2.Add((10, 20)) |
|---|
| 1238 | datosSizer2.Add((10, 20)) |
|---|
| 1239 | datosSizer2.Add(cancelarBtn, 0, wx.ALIGN_RIGHT) |
|---|
| 1240 | datosSizer3 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1241 | datosSizer3.Add(tratmedLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1242 | datosSizer3.Add(self.tratmed, 0, wx.EXPAND) |
|---|
| 1243 | datosSizer3.Add(obsLbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1244 | datosSizer3.Add(self.obs, 0, wx.EXPAND) |
|---|
| 1245 | datosSizer3.Add((10, 20)) |
|---|
| 1246 | datosSizer3.Add((10, 20)) |
|---|
| 1247 | datosSizer3.Add(padreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1248 | datosSizer3.Add(self.padre, 0, wx.EXPAND) |
|---|
| 1249 | datosSizer3.Add(nombpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1250 | datosSizer3.Add(self.nombpad, 0, wx.EXPAND) |
|---|
| 1251 | datosSizer3.Add(tipodocpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1252 | datosSizer3.Add(self.tipodocpad, 0, wx.EXPAND) |
|---|
| 1253 | datosSizer3.Add(numdocpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1254 | datosSizer3.Add(self.numdocpad, 0, wx.EXPAND) |
|---|
| 1255 | datosSizer3.Add(nacpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1256 | datosSizer3.Add(self.nacpad, 0, wx.EXPAND) |
|---|
| 1257 | datosSizer3.Add(fechanacpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1258 | datosSizer3.Add(self.fechanacpad, 0, wx.EXPAND) |
|---|
| 1259 | datosSizer3.Add(ocupacionpadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1260 | datosSizer3.Add(self.ocupacionpad, 0, wx.EXPAND) |
|---|
| 1261 | datosSizer3.Add(telefonopadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1262 | datosSizer3.Add(self.telefonopad, 0, wx.EXPAND) |
|---|
| 1263 | datosSizer3.Add((10, 20)) |
|---|
| 1264 | datosSizer3.Add((10, 20)) |
|---|
| 1265 | datosSizer3.Add((10, 20)) |
|---|
| 1266 | datosSizer3.Add(aceptarBtn, 0, wx.ALIGN_LEFT) |
|---|
| 1267 | granSizer.Add(datosSizer, 1, wx.EXPAND) |
|---|
| 1268 | granSizer.Add(datosSizer2, 1, wx.EXPAND) |
|---|
| 1269 | granSizer.Add(datosSizer3, 1, wx.EXPAND) |
|---|
| 1270 | ppalSizer.Add(granSizer, 1, wx.EXPAND) |
|---|
| 1271 | panel.SetSizer(ppalSizer) |
|---|
| 1272 | ppalSizer.Fit(panel) |
|---|
| 1273 | self.Bind(wx.EVT_CHECKBOX, self.OnviveMad, self.madre) |
|---|
| 1274 | self.Bind(wx.EVT_CHECKBOX, self.OnvivePad, self.padre) |
|---|
| 1275 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelarBtn) |
|---|
| 1276 | self.Bind(wx.EVT_BUTTON, self.OnMA, aceptarBtn) |
|---|
| 1277 | self.frame.Show() |
|---|
| 1278 | |
|---|
| 1279 | # Modificación de tabla de alumnos |
|---|
| 1280 | def OnMA(self,evt): |
|---|
| 1281 | apellidos = self.apellidos.GetValue() |
|---|
| 1282 | nombres = self.nombres.GetValue() |
|---|
| 1283 | sexo = self.sexo.GetValue() |
|---|
| 1284 | tipo_doc = self.tipodoc.GetValue() |
|---|
| 1285 | num_doc = self.numdoc.GetValue() |
|---|
| 1286 | nacionalidad = self.nacionalidad.GetValue() |
|---|
| 1287 | dia = self.fechanac.GetValue() |
|---|
| 1288 | fecha_nac = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 1289 | lugar_nac = self.lugarnac.GetValue() |
|---|
| 1290 | calle_dom = self.calle.GetValue() |
|---|
| 1291 | num_dom = self.num.GetValue() |
|---|
| 1292 | piso_dom = self.piso.GetValue() |
|---|
| 1293 | dpto_dom = self.dpto.GetValue() |
|---|
| 1294 | cp_dom = self.cp.GetValue() |
|---|
| 1295 | localidad_dom = self.localidad.GetValue() |
|---|
| 1296 | pcia_dom = self.provincia.GetValue() |
|---|
| 1297 | tel_dom = self.te.GetValue() |
|---|
| 1298 | estudios = self.estudios.GetValue() |
|---|
| 1299 | hasta_est = self.hasta.GetValue() |
|---|
| 1300 | correo = self.correo.GetValue() |
|---|
| 1301 | nombre_madre = self.nombmad.GetValue() |
|---|
| 1302 | tipo_doc_madre = self.tipodocmad.GetValue() |
|---|
| 1303 | num_doc_madre = self.numdocmad.GetValue() |
|---|
| 1304 | nac_madre = self.nacmad.GetValue() |
|---|
| 1305 | dia = self.fechanacmad.GetValue() |
|---|
| 1306 | fecha_nac_madre = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 1307 | ocupacion_madre = self.ocupacionmad.GetValue() |
|---|
| 1308 | vive_madre = self.madre.GetValue() |
|---|
| 1309 | tel_contacto_madre = self.telefonomad.GetValue() |
|---|
| 1310 | nombre_padre = self.nombpad.GetValue() |
|---|
| 1311 | tipo_doc_padre = self.tipodocpad.GetValue() |
|---|
| 1312 | num_doc_padre = self.numdocpad.GetValue() |
|---|
| 1313 | nac_padre = self.nacmad.GetValue() |
|---|
| 1314 | dia = self.fechanacpad.GetValue() |
|---|
| 1315 | fecha_nac_padre = ('%04d/%02d/%02d' % (dia.GetYear(), dia.GetMonth()+1, dia.GetDay())) |
|---|
| 1316 | ocupacion_padre = self.ocupacionpad.GetValue() |
|---|
| 1317 | vive_padre = self.padre.GetValue() |
|---|
| 1318 | tel_contacto_padre = self.telefonopad.GetValue() |
|---|
| 1319 | trat_medico = self.tratmed.GetValue() |
|---|
| 1320 | observaciones = self.obs.GetValue() |
|---|
| 1321 | c = self.db.cursor() |
|---|
| 1322 | c.execute("""UPDATE alumnos SET apellidos = %s, nombres = %s, sexo = %s, tipo_doc = %s, num_doc = %s, nacionalidad = %s, fecha_nac = %s, lugar_nac = %s, calle_dom = %s, num_dom = %s, piso_dom = %s, dpto_dom = %s, cp_dom = %s, localidad_dom = %s, pcia_dom = %s, tel_dom = %s, estudios = %s, hasta_est = %s, correo = %s, nombre_madre = %s, tipo_doc_madre = %s, num_doc_madre = %s, nac_madre = %s, fecha_nac_madre = %s, ocupacion_madre = %s, vive_madre = %s, tel_contacto_madre = %s, nombre_padre = %s, tipo_doc_padre = %s, num_doc_padre = %s, nac_padre = %s, fecha_nac_padre = %s, ocupacion_padre = %s, vive_padre = %s, tel_contacto_padre = %s, trat_medico = %s, observaciones = %s WHERE id_alumno = %s""", (apellidos, nombres, sexo, tipo_doc, num_doc, nacionalidad, fecha_nac, lugar_nac, calle_dom, num_dom, piso_dom, dpto_dom, cp_dom, localidad_dom, pcia_dom, tel_dom, estudios, hasta_est, correo, nombre_madre, tipo_doc_madre, num_doc_madre, nac_madre, fecha_nac_madre, ocupacion_madre, vive_madre, tel_contacto_madre, nombre_padre, tipo_doc_padre, num_doc_padre, nac_padre, fecha_nac_padre, ocupacion_padre, vive_padre, tel_contacto_padre, trat_medico, observaciones, self.alumnoAmodificar)) |
|---|
| 1323 | wx.MessageBox(u'Operación realizada con éxito', u'Modificación de Alumno %s' % apellidos, wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1324 | c.close() |
|---|
| 1325 | self.frame.Destroy() |
|---|
| 1326 | |
|---|
| 1327 | |
|---|
| 1328 | |
|---|
| 1329 | # Modificación de Cursos |
|---|
| 1330 | def OnModCursos(self, evt): |
|---|
| 1331 | pass |
|---|
| 1332 | |
|---|
| 1333 | # Modificación de Instructores |
|---|
| 1334 | def OnModInstructores(self, evt): |
|---|
| 1335 | try: |
|---|
| 1336 | self.frame.Close() |
|---|
| 1337 | finally: |
|---|
| 1338 | c = self.db.cursor() |
|---|
| 1339 | c.execute("""SELECT id_instructor, apellidos, nombres FROM instructores ORDER BY id_instructor""") |
|---|
| 1340 | q = c.fetchall() |
|---|
| 1341 | StrInstructores = [("%s %s %s" % tuple(a)) for a in q] |
|---|
| 1342 | dlg = wx.SingleChoiceDialog(self, u'Seleccione el instructor a modificar:', u'Modificación de instructor', StrInstructores) |
|---|
| 1343 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1344 | selections = dlg.GetSelection() |
|---|
| 1345 | self.instAmodificar = q[selections][0] |
|---|
| 1346 | c. execute('''SELECT * FROM instructores WHERE id_instructor = %s''', (self.instAmodificar)) |
|---|
| 1347 | q = c.fetchall() |
|---|
| 1348 | c.close() |
|---|
| 1349 | self.frame = wx.Frame(self, -1, u'Modificación de Instructor %s' % q[0][1], size=(500, 350)) |
|---|
| 1350 | self.frame.CenterOnScreen() |
|---|
| 1351 | panel = wx.Panel(self.frame) |
|---|
| 1352 | topLbl = wx.StaticText(panel, -1, u'Modificación de Instructor %s' % q[0][1]) |
|---|
| 1353 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1354 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 1355 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 1356 | self.apellidos.SetFocus() |
|---|
| 1357 | self.apellidos.SetValue(q[0][1]) |
|---|
| 1358 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 1359 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 1360 | self.nombres.SetValue(q[0][2]) |
|---|
| 1361 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 1362 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 1363 | self.calle.SetValue(q[0][5]) |
|---|
| 1364 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 1365 | self.numero.SetValue(q[0][6]) |
|---|
| 1366 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 1367 | self.localidad.SetValue(q[0][7]) |
|---|
| 1368 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 1369 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 1370 | self.telefono.SetValue(q[0][3]) |
|---|
| 1371 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 1372 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 1373 | self.celular.SetValue(q[0][4]) |
|---|
| 1374 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 1375 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 1376 | self.correo.SetValue(q[0][8]) |
|---|
| 1377 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 1378 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 1379 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 1380 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 1381 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 1382 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1383 | datosSizer.AddGrowableCol(1) |
|---|
| 1384 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1385 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 1386 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1387 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 1388 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1389 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1390 | domicilioSizer.Add(self.calle, 1) |
|---|
| 1391 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 1392 | domicilioSizer.Add(self.localidad) |
|---|
| 1393 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 1394 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1395 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 1396 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1397 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 1398 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1399 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 1400 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 1401 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1402 | btnSizer.Add((20,20), 1) |
|---|
| 1403 | btnSizer.Add(saveBtn) |
|---|
| 1404 | btnSizer.Add((20,20), 1) |
|---|
| 1405 | btnSizer.Add(cancelBtn) |
|---|
| 1406 | btnSizer.Add((20,20), 1) |
|---|
| 1407 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 1408 | panel.SetSizer(ppalSizer) |
|---|
| 1409 | ppalSizer.Fit(self.frame) |
|---|
| 1410 | self.Bind(wx.EVT_BUTTON, self.OnMI, saveBtn) |
|---|
| 1411 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 1412 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 1413 | self.frame.Show() |
|---|
| 1414 | |
|---|
| 1415 | # Actualización de la tabla instructores |
|---|
| 1416 | def OnMI(self, evt): |
|---|
| 1417 | apellidos = self.apellidos.GetValue() |
|---|
| 1418 | nombres = self.nombres.GetValue() |
|---|
| 1419 | calle = self.calle.GetValue() |
|---|
| 1420 | numero = self.numero.GetValue() |
|---|
| 1421 | localidad = self.localidad.GetValue() |
|---|
| 1422 | telefono = self.telefono.GetValue() |
|---|
| 1423 | celular = self.celular.GetValue() |
|---|
| 1424 | correo = self.correo.GetValue() |
|---|
| 1425 | c = self.db.cursor() |
|---|
| 1426 | c.execute("""UPDATE instructores SET apellidos = %s, nombres = %s, calle = %s, numero = %s, localidad = %s, te_contacto = %s, celular = %s, correo = %s WHERE id_instructor = %s""", (apellidos, nombres, calle, numero, localidad, telefono, celular, correo, self.instAmodificar)) |
|---|
| 1427 | wx.MessageBox(u'Operación realizada con éxito', u'Modificación de Instructor %s' % apellidos, wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1428 | c.close() |
|---|
| 1429 | self.frame.Destroy() |
|---|
| 1430 | |
|---|
| 1431 | # Modificación de Coordinadores |
|---|
| 1432 | def OnModCoordinadores(self, evt): |
|---|
| 1433 | try: |
|---|
| 1434 | self.frame.Close() |
|---|
| 1435 | finally: |
|---|
| 1436 | c = self.db.cursor() |
|---|
| 1437 | c.execute("""SELECT id_coordinador, apellidos, nombres FROM coordinadores ORDER BY id_coordinador""") |
|---|
| 1438 | q = c.fetchall() |
|---|
| 1439 | StrCentros = [("%s %s %s" % tuple(a)) for a in q] |
|---|
| 1440 | dlg = wx.SingleChoiceDialog(self, u'Seleccione el Coordinador a Modificar:', u'Modificación de Coordinador', StrCentros) |
|---|
| 1441 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1442 | selections = dlg.GetSelection() |
|---|
| 1443 | self.coordAmodificar = q[selections][0] |
|---|
| 1444 | c. execute('''SELECT * FROM coordinadores WHERE id_coordinador = %s''', (self.coordAmodificar)) |
|---|
| 1445 | q = c.fetchall() |
|---|
| 1446 | c.close() |
|---|
| 1447 | self.frame = wx.Frame(self, -1, u'Modificación de Coordinador %s' % q[0][1], size=(500, 350)) |
|---|
| 1448 | self.frame.CenterOnScreen() |
|---|
| 1449 | panel = wx.Panel(self.frame) |
|---|
| 1450 | topLbl = wx.StaticText(panel, -1, u'Modificación de Coordinador %s' % q[0][1]) |
|---|
| 1451 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1452 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 1453 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 1454 | self.apellidos.SetFocus() |
|---|
| 1455 | self.apellidos.SetValue(q[0][1]) |
|---|
| 1456 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 1457 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 1458 | self.nombres.SetValue(q[0][2]) |
|---|
| 1459 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 1460 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 1461 | self.calle.SetValue(q[0][5]) |
|---|
| 1462 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 1463 | self.numero.SetValue(q[0][6]) |
|---|
| 1464 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 1465 | self.localidad.SetValue(q[0][7]) |
|---|
| 1466 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 1467 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 1468 | self.telefono.SetValue(q[0][3]) |
|---|
| 1469 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 1470 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 1471 | self.celular.SetValue(q[0][4]) |
|---|
| 1472 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 1473 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 1474 | self.correo.SetValue(q[0][8]) |
|---|
| 1475 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 1476 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 1477 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 1478 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 1479 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 1480 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1481 | datosSizer.AddGrowableCol(1) |
|---|
| 1482 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1483 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 1484 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1485 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 1486 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1487 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1488 | domicilioSizer.Add(self.calle, 1) |
|---|
| 1489 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 1490 | domicilioSizer.Add(self.localidad) |
|---|
| 1491 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 1492 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1493 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 1494 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1495 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 1496 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1497 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 1498 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 1499 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1500 | btnSizer.Add((20,20), 1) |
|---|
| 1501 | btnSizer.Add(saveBtn) |
|---|
| 1502 | btnSizer.Add((20,20), 1) |
|---|
| 1503 | btnSizer.Add(cancelBtn) |
|---|
| 1504 | btnSizer.Add((20,20), 1) |
|---|
| 1505 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 1506 | panel.SetSizer(ppalSizer) |
|---|
| 1507 | ppalSizer.Fit(self.frame) |
|---|
| 1508 | self.Bind(wx.EVT_BUTTON, self.OnMCoo, saveBtn) |
|---|
| 1509 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 1510 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 1511 | self.frame.Show() |
|---|
| 1512 | |
|---|
| 1513 | # Actualización de la tabla instructores |
|---|
| 1514 | def OnMCoo(self, evt): |
|---|
| 1515 | apellidos = self.apellidos.GetValue() |
|---|
| 1516 | nombres = self.nombres.GetValue() |
|---|
| 1517 | calle = self.calle.GetValue() |
|---|
| 1518 | numero = self.numero.GetValue() |
|---|
| 1519 | localidad = self.localidad.GetValue() |
|---|
| 1520 | telefono = self.telefono.GetValue() |
|---|
| 1521 | celular = self.celular.GetValue() |
|---|
| 1522 | correo = self.correo.GetValue() |
|---|
| 1523 | c = self.db.cursor() |
|---|
| 1524 | c.execute("""UPDATE instructores SET apellidos = %s, nombres = %s, calle = %s, numero = %s, localidad = %s, te_contacto = %s, celular = %s, correo = %s WHERE id_instructor = %s""", (apellidos, nombres, calle, numero, localidad, telefono, celular, correo, self.instAmodificar)) |
|---|
| 1525 | wx.MessageBox(u'Operación realizada con éxito', u'Modificación de Instructor %s' % apellidos, wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1526 | c.close() |
|---|
| 1527 | self.frame.Destroy() |
|---|
| 1528 | |
|---|
| 1529 | |
|---|
| 1530 | # Modificación de Centros |
|---|
| 1531 | def OnModCentros(self, evt): |
|---|
| 1532 | try: |
|---|
| 1533 | self.frame.Close() |
|---|
| 1534 | finally: |
|---|
| 1535 | c = self.db.cursor() |
|---|
| 1536 | c.execute("""SELECT id_establecimiento, nombre FROM establecimientos ORDER BY id_establecimiento""") |
|---|
| 1537 | q = c.fetchall() |
|---|
| 1538 | StrCentros = [("%s %s" % tuple(a)) for a in q] |
|---|
| 1539 | dlg = wx.SingleChoiceDialog(self, u'Seleccione el Centro a Modificar:', u'Modificación de Centro FP', StrCentros) |
|---|
| 1540 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1541 | selections = dlg.GetSelection() |
|---|
| 1542 | centroAmodificar = q[selections][0] |
|---|
| 1543 | c. execute('''SELECT * FROM establecimientos WHERE id_establecimiento = %s''', (centroAmodificar)) |
|---|
| 1544 | q = c.fetchall() |
|---|
| 1545 | self.id_mod = centroAmodificar |
|---|
| 1546 | self.frame = wx.Frame(self, -1, u'Modificación de Centro %s' % q[0][3], size=(500, 350)) |
|---|
| 1547 | self.frame.CenterOnScreen() |
|---|
| 1548 | panel = wx.Panel(self.frame) |
|---|
| 1549 | topLbl = wx.StaticText(panel, -1, u'Modificación de Centro %s' % q[0][3]) |
|---|
| 1550 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1551 | escuelaLbl = wx.StaticText(panel, -1, u'Nombre:') |
|---|
| 1552 | self.escuela = wx.TextCtrl(panel, -1, u'') |
|---|
| 1553 | self.escuela.SetValue(q[0][3]) |
|---|
| 1554 | self.escuela.SetFocus() |
|---|
| 1555 | calleLbl = wx.StaticText(panel, -1, u'Calle, N°:') |
|---|
| 1556 | self.calle = wx.TextCtrl(panel, -1, u'') |
|---|
| 1557 | self.calle.SetValue(q[0][4]) |
|---|
| 1558 | self.numero = wx.TextCtrl(panel, -1, u'') |
|---|
| 1559 | self.numero.SetValue(q[0][5]) |
|---|
| 1560 | domicLbl = wx.StaticText(panel, -1, u'Localidad, CP:') |
|---|
| 1561 | self.localidad = wx.TextCtrl(panel, -1, u'', size=(150,-1)) |
|---|
| 1562 | self.localidad.SetValue(q[0][6]) |
|---|
| 1563 | self.codigo = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 1564 | self.codigo.SetValue(q[0][7]) |
|---|
| 1565 | telLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 1566 | self.telefono = wx.TextCtrl(panel, -1, u'') |
|---|
| 1567 | self.telefono.SetValue(q[0][8]) |
|---|
| 1568 | correoLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 1569 | self.correo = wx.TextCtrl(panel, -1, u'') |
|---|
| 1570 | self.correo.SetValue(q[0][9]) |
|---|
| 1571 | siteLbl = wx.StaticText(panel, -1, u'Web site:') |
|---|
| 1572 | self.site = wx.TextCtrl(panel, -1, u'') |
|---|
| 1573 | self.site.SetValue(q[0][10]) |
|---|
| 1574 | coordLbl = wx.StaticText(panel, -1, u'Coordinador') |
|---|
| 1575 | c = self.db.cursor() |
|---|
| 1576 | c.execute("""SELECT nombres, apellidos FROM coordinadores ORDER BY id_coordinador""") |
|---|
| 1577 | coords = c.fetchall() |
|---|
| 1578 | c.close() |
|---|
| 1579 | StrCoord = [("%s %s" % tuple(a)) for a in coords] |
|---|
| 1580 | self.coordinador = wx.ComboBox(panel, -1, '', (-1, -1), wx.DefaultSize, StrCoord, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1581 | self.coordinador.SetValue(q[0][12]) |
|---|
| 1582 | BtnAceptar = wx.Button(panel, -1, u'Ingresar') |
|---|
| 1583 | BtnCancelar = wx.Button(panel, -1, u'Cancelar') |
|---|
| 1584 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 1585 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 1586 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 1587 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1588 | datosSizer.AddGrowableCol(1) |
|---|
| 1589 | datosSizer.Add(escuelaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1590 | datosSizer.Add(self.escuela, 1, wx.EXPAND) |
|---|
| 1591 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1592 | cpSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1593 | cpSizer.Add(self.calle, 1) |
|---|
| 1594 | cpSizer.Add(self.numero, 1) |
|---|
| 1595 | datosSizer.Add(cpSizer, 0, wx.EXPAND) |
|---|
| 1596 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1597 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1598 | domicilioSizer.Add(self.localidad, 1) |
|---|
| 1599 | domicilioSizer.Add(self.codigo, 1) |
|---|
| 1600 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 1601 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1602 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 1603 | datosSizer.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1604 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 1605 | datosSizer.Add(siteLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1606 | datosSizer.Add(self.site, 0, wx.EXPAND) |
|---|
| 1607 | datosSizer.Add(coordLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1608 | datosSizer.Add(self.coordinador, 0, wx.EXPAND) |
|---|
| 1609 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 1610 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1611 | btnSizer.Add((20,20), 1) |
|---|
| 1612 | btnSizer.Add(BtnAceptar) |
|---|
| 1613 | btnSizer.Add((20,20), 1) |
|---|
| 1614 | btnSizer.Add(BtnCancelar) |
|---|
| 1615 | btnSizer.Add((20,20), 1) |
|---|
| 1616 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 1617 | panel.SetSizer(ppalSizer) |
|---|
| 1618 | ppalSizer.Fit(self.frame) |
|---|
| 1619 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, BtnCancelar) |
|---|
| 1620 | self.Bind(wx.EVT_BUTTON, self.OnAceptarMCen, BtnAceptar) |
|---|
| 1621 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 1622 | self.frame.Show(True) |
|---|
| 1623 | |
|---|
| 1624 | # Actualización de tabla Centros de FP (establecimientos) |
|---|
| 1625 | def OnAceptarMCen(self, event): |
|---|
| 1626 | escuela = self.escuela.GetValue() |
|---|
| 1627 | calle = self.calle.GetValue() |
|---|
| 1628 | numero = self.numero.GetValue() |
|---|
| 1629 | localidad = self.localidad.GetValue() |
|---|
| 1630 | codigo = self.codigo.GetValue() |
|---|
| 1631 | telefono = self.telefono.GetValue() |
|---|
| 1632 | correo = self.correo.GetValue() |
|---|
| 1633 | site = self.site.GetValue() |
|---|
| 1634 | coordinador = self.coordinador.GetValue() |
|---|
| 1635 | c = self.db.cursor() |
|---|
| 1636 | c.execute("""UPDATE establecimientos SET nombre = %s, calle = %s, num_puerta = %s, localidad = %s, cp = %s, telefono = %s, correo = %s, site = %s, coordinador = %s WHERE id_establecimiento = %s""", (escuela, calle, numero, localidad, codigo, telefono, correo, site, coordinador, self.id_mod)) |
|---|
| 1637 | wx.MessageBox(u'Operación realizada con éxito', u'Modificación de Centro %s' % escuela, wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1638 | c.close() |
|---|
| 1639 | self.frame.Destroy() |
|---|
| 1640 | |
|---|
| 1641 | # Modificación de Administrativos |
|---|
| 1642 | def OnModAdministrativos(self, evt): |
|---|
| 1643 | try: |
|---|
| 1644 | self.frame.Close() |
|---|
| 1645 | finally: |
|---|
| 1646 | c = self.db.cursor() |
|---|
| 1647 | c.execute("""SELECT id_administrativo, apellidos, nombres FROM administrativos ORDER BY id_administrativo""") |
|---|
| 1648 | q = c.fetchall() |
|---|
| 1649 | StrAdministrativos = [("%s %s %s" % tuple(a)) for a in q] |
|---|
| 1650 | dlg = wx.SingleChoiceDialog(self, u'Seleccione la persona a modificar:', u'Modificación de administrativo', StrAdministrativos) |
|---|
| 1651 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1652 | selections = dlg.GetSelection() |
|---|
| 1653 | self.admAmodificar = q[selections][0] |
|---|
| 1654 | c. execute('''SELECT * FROM administrativos WHERE id_administrativo = %s''', (self.admAmodificar)) |
|---|
| 1655 | q = c.fetchall() |
|---|
| 1656 | c.close() |
|---|
| 1657 | self.frame = wx.Frame(self, -1, u'Modificación de Administrativo %s' % q[0][2], size=(500, 350)) |
|---|
| 1658 | self.frame.CenterOnScreen() |
|---|
| 1659 | panel = wx.Panel(self.frame) |
|---|
| 1660 | topLbl = wx.StaticText(panel, -1, u'Modificación de Administrativo %s ' % q[0][2]) |
|---|
| 1661 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1662 | cargoLbl = wx.StaticText(panel, -1, u'Cargo:') |
|---|
| 1663 | StrCargos = [u'Director', u'Regente', u'Secretario', u'Preceptor'] |
|---|
| 1664 | self.cargo = wx.ComboBox(panel, -1, '', (-1, -1), wx.DefaultSize, StrCargos, wx.CB_DROPDOWN | wx.CB_READONLY) |
|---|
| 1665 | self.cargo.SetValue(q[0][1]) |
|---|
| 1666 | self.cargo.SetFocus() |
|---|
| 1667 | apellLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 1668 | self.apellidos = wx.TextCtrl(panel, -1, '') |
|---|
| 1669 | self.apellidos.SetValue(q[0][2]) |
|---|
| 1670 | nomLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 1671 | self.nombres = wx.TextCtrl(panel, -1, '') |
|---|
| 1672 | self.nombres.SetValue(q[0][3]) |
|---|
| 1673 | domicLbl = wx.StaticText(panel, -1, u'Calle, N°, Localidad:') |
|---|
| 1674 | self.calle = wx.TextCtrl(panel, -1, '', size=(150,-1)) |
|---|
| 1675 | self.calle.SetValue(q[0][4]) |
|---|
| 1676 | self.numero = wx.TextCtrl(panel, -1, '', size=(50,-1)) |
|---|
| 1677 | self.numero.SetValue(q[0][5]) |
|---|
| 1678 | self.localidad = wx.TextCtrl(panel, -1, '', size=(100,-1)) |
|---|
| 1679 | self.localidad.SetValue(q[0][6]) |
|---|
| 1680 | telLbl = wx.StaticText(panel, -1, u'TE particular:') |
|---|
| 1681 | self.telefono = wx.TextCtrl(panel, -1, '') |
|---|
| 1682 | self.telefono.SetValue(q[0][7]) |
|---|
| 1683 | celLbl = wx.StaticText(panel, -1, u'Celular:') |
|---|
| 1684 | self.celular = wx.TextCtrl(panel, -1, '') |
|---|
| 1685 | self.celular.SetValue(q[0][8]) |
|---|
| 1686 | emailLbl = wx.StaticText(panel, -1, u'Correo electrónico:') |
|---|
| 1687 | self.correo = wx.TextCtrl(panel, -1, '') |
|---|
| 1688 | self.correo.SetValue(q[0][9]) |
|---|
| 1689 | saveBtn = wx.Button(panel, -1, u'Ingresar') |
|---|
| 1690 | cancelBtn = wx.Button(panel, -1, u'Cancelar') |
|---|
| 1691 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 1692 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 1693 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 1694 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 1695 | datosSizer.AddGrowableCol(1) |
|---|
| 1696 | datosSizer.Add(cargoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1697 | datosSizer.Add(self.cargo, 0, wx.EXPAND) |
|---|
| 1698 | datosSizer.Add(apellLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1699 | datosSizer.Add(self.apellidos, 0, wx.EXPAND) |
|---|
| 1700 | datosSizer.Add(nomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1701 | datosSizer.Add(self.nombres, 0, wx.EXPAND) |
|---|
| 1702 | datosSizer.Add(domicLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1703 | domicilioSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1704 | domicilioSizer.Add(self.calle, 1) |
|---|
| 1705 | domicilioSizer.Add(self.numero, 0, wx.LEFT|wx.RIGHT, 5) |
|---|
| 1706 | domicilioSizer.Add(self.localidad) |
|---|
| 1707 | datosSizer.Add(domicilioSizer, 0, wx.EXPAND) |
|---|
| 1708 | datosSizer.Add(telLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1709 | datosSizer.Add(self.telefono, 0, wx.EXPAND) |
|---|
| 1710 | datosSizer.Add(celLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1711 | datosSizer.Add(self.celular, 0, wx.EXPAND) |
|---|
| 1712 | datosSizer.Add(emailLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 1713 | datosSizer.Add(self.correo, 0, wx.EXPAND) |
|---|
| 1714 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 1715 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 1716 | btnSizer.Add((20,20), 1) |
|---|
| 1717 | btnSizer.Add(saveBtn) |
|---|
| 1718 | btnSizer.Add((20,20), 1) |
|---|
| 1719 | btnSizer.Add(cancelBtn) |
|---|
| 1720 | btnSizer.Add((20,20), 1) |
|---|
| 1721 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 1722 | panel.SetSizer(ppalSizer) |
|---|
| 1723 | ppalSizer.Fit(self.frame) |
|---|
| 1724 | self.Bind(wx.EVT_BUTTON, self.OnMAD, saveBtn) |
|---|
| 1725 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelBtn) |
|---|
| 1726 | ppalSizer.SetSizeHints(self.frame) |
|---|
| 1727 | self.frame.Show() |
|---|
| 1728 | |
|---|
| 1729 | # Actualización de la tabla administrativos |
|---|
| 1730 | def OnMAD(self, evt): |
|---|
| 1731 | cargo = self.cargo.GetValue() |
|---|
| 1732 | apellidos = self.apellidos.GetValue() |
|---|
| 1733 | nombres = self.nombres.GetValue() |
|---|
| 1734 | calle = self.calle.GetValue() |
|---|
| 1735 | numero = self.numero.GetValue() |
|---|
| 1736 | localidad = self.localidad.GetValue() |
|---|
| 1737 | telefono = self.telefono.GetValue() |
|---|
| 1738 | celular = self.celular.GetValue() |
|---|
| 1739 | correo = self.correo.GetValue() |
|---|
| 1740 | c = self.db.cursor() |
|---|
| 1741 | c.execute("""UPDATE administrativos SET cargo = %s, apellidos = %s, nombres = %s, calle = %s, numero = %s, localidad = %s, telefono = %s, celular = %s, correo = %s WHERE id_administrativo = %s""", (cargo, apellidos, nombres, calle, numero, localidad, telefono, celular, correo, self.admAmodificar)) |
|---|
| 1742 | wx.MessageBox(u'Operación realizada con éxito', u'Modificación de Administrativo', wx.OK | wx.ICON_INFORMATION, self) |
|---|
| 1743 | c.close() |
|---|
| 1744 | self.frame.Destroy() |
|---|
| 1745 | |
|---|
| 1746 | |
|---|
| 1747 | # Listado de Alumnos |
|---|
| 1748 | def OnListAlumnos(self, evt): |
|---|
| 1749 | try: |
|---|
| 1750 | self.frame.Close() |
|---|
| 1751 | finally: |
|---|
| 1752 | c = self.db.cursor() |
|---|
| 1753 | c.execute('''SELECT id_alumno, apellidos, nombres, num_doc, calle_dom, num_dom, localidad_dom, tel_dom FROM alumnos order by id_alumno ASC''') |
|---|
| 1754 | q = c.fetchall() |
|---|
| 1755 | c.close |
|---|
| 1756 | d = len(q) |
|---|
| 1757 | encabezado = u'columns = ["Id", "Apellidos", "Nombres", "Documento", "Calle", "N°", "Localidad", "Teléfono"]\n' |
|---|
| 1758 | f=open('listalum.py', 'w') |
|---|
| 1759 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1760 | f.write('\n') |
|---|
| 1761 | f.write(encabezado.encode('utf-8')) |
|---|
| 1762 | f.write('\n') |
|---|
| 1763 | f.write('rows = [\n') |
|---|
| 1764 | for cadaobj in range(0, (d)): |
|---|
| 1765 | f.write('%s,\n' % str(q[cadaobj])) |
|---|
| 1766 | f.write (']') |
|---|
| 1767 | f.close() |
|---|
| 1768 | self.frame = ListAlumFrame() |
|---|
| 1769 | self.frame.Show() |
|---|
| 1770 | |
|---|
| 1771 | # Listado de Cursos |
|---|
| 1772 | def OnListCursos(self, evt): |
|---|
| 1773 | try: |
|---|
| 1774 | self.frame.Close() |
|---|
| 1775 | finally: |
|---|
| 1776 | dlg = wx.SingleChoiceDialog(self, u'Criterio de listado', u'Listado de cursos', |
|---|
| 1777 | [u'Todos', u'Número', u'Instructor'], wx.CHOICEDLG_STYLE) |
|---|
| 1778 | c = self.db.cursor() |
|---|
| 1779 | if dlg.ShowModal() == wx.ID_OK: |
|---|
| 1780 | seleccion = dlg.GetStringSelection() |
|---|
| 1781 | dlg.Destroy() |
|---|
| 1782 | #Listado completo |
|---|
| 1783 | if seleccion == u'Todos': |
|---|
| 1784 | c.execute('''SELECT num_curso FROM cursos''') |
|---|
| 1785 | q = c.fetchall() |
|---|
| 1786 | f = open('listcursos.py', 'w') |
|---|
| 1787 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1788 | f.write('\n') |
|---|
| 1789 | f.write(u'columns = ["N° Curso", "Tipo", "Especialidad", "Instructor", "Año", "Horas", "Establecimiento"]\n'.encode('utf-8')) |
|---|
| 1790 | f.write('\n') |
|---|
| 1791 | f.write('rows = [\n') |
|---|
| 1792 | for cadaobj in q: |
|---|
| 1793 | c.execute('''SELECT num_curso, tipo, especialidad, instructor, ciclo, horas, establecimiento FROM cursos WHERE num_curso = %s ''' % (cadaobj)) |
|---|
| 1794 | w = c.fetchall() |
|---|
| 1795 | f.write ('%s, \n' %(w)) |
|---|
| 1796 | f.write (']') |
|---|
| 1797 | f.close() |
|---|
| 1798 | c.close() |
|---|
| 1799 | self.frame = ListCursosFrame() |
|---|
| 1800 | self.frame.Show() |
|---|
| 1801 | |
|---|
| 1802 | |
|---|
| 1803 | #Listado por número |
|---|
| 1804 | elif seleccion == u'Número': |
|---|
| 1805 | dlg = wx.TextEntryDialog(self, u'Ingrese el número de curso a listar',u'Listado de Cursos', '') |
|---|
| 1806 | if dlg.ShowModal() == wx.ID_OK: |
|---|
| 1807 | num_curso = dlg.GetValue() |
|---|
| 1808 | dlg.Destroy() |
|---|
| 1809 | c.execute('''SELECT id_alumno FROM curso_%s''' % (num_curso)) |
|---|
| 1810 | q = c.fetchall() |
|---|
| 1811 | # Creo un archivo list_curso_num.py y lo lleno con las filas y las columnas |
|---|
| 1812 | f = open('list_curso_num.py', 'w') |
|---|
| 1813 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1814 | f.write('\n') |
|---|
| 1815 | f.write('num_curso = %s\n' % num_curso) |
|---|
| 1816 | f.write('\n') |
|---|
| 1817 | columnas = u'columns = ["Apellidos", "Nombres", "Documento", "Calle", "N°", "Localidad", "Teléfono", "C@rreo"]\n' |
|---|
| 1818 | f.write(columnas.encode('UTF-8')) |
|---|
| 1819 | f.write('\n') |
|---|
| 1820 | f.write('rows = [\n') |
|---|
| 1821 | for cadaobj in q: |
|---|
| 1822 | c.execute('''SELECT apellidos, nombres, num_doc, calle_dom, num_dom, localidad_dom, tel_dom, correo FROM alumnos WHERE id_alumno = %s ''' % (cadaobj)) |
|---|
| 1823 | w = c.fetchall() |
|---|
| 1824 | f.write ('%s,\n' % w) |
|---|
| 1825 | f.write (']') |
|---|
| 1826 | f.close() |
|---|
| 1827 | c.close() |
|---|
| 1828 | self.frame = ListCurNumFrame() |
|---|
| 1829 | self.frame.Show() |
|---|
| 1830 | |
|---|
| 1831 | elif seleccion == u'Instructor': |
|---|
| 1832 | dlg = wx.TextEntryDialog(self, u'Ingrese el apellido del instructor', u'Listado de Cursos por instructor''') |
|---|
| 1833 | if dlg.ShowModal() == wx.ID_OK: |
|---|
| 1834 | instructor = dlg.GetValue() |
|---|
| 1835 | dlg.Destroy() |
|---|
| 1836 | c.execute('''SELECT num_curso, tipo, especialidad, ciclo, establecimiento FROM cursos WHERE instructor = "%s"''' % (instructor)) |
|---|
| 1837 | q = c.fetchall() |
|---|
| 1838 | f = open('list_curso_ins.py', 'w') |
|---|
| 1839 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1840 | f.write('\n') |
|---|
| 1841 | f.write('instructor = u"%s"\n' % instructor.encode('UTF-8')) |
|---|
| 1842 | f.write('\n') |
|---|
| 1843 | columnas = u'columns = ["N° Curso", "Tipo", "Especialidad", "Año", "Establecimiento"]\n' |
|---|
| 1844 | f.write(columnas.encode('UTF-8')) |
|---|
| 1845 | f.write('\n') |
|---|
| 1846 | f.write('rows = [\n') |
|---|
| 1847 | for item in range(len(q)): |
|---|
| 1848 | f.write('(') |
|---|
| 1849 | for i in range (5): |
|---|
| 1850 | if i == 4: |
|---|
| 1851 | f.write ('u"%s"' %(q[item][i].encode('UTF-8'))) |
|---|
| 1852 | f.write('),') |
|---|
| 1853 | else: |
|---|
| 1854 | f.write ('u"%s", ' %(q[item][i].encode('UTF-8'))) |
|---|
| 1855 | f.write ('\n') |
|---|
| 1856 | f.write (']') |
|---|
| 1857 | f.close() |
|---|
| 1858 | c.close() |
|---|
| 1859 | self.frame = ListCurInsFrame() |
|---|
| 1860 | self.frame.Show() |
|---|
| 1861 | elif seleccion == u'Año': |
|---|
| 1862 | pass |
|---|
| 1863 | elif seleccion == u'Especialidad': |
|---|
| 1864 | pass |
|---|
| 1865 | else: |
|---|
| 1866 | dlg.Destroy() |
|---|
| 1867 | return |
|---|
| 1868 | |
|---|
| 1869 | |
|---|
| 1870 | # Listado de Instructores |
|---|
| 1871 | def OnListInstruc(self, evt): |
|---|
| 1872 | try: |
|---|
| 1873 | self.frame.Close() |
|---|
| 1874 | finally: |
|---|
| 1875 | c = self.db.cursor() |
|---|
| 1876 | c.execute('''SELECT id_instructor, apellidos, nombres, te_contacto, calle, numero, localidad, correo FROM instructores order by id_instructor ASC''') |
|---|
| 1877 | q = c.fetchall() |
|---|
| 1878 | d = len(q) |
|---|
| 1879 | f=open('listinstruc.py', 'w') |
|---|
| 1880 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1881 | f.write('\n') |
|---|
| 1882 | columnas = u'columns = [u"Id", u"Apellidos", u"Nombres", u"TE", u"Calle", u"Número", u"Localidad", u"Correo-e"]\n' |
|---|
| 1883 | f.write(columnas.encode('UTF-8')) |
|---|
| 1884 | f.write('\n') |
|---|
| 1885 | f.write('rows = [\n') |
|---|
| 1886 | for cadaobj in range(0, (d)): |
|---|
| 1887 | f.write ('%s,\n' %str(q[cadaobj])) |
|---|
| 1888 | f.write (']') |
|---|
| 1889 | f.close() |
|---|
| 1890 | c.close() |
|---|
| 1891 | self.frame = ListInstFrame() |
|---|
| 1892 | self.frame.Show() |
|---|
| 1893 | |
|---|
| 1894 | # Listado de Coordinadores |
|---|
| 1895 | def OnListCoord(self, evt): |
|---|
| 1896 | try: |
|---|
| 1897 | self.frame.Close() |
|---|
| 1898 | finally: |
|---|
| 1899 | c = self.db.cursor() |
|---|
| 1900 | c.execute('''SELECT id_coordinador, apellidos, nombres, te_contacto, calle, numero, localidad, correo FROM coordinadores order by id_coordinador ASC''') |
|---|
| 1901 | q = c.fetchall() |
|---|
| 1902 | d = len(q) |
|---|
| 1903 | f=open('listcoord.py', 'w') |
|---|
| 1904 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1905 | f.write('\n') |
|---|
| 1906 | f.write('columns = [u"Id", u"Apellidos", u"Nombres", u"TE", u"Calle", u"Número", u"Localidad", u"Correo-e"]\n') |
|---|
| 1907 | f.write('\n') |
|---|
| 1908 | f.write('rows = [\n') |
|---|
| 1909 | for cadaobj in range(0, (d)): |
|---|
| 1910 | f.write ('%s,\n' %str(q[cadaobj])) |
|---|
| 1911 | f.write (']') |
|---|
| 1912 | f.close() |
|---|
| 1913 | c.close() |
|---|
| 1914 | self.frame = ListCoordFrame() |
|---|
| 1915 | self.frame.Show() |
|---|
| 1916 | |
|---|
| 1917 | # Listado de Centros |
|---|
| 1918 | def OnListCentros(self, evt): |
|---|
| 1919 | try: |
|---|
| 1920 | self.frame.Close() |
|---|
| 1921 | finally: |
|---|
| 1922 | c = self.db.cursor() |
|---|
| 1923 | c.execute('''SELECT id_establecimiento, nombre, calle, num_puerta, localidad, cp, telefono, correo, coordinador FROM establecimientos order by id_establecimiento ASC''') |
|---|
| 1924 | q = c.fetchall() |
|---|
| 1925 | d = len(q) |
|---|
| 1926 | f=open('listcentros.py', 'w') |
|---|
| 1927 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1928 | f.write('\n') |
|---|
| 1929 | columnas = u'columns = ["Id", "Nombre", "Calle", "N°", "Localidad", "CP", "TE", "Correo-e", "Coordinador"]\n' |
|---|
| 1930 | f.write(columnas.encode('UTF-8')) |
|---|
| 1931 | f.write('\n') |
|---|
| 1932 | f.write('rows = [\n') |
|---|
| 1933 | for cadaobj in range(0, (d)): |
|---|
| 1934 | f.write ('%s,\n' %str(q[cadaobj])) |
|---|
| 1935 | f.write (']') |
|---|
| 1936 | f.close() |
|---|
| 1937 | c.close() |
|---|
| 1938 | self.frame = ListCentrosFrame() |
|---|
| 1939 | self.frame.Show() |
|---|
| 1940 | |
|---|
| 1941 | # Listado de Administrativos |
|---|
| 1942 | def OnListAdministrativos(self, evt): |
|---|
| 1943 | try: |
|---|
| 1944 | self.frame.Close() |
|---|
| 1945 | finally: |
|---|
| 1946 | c = self.db.cursor() |
|---|
| 1947 | c.execute('''SELECT cargo, apellidos, nombres, calle, numero, localidad, telefono, celular, correo FROM administrativos order by cargo ASC''') |
|---|
| 1948 | q = c.fetchall() |
|---|
| 1949 | d = len(q) |
|---|
| 1950 | f=open('listadm.py', 'w') |
|---|
| 1951 | f.write('# -*- coding: UTF8 -*-\n') |
|---|
| 1952 | f.write('\n') |
|---|
| 1953 | f.write('columns = ["Cargo", "Apellidos", "Nombres", "Calle", "N°", "Localidad", "CP", "TE", "Correo-e"]\n') |
|---|
| 1954 | f.write('\n') |
|---|
| 1955 | f.write('rows = [\n') |
|---|
| 1956 | for cadaobj in range(0, (d)): |
|---|
| 1957 | f.write ('%s,\n' %str(q[cadaobj])) |
|---|
| 1958 | f.write (']') |
|---|
| 1959 | f.close() |
|---|
| 1960 | c.close() |
|---|
| 1961 | self.frame = ListAdmFrame() |
|---|
| 1962 | self.frame.Show() |
|---|
| 1963 | |
|---|
| 1964 | # Ficha de Alumnos |
|---|
| 1965 | def OnFichaAlumnos(self, evt): |
|---|
| 1966 | try: |
|---|
| 1967 | self.frame.Close() |
|---|
| 1968 | finally: |
|---|
| 1969 | # Creo el diálogo para entrar el apellido del alumno a listar |
|---|
| 1970 | self.dialog = wx.TextEntryDialog(None, u'Ingrese el Apellido del alumno', u'Ficha de alumnos', u'', style=wx.OK|wx.CANCEL) |
|---|
| 1971 | if self.dialog.ShowModal() == wx.ID_OK: |
|---|
| 1972 | self.apellido = self.dialog.GetValue() |
|---|
| 1973 | else: |
|---|
| 1974 | self.dialog.Destroy() |
|---|
| 1975 | return |
|---|
| 1976 | self.dialog.Destroy() |
|---|
| 1977 | # Creo el diálogo para seleccionar entre todos los que tienen el mismo apellido |
|---|
| 1978 | c = self.db.cursor() |
|---|
| 1979 | c.execute('''SELECT id_alumno, apellidos, nombres, num_doc FROM alumnos WHERE apellidos = %s''', (self.apellido)) |
|---|
| 1980 | q = c.fetchall() |
|---|
| 1981 | StrAlum = [("%d %s %s %s" % tuple(a)) for a in q] |
|---|
| 1982 | dlg = wx.SingleChoiceDialog(self, u'Alumnos que cumplen el criterio de búsqueda:', u'Legajo de alumnos', StrAlum) |
|---|
| 1983 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 1984 | selections = dlg.GetSelection() |
|---|
| 1985 | self.alumnoAlistar = q[selections][0] |
|---|
| 1986 | c. execute('''SELECT * FROM alumnos WHERE id_alumno = %s''', (self.alumnoAlistar)) |
|---|
| 1987 | q = c.fetchall() |
|---|
| 1988 | self.frame = wx.Frame(self, -1, u'Legajo de alumno %s' % (self.alumnoAlistar), size=(800, 600)) |
|---|
| 1989 | self.frame.CentreOnScreen() |
|---|
| 1990 | panel = wx.Panel(self.frame) |
|---|
| 1991 | topLbl = wx.StaticText(panel, -1, u'Ficha de Estudiante') |
|---|
| 1992 | topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 1993 | apellidosLbl = wx.StaticText(panel, -1, u'Apellidos:') |
|---|
| 1994 | apellidos = wx.StaticText(panel, -1, u'%s' % q[0][1]) |
|---|
| 1995 | nombresLbl = wx.StaticText(panel, -1, u'Nombres:') |
|---|
| 1996 | nombres = wx.StaticText(panel, -1, u'%s' % q[0][2]) |
|---|
| 1997 | sexoLbl = wx.StaticText(panel, -1, u'Sexo:') |
|---|
| 1998 | sexo = wx.StaticText(panel, -1, u'%s' % q[0][3]) |
|---|
| 1999 | tipodocLbl = wx.StaticText(panel, -1, u'Tipo doc:') |
|---|
| 2000 | tipodoc = wx.StaticText(panel, -1, u'%s' % q[0][4]) |
|---|
| 2001 | numdocLbl = wx.StaticText(panel, -1, u'N° doc:') |
|---|
| 2002 | numdoc = wx.StaticText(panel, -1, u'%s' % q[0][5]) |
|---|
| 2003 | nacionalidadLbl = wx.StaticText(panel, -1, u'Nac:') |
|---|
| 2004 | nacionalidad = wx.StaticText(panel, -1, u'%s' % q[0][6]) |
|---|
| 2005 | fechanacLbl = wx.StaticText(panel, -1, u'Fecha nac:') |
|---|
| 2006 | fechanac = wx.StaticText(panel, -1, u'%s' % q[0][7]) |
|---|
| 2007 | lugarnacLbl = wx.StaticText(panel, -1, u'Lugar nac:') |
|---|
| 2008 | lugarnac = wx.StaticText(panel, -1, u'%s' % q[0][8]) |
|---|
| 2009 | datosdomLbl = wx.StaticText(panel, -1, u'Domicilio') |
|---|
| 2010 | calleLbl = wx.StaticText(panel, -1, u'Calle:') |
|---|
| 2011 | calle = wx.StaticText(panel, -1, u'%s' % q[0][9]) |
|---|
| 2012 | numLbl = wx.StaticText(panel, -1, u'Número:') |
|---|
| 2013 | num = wx.StaticText(panel, -1, u'%s' % q[0][10]) |
|---|
| 2014 | pisoLbl = wx.StaticText(panel, -1, u'Piso:') |
|---|
| 2015 | piso = wx.StaticText(panel, -1, u'%s' % q[0][11]) |
|---|
| 2016 | dptoLbl = wx.StaticText(panel, -1, u'Dpto:') |
|---|
| 2017 | dpto = wx.StaticText(panel, -1, u'%s' % q[0][12]) |
|---|
| 2018 | cpLbl = wx.StaticText(panel, -1, u'Código Postal:') |
|---|
| 2019 | cp = wx.StaticText(panel, -1, u'%s' % q[0][13]) |
|---|
| 2020 | localidadLbl = wx.StaticText(panel, -1, u'Localidad:') |
|---|
| 2021 | localidad = wx.StaticText(panel, -1, u'%s' % q[0][14]) |
|---|
| 2022 | provinciaLbl = wx.StaticText(panel, -1, u'Provincia:') |
|---|
| 2023 | provincia = wx.StaticText(panel, -1, u'%s' % q[0][15]) |
|---|
| 2024 | teLbl = wx.StaticText(panel, -1, u'Teléfono:') |
|---|
| 2025 | te = wx.StaticText(panel, -1, u'%s' % q[0][16]) |
|---|
| 2026 | estudiosLbl = wx.StaticText(panel, -1, u'Estudios:') |
|---|
| 2027 | estudios = wx.StaticText(panel, -1, u'%s' % q[0][17]) |
|---|
| 2028 | hastaLbl = wx.StaticText(panel, -1, u'Hasta:') |
|---|
| 2029 | #CompInc = wx.StaticText(panel, -1, u'Completo') |
|---|
| 2030 | InCompAnio = wx.StaticText(panel, -1, (q[0][18])) |
|---|
| 2031 | InCompA = wx.StaticText(panel, -1, u'año') |
|---|
| 2032 | correoLbl = wx.StaticText(panel, -1, u'E-correo:') |
|---|
| 2033 | correo = wx.StaticText(panel, -1, u'%s' % q[0][19]) |
|---|
| 2034 | tratmedLbl = wx.StaticText(panel, -1, u'Trat. méd:') |
|---|
| 2035 | tratmed = wx.StaticText(panel, -1, u'%s' % q[0][36]) |
|---|
| 2036 | obsLbl = wx.StaticText(panel, -1, u'Obs:') |
|---|
| 2037 | obs = wx.StaticText(panel, -1, u'%s' % q[0][37]) |
|---|
| 2038 | madreLbl = wx.StaticText(panel, -1, u' Datos de la Madre:') |
|---|
| 2039 | madre = wx.StaticText(panel, -1, u'Vive') |
|---|
| 2040 | LblMadNom = wx.StaticText (panel, -1, u'Nombre: ') |
|---|
| 2041 | LblMadTipoDoc = wx.StaticText (panel, -1, u'Tipo doc: ') |
|---|
| 2042 | LblMadNumDoc = wx.StaticText(panel, -1, u'N° doc: ') |
|---|
| 2043 | LblMadNac = wx.StaticText(panel, -1, u'Nacionalidad: ') |
|---|
| 2044 | LblMadFechaNac = wx.StaticText (panel, -1, u'Fecha nac: ') |
|---|
| 2045 | LblMadOcu = wx.StaticText(panel, -1, u'Ocupación: ') |
|---|
| 2046 | LblMadTe = wx.StaticText(panel, -1, u'Teléfono: ') |
|---|
| 2047 | MadNom = wx.StaticText(panel, -1, q[0][20]) |
|---|
| 2048 | MadTipoDoc = wx.StaticText(panel, -1, q[0][21]) |
|---|
| 2049 | MadNumDoc = wx.StaticText(panel, -1, q[0][22]) |
|---|
| 2050 | MadNac = wx.StaticText(panel, -1, q[0][23]) |
|---|
| 2051 | MadFechaNac = wx.StaticText(panel, -1, str(q[0][24])) |
|---|
| 2052 | MadOcu = wx.StaticText(panel, -1, q[0][25]) |
|---|
| 2053 | MadTe = wx.StaticText(panel, -1, q[0][27]) |
|---|
| 2054 | padreLbl = wx.StaticText(panel, -1, u' Datos del Padre:') |
|---|
| 2055 | padre = wx.StaticText(panel, -1, u'Vive') |
|---|
| 2056 | LblPadNom = wx.StaticText (panel, -1, 'Nombre: ') |
|---|
| 2057 | LblPadTipoDoc = wx.StaticText (panel, -1, u'Tipo doc: ') |
|---|
| 2058 | LblPadNumDoc = wx.StaticText(panel, -1, u'N° doc: ') |
|---|
| 2059 | LblPadNac = wx.StaticText(panel, -1, u'Nacionalidad: ') |
|---|
| 2060 | LblPadFechaNac = wx.StaticText (panel, -1, u'Fecha nac: ') |
|---|
| 2061 | LblPadOcu = wx.StaticText(panel, -1, u'Ocupación: ') |
|---|
| 2062 | LblPadTe = wx.StaticText(panel, -1, u'Teléfono: ') |
|---|
| 2063 | PadNom = wx.StaticText(panel, -1, q[0][28]) |
|---|
| 2064 | PadTipoDoc = wx.StaticText(panel, -1, q[0][29]) |
|---|
| 2065 | PadNumDoc = wx.StaticText(panel, -1, q[0][30]) |
|---|
| 2066 | PadNac = wx.StaticText(panel, -1, q[0][31]) |
|---|
| 2067 | PadFechaNac = wx.StaticText(panel, -1, str(q[0][32])) |
|---|
| 2068 | PadOcu = wx.StaticText(panel, -1, q[0][33]) |
|---|
| 2069 | PadTe = wx.StaticText(panel, -1, q[0][35]) |
|---|
| 2070 | cancelarBtn = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 2071 | aceptarBtn = wx.Button(panel, wx.ID_PRINT) |
|---|
| 2072 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 2073 | ppalSizer.Add(topLbl, 0, wx.ALL, 5) |
|---|
| 2074 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 2075 | granSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 2076 | datosSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 2077 | datosSizer.Add(apellidosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2078 | datosSizer.Add(apellidos, 0, wx.EXPAND) |
|---|
| 2079 | datosSizer.Add(nombresLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2080 | datosSizer.Add(nombres, 0, wx.EXPAND) |
|---|
| 2081 | datosSizer.Add(sexoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2082 | datosSizer.Add(sexo, 0, wx.EXPAND) |
|---|
| 2083 | datosSizer.Add(tipodocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2084 | datosSizer.Add(tipodoc, 0, wx.EXPAND) |
|---|
| 2085 | datosSizer.Add(numdocLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2086 | datosSizer.Add(numdoc, 0, wx.EXPAND) |
|---|
| 2087 | datosSizer.Add(nacionalidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2088 | datosSizer.Add(nacionalidad, 0, wx.EXPAND) |
|---|
| 2089 | datosSizer.Add(fechanacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2090 | datosSizer.Add(fechanac, 0, wx.EXPAND) |
|---|
| 2091 | datosSizer.Add(lugarnacLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2092 | datosSizer.Add(lugarnac, 0, wx.EXPAND) |
|---|
| 2093 | datosSizer.Add(datosdomLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2094 | datosSizer.Add((10, 20)) |
|---|
| 2095 | datosSizer.Add(calleLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2096 | datosSizer.Add(calle, 0, wx.EXPAND) |
|---|
| 2097 | datosSizer.Add(numLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2098 | datosSizer.Add(num, 0, wx.EXPAND) |
|---|
| 2099 | datosSizer.Add(pisoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2100 | datosSizer.Add(piso, 0, wx.EXPAND) |
|---|
| 2101 | datosSizer.Add(dptoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2102 | datosSizer.Add(dpto, 0, wx.EXPAND) |
|---|
| 2103 | datosSizer.Add(cpLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2104 | datosSizer.Add(cp, 0, wx.EXPAND) |
|---|
| 2105 | datosSizer.Add(localidadLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2106 | datosSizer.Add(localidad, 0, wx.EXPAND) |
|---|
| 2107 | datosSizer.Add(provinciaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2108 | datosSizer.Add(provincia, 0, wx.EXPAND) |
|---|
| 2109 | datosSizer.Add(teLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2110 | datosSizer.Add(te, 0, wx.EXPAND) |
|---|
| 2111 | datosSizer2 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 2112 | datosSizer2.Add(estudiosLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2113 | datosSizer2.Add(estudios, 0, wx.EXPAND) |
|---|
| 2114 | datosSizer2.Add(hastaLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2115 | datosSizer2.Add(InCompAnio, 0, wx.EXPAND) |
|---|
| 2116 | #datosSizer2.Add(CompInc, 0, wx.EXPAND) |
|---|
| 2117 | datosSizer2.Add(correoLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2118 | datosSizer2.Add(correo, 0, wx.EXPAND) |
|---|
| 2119 | datosSizer2.Add((10, 20)) |
|---|
| 2120 | datosSizer2.Add((10, 20)) |
|---|
| 2121 | datosSizer2.Add((10, 20)) |
|---|
| 2122 | datosSizer2.Add((10, 20)) |
|---|
| 2123 | datosSizer2.Add((10, 20)) |
|---|
| 2124 | datosSizer2.Add((10, 20)) |
|---|
| 2125 | datosSizer2.Add(madreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2126 | datosSizer2.Add(madre, 0, wx.EXPAND) |
|---|
| 2127 | datosSizer2.Add(LblMadNom, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2128 | datosSizer2.Add(MadNom, 0, wx.EXPAND) |
|---|
| 2129 | datosSizer2.Add(LblMadTipoDoc, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2130 | datosSizer2.Add(MadTipoDoc, 0, wx.EXPAND) |
|---|
| 2131 | datosSizer2.Add(LblMadNumDoc, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2132 | datosSizer2.Add(MadNumDoc, 0, wx.EXPAND) |
|---|
| 2133 | datosSizer2.Add(LblMadNac, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2134 | datosSizer2.Add(MadNac, 0, wx.EXPAND) |
|---|
| 2135 | datosSizer2.Add(LblMadFechaNac, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2136 | datosSizer2.Add(MadFechaNac, 0, wx.EXPAND) |
|---|
| 2137 | datosSizer2.Add(LblMadOcu, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2138 | datosSizer2.Add(MadOcu, 0, wx.EXPAND) |
|---|
| 2139 | datosSizer2.Add(LblMadTe, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2140 | datosSizer2.Add(MadTe, 0, wx.EXPAND) |
|---|
| 2141 | datosSizer2.Add((10, 20)) |
|---|
| 2142 | datosSizer2.Add((10, 20)) |
|---|
| 2143 | datosSizer2.Add((10, 20)) |
|---|
| 2144 | datosSizer2.Add(cancelarBtn, 0, wx.ALIGN_RIGHT) |
|---|
| 2145 | datosSizer3 = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) |
|---|
| 2146 | datosSizer3.Add(tratmedLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2147 | datosSizer3.Add(tratmed, 0, wx.EXPAND) |
|---|
| 2148 | datosSizer3.Add(obsLbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2149 | datosSizer3.Add(obs, 0, wx.EXPAND) |
|---|
| 2150 | datosSizer3.Add((10, 20)) |
|---|
| 2151 | datosSizer3.Add((10, 20)) |
|---|
| 2152 | datosSizer3.Add((10, 20)) |
|---|
| 2153 | datosSizer3.Add((10, 20)) |
|---|
| 2154 | datosSizer3.Add((10, 20)) |
|---|
| 2155 | datosSizer3.Add((10, 20)) |
|---|
| 2156 | datosSizer3.Add((10, 20)) |
|---|
| 2157 | datosSizer3.Add((10, 20)) |
|---|
| 2158 | datosSizer3.Add(padreLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2159 | datosSizer3.Add(padre, 0, wx.EXPAND) |
|---|
| 2160 | datosSizer3.Add(LblPadNom, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2161 | datosSizer3.Add(PadNom, 0, wx.EXPAND) |
|---|
| 2162 | datosSizer3.Add(LblPadTipoDoc, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2163 | datosSizer3.Add(PadTipoDoc, 0, wx.EXPAND) |
|---|
| 2164 | datosSizer3.Add(LblPadNumDoc, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2165 | datosSizer3.Add(PadNumDoc, 0, wx.EXPAND) |
|---|
| 2166 | datosSizer3.Add(LblPadNac, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2167 | datosSizer3.Add(PadNac, 0, wx.EXPAND) |
|---|
| 2168 | datosSizer3.Add(LblPadFechaNac, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2169 | datosSizer3.Add(PadFechaNac, 0, wx.EXPAND) |
|---|
| 2170 | datosSizer3.Add(LblPadOcu, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2171 | datosSizer3.Add(PadOcu, 0, wx.EXPAND) |
|---|
| 2172 | datosSizer3.Add(LblPadTe, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) |
|---|
| 2173 | datosSizer3.Add(PadTe, 0, wx.EXPAND) |
|---|
| 2174 | datosSizer3.Add((10, 20)) |
|---|
| 2175 | datosSizer3.Add((10, 20)) |
|---|
| 2176 | datosSizer3.Add((10, 20)) |
|---|
| 2177 | datosSizer3.Add(aceptarBtn, 0, wx.ALIGN_LEFT) |
|---|
| 2178 | granSizer.Add(datosSizer, 1, wx.EXPAND) |
|---|
| 2179 | granSizer.Add(datosSizer2, 1, wx.EXPAND) |
|---|
| 2180 | granSizer.Add(datosSizer3, 1, wx.EXPAND) |
|---|
| 2181 | ppalSizer.Add(granSizer, 1, wx.EXPAND) |
|---|
| 2182 | panel.SetSizer(ppalSizer) |
|---|
| 2183 | ppalSizer.Fit(panel) |
|---|
| 2184 | self.Bind(wx.EVT_BUTTON, self.OnCancelar, cancelarBtn) |
|---|
| 2185 | self.Bind(wx.EVT_BUTTON, self.OnImprimirFichaAlumno, aceptarBtn) |
|---|
| 2186 | c.close() |
|---|
| 2187 | self.frame.Show() |
|---|
| 2188 | |
|---|
| 2189 | # Imprimir la ficha de alumno |
|---|
| 2190 | def OnImprimirFichaAlumno(self, evt): |
|---|
| 2191 | pass |
|---|
| 2192 | |
|---|
| 2193 | # Ficha de curso |
|---|
| 2194 | def OnFichaCursos(self, evt): |
|---|
| 2195 | dlg = wx.TextEntryDialog(self, u'Ingrese el número de curso a listar',u'Ficha de Cursos', '') |
|---|
| 2196 | if dlg.ShowModal() == wx.ID_OK: |
|---|
| 2197 | c = self.db.cursor() |
|---|
| 2198 | num_curso = dlg.GetValue() |
|---|
| 2199 | dlg.Destroy() |
|---|
| 2200 | c.execute('''SELECT id_alumno FROM curso_%s''' % (num_curso)) |
|---|
| 2201 | q = c.fetchall() |
|---|
| 2202 | c.execute ('''TRUNCATE table fichacurso''') |
|---|
| 2203 | for alumno in q: |
|---|
| 2204 | c.execute('''SELECT nombres, apellidos, nacionalidad, fecha_nac, tipo_doc, num_doc, calle_dom, num_dom, localidad_dom, sexo FROM alumnos WHERE id_alumno = %s''' % (int(alumno[0]))) |
|---|
| 2205 | r = c.fetchone() |
|---|
| 2206 | apell_nombre = r[1] + u' '+ r[0] |
|---|
| 2207 | nac = r[2] |
|---|
| 2208 | fecha_nac = r[3] |
|---|
| 2209 | tipo_doc = r[4] |
|---|
| 2210 | if tipo_doc == 'ET': |
|---|
| 2211 | tipo_doc = u'En trámite' |
|---|
| 2212 | num_doc = r[5] |
|---|
| 2213 | domicilio = r[6] + u' '+ r[7] + u' '+ r[8] |
|---|
| 2214 | sexo = r[9] |
|---|
| 2215 | c.execute('''INSERT INTO fichacurso (apell_nom, nac, fecha_nac, tipo_doc, num_doc, domicilio, sexo) VALUES (%s, %s, %s, %s, %s, %s, %s)''', (apell_nombre, nac, fecha_nac, tipo_doc, num_doc, domicilio, sexo)) |
|---|
| 2216 | c.execute('''SELECT tipo, especialidad, instructor, fecha_inicio, fecha_final, horas, horario, establecimiento FROM cursos WHERE num_curso = %s''', (num_curso)) |
|---|
| 2217 | q = c.fetchone() |
|---|
| 2218 | c.execute('''SELECT tipo, numero, calle, num_puerta, localidad FROM establecimientos WHERE nombre = %s''', (q[7])) |
|---|
| 2219 | r = c.fetchone() |
|---|
| 2220 | c.execute('''SELECT nombre, localidad FROM miescuela LIMIT 1''') |
|---|
| 2221 | s = c.fetchone() |
|---|
| 2222 | f = open ('./html/fichcurso.html', 'w') |
|---|
| 2223 | f.write('<html>\n') |
|---|
| 2224 | f.write('<head>\n') |
|---|
| 2225 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 2226 | f.write('</head>\n') |
|---|
| 2227 | f.write('<body>\n') |
|---|
| 2228 | f.write('<table border="2" cellspacing="0" width="1186">\n') |
|---|
| 2229 | f.write('<tbody><tr valign="top"><td colspan="2" height="7"><h2 align="center"><font face="Times New Roman" size="2">âââââ<b>PROVINCIA DE BUENOS AIRES</b></font></h2>\n') |
|---|
| 2230 | f.write('<p align="center"><font face="Times New Roman" size="2"><b>Dirección General de Cultura y Educación</b></font></p></td><td colspan="5"><h1 align="center"><font face="Times New Roman" size="3">Dirección de Formación Profesional</font></h1></td>') |
|---|
| 2231 | f.write ('<td colspan="6"><font face="Times New Roman" size="2"><b><center>ESTABLECIMIENTO: ') |
|---|
| 2232 | f.write ('%s </center>'% unicode.encode(s[0], 'utf-8')) |
|---|
| 2233 | f.write ('</b></font>') |
|---|
| 2234 | f.write ('<p align="center"><font face="Times New Roman" size="2"><b>LOCALIDAD: ') |
|---|
| 2235 | f.write ('%s</b></font></p></td>'% unicode.encode(s[1], 'utf-8')) |
|---|
| 2236 | f.write ('<td colspan="3"> <h3 align="center"><font face="Times New Roman" size="2"><b>FICHA DE CURSO</b></font></h3></td></tr>') |
|---|
| 2237 | f.write ('<tr valign="top"><td colspan="12"> <br><font face="Times New Roman" size="2"><b>ESPECIALIDAD: </b><i>%s</i>' % unicode.encode(q[1], 'utf-8')) |
|---|
| 2238 | f.write (' <b>TIPO: %s ' % unicode.encode(q[0], 'utf-8')) |
|---|
| 2239 | f.write ('DURACION HS. RELOJ: %s </b></font>' % unicode.encode(q[5], 'utf-8')) |
|---|
| 2240 | f.write ('<p><font face="Times New Roman" size="2"><b>FECHA DE INICIACION: %s-%s-%s ' % (q[3].day, q[3].month, q[3].year)) |
|---|
| 2241 | f.write ('FECHA DE TERMINACION: %s-%s-%s ' % (q[4].day, q[4].month, q[4].year)) |
|---|
| 2242 | f.write ('HORARIO: %s</b></font> <br></p>' % q[6]) |
|---|
| 2243 | f.write ('<p><font face="Times New Roman" size="2"><b>LUGAR EN QUE SE DICTA: %s %s %s ' % (unicode.encode(r[2], 'utf-8'), unicode.encode(r[3], 'utf-8'), unicode.encode(r[4], 'utf-8'))) |
|---|
| 2244 | f.write ('INSTRUCTOR: %s </b></font></p></td>' % unicode.encode(q[2], 'utf-8')) |
|---|
| 2245 | f.write ('<td colspan="4"> <br><font face="Times New Roman" size="2"><b><center>Acto Administrativo</b>................<wbr>................</center></font> <b> <br>') |
|---|
| 2246 | f.write ('<p align="center"><font face="Times New Roman" size="2"><b>CURSO Nº %s</b></font></p></td></tr>' % unicode.encode(num_curso, 'utf-8')) |
|---|
| 2247 | f.write ('<tr valign="top"><td rowspan="2" height="16" width="10"> <br><font face="Times New Roman" size="1"><b>Nº</b></font></td>') |
|---|
| 2248 | f.write ('<td colspan="2" rowspan="2"> <br><h1 align="center"><font face="Times New Roman" size="1"><b>APELLIDO Y NOMBRES</b></font></h1></td>') |
|---|
| 2249 | f.write ('<td rowspan="2"> <br><h1 align="center"><font face="Times New Roman" size="1"><b>Nacionalidad</b></font></h1></td>') |
|---|
| 2250 | f.write ('<td rowspan="2"> <br><h1 align="center"><font face="Times New Roman" size="1"><b>Fecha de nac:</b></font></h1></td>') |
|---|
| 2251 | f.write ('<td colspan="5"><font face="Times New Roman" size="1"><b>Documento de Identidad</b></font></td>') |
|---|
| 2252 | f.write ('<td> </td>') |
|---|
| 2253 | f.write ('<td colspan="3" rowspan="2"> <br><font face="Times New Roman" size="1"><b>Domicilio y Localidad</b></font></td>') |
|---|
| 2254 | f.write ('<td rowspan="2"> <br><font face="Times New Roman" size="1">Esp.</font></td></tr>') |
|---|
| 2255 | f.write ('<tr valign="top"><td height="15"><font face="Times New Roman" size="2">Tipo</font></td>') |
|---|
| 2256 | f.write ('<td colspan="2"><font face="Times New Roman" size="2">Número</font></td>') |
|---|
| 2257 | f.write ('<td><font face="Times New Roman" size="2">Expedido por</font></td>') |
|---|
| 2258 | f.write ('<td colspan="2"><font face="Times New Roman" size="2">D.M.</font></td></tr>') |
|---|
| 2259 | c.execute (''' SELECT * FROM fichacurso ORDER BY sexo DESC, apell_nom''') |
|---|
| 2260 | t = c.fetchall() |
|---|
| 2261 | orden = 1 |
|---|
| 2262 | |
|---|
| 2263 | # Tabla para devolver la nacionalidad completa |
|---|
| 2264 | for alumno in range(len(t)): |
|---|
| 2265 | if t[alumno][2].lower() == u'ar': |
|---|
| 2266 | nacion = u'Argentina' |
|---|
| 2267 | elif t[alumno][2].lower() == u'pe': |
|---|
| 2268 | nacion = u'Peruana' |
|---|
| 2269 | elif t[alumno][2].lower() == u'py': |
|---|
| 2270 | nacion = u'Paraguaya' |
|---|
| 2271 | elif t[alumno][2].lower() == u'uy': |
|---|
| 2272 | nacion = u'Uruguaya' |
|---|
| 2273 | elif t[alumno][2].lower() == u'bo': |
|---|
| 2274 | nacion = u'Boliviana' |
|---|
| 2275 | elif t[alumno][2].lower() == u'br': |
|---|
| 2276 | nacion = u'Brasileña' |
|---|
| 2277 | elif t[alumno][2].lower() == u'it': |
|---|
| 2278 | nacion = u'Italiana' |
|---|
| 2279 | elif t[alumno][2].lower() == u'es': |
|---|
| 2280 | nacion = u'Española' |
|---|
| 2281 | elif t[alumno][2].lower() == u'cl': |
|---|
| 2282 | nacion = u'Chilena' |
|---|
| 2283 | elif t[alumno][2].lower() == u'ec': |
|---|
| 2284 | nacion = u'Ecuatoriana' |
|---|
| 2285 | elif t[alumno][2].lower() == u've': |
|---|
| 2286 | nacion = u'Venezolana' |
|---|
| 2287 | elif t[alumno][2].lower() == u'co': |
|---|
| 2288 | nacion = u'Colombiana' |
|---|
| 2289 | else: |
|---|
| 2290 | nacion = u' ' |
|---|
| 2291 | |
|---|
| 2292 | # Me fijo si no tiene DNI y si es asà le pongo 'En trámite' |
|---|
| 2293 | if t[alumno][4] == u'PAS' or t[alumno][4] == u'ET': |
|---|
| 2294 | doc = u'DNI' |
|---|
| 2295 | num = u'En trámite' |
|---|
| 2296 | else: |
|---|
| 2297 | doc = t[alumno][4] |
|---|
| 2298 | num = t[alumno][5] |
|---|
| 2299 | |
|---|
| 2300 | # Doy vuelta la fecha para que se lea bien en la ficha de curso |
|---|
| 2301 | dia_actual = t[alumno][3] |
|---|
| 2302 | dia = dia_actual.day |
|---|
| 2303 | mes = dia_actual.month + 1 |
|---|
| 2304 | anio = dia_actual.year |
|---|
| 2305 | nac = str(dia) + '-' + str(mes) + '-' + str(anio) |
|---|
| 2306 | |
|---|
| 2307 | # Armo al fin la ficha de curso |
|---|
| 2308 | f.write ('<tr valign="top"><td height="8"><font face="Times New Roman" size="1">%s</font></td><td colspan="2"><font face="Times New Roman" size="1">%s</font></td><td><font face="Times New Roman" size="1">%s</font></td><td><font face="Times New Roman" size="1">%s</font></td><td><font face="Times New Roman" size="1">%s</font></td><td colspan="2"><font face="Times New Roman" size="1">%s</font></td><td><font face="Times New Roman" size="1">%s</font></td><td colspan="2"><font face="Times New Roman" size="1">-</font></td><td colspan="3"><font face="Times New Roman" size="1">%s</font></td><td><font face="Times New Roman" size="1">-</font></td></font></tr>' % (orden, unicode.encode(t[alumno][1], 'utf-8'), unicode.encode(nacion, 'utf-8'), nac, unicode.encode(doc, 'utf-8'), unicode.encode(num, 'utf-8'), 'RNP', unicode.encode(t[alumno][6], 'utf-8'))) |
|---|
| 2309 | orden += 1 |
|---|
| 2310 | f.write('</tbody></table>') |
|---|
| 2311 | f.write('</div>') |
|---|
| 2312 | f.write('<p><font face="Times New Roman"size="2"> <wbr> <wbr> <wbr> <wbr> Nota: Entregar 1 original y 3 copias</font></p><p><font face="Times New Roman"size="2"> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> Sello </font></p><p><font face="Times New Roman" size="1"> ..............................<wbr>.......................... <wbr> <wbr> <wbr> Fecha........................</font> <br></p>') |
|---|
| 2313 | f.write('<p><font face="Times New Roman"size="1"> Firma del Inspector</font> <br></p><p>âââââ<font face="Times New Roman"size="1"> <wbr> <wbr> <wbr> <wbr> </font></p></div>') |
|---|
| 2314 | f.close() |
|---|
| 2315 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 2316 | import wx.html as htm |
|---|
| 2317 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (10, 10), (800, 600)) |
|---|
| 2318 | self.frame.CenterOnScreen() |
|---|
| 2319 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 2320 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 2321 | self.html.LoadPage('./html/fichcurso.html') |
|---|
| 2322 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 2323 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 2324 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 2325 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 2326 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 2327 | self.frame.Show() |
|---|
| 2328 | |
|---|
| 2329 | def OnCanc (self, evt): |
|---|
| 2330 | self.frame.Destroy() |
|---|
| 2331 | self.Close() |
|---|
| 2332 | |
|---|
| 2333 | def OnImp (self,evt): |
|---|
| 2334 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 2335 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 2336 | self.Close() |
|---|
| 2337 | |
|---|
| 2338 | |
|---|
| 2339 | |
|---|
| 2340 | # Gastos nuevos por perÃodo |
|---|
| 2341 | def OnGastNuPer(self, evt): |
|---|
| 2342 | self.GNPPer=wx.Frame(self, -1, u'Gastos por perÃodo', size=(300, 200), style=wx.FRAME_TOOL_WINDOW) |
|---|
| 2343 | self.GNPPer.CenterOnScreen() |
|---|
| 2344 | panel = wx.Panel(self.GNPPer, -1 ) |
|---|
| 2345 | Lblsel = wx.StaticText(panel, -1, u'Seleccione el perÃodo: ', (20, 20)) |
|---|
| 2346 | radio1 = wx.RadioButton(panel, -1, u'Anual', (20, 60), style=wx.RB_GROUP) |
|---|
| 2347 | radio2 = wx.RadioButton(panel, -1, u'Mensual', (20, 90)) |
|---|
| 2348 | self.anual = wx.SpinCtrl(panel, -1, u'', (120, 60), (120, -1)) |
|---|
| 2349 | self.anual.SetRange(1990, 2100) |
|---|
| 2350 | self.anual.SetValue(2009) |
|---|
| 2351 | meses = [u'enero', u'febrero', u'marzo', u'abril', u'mayo', u'junio', u'julio', u'agosto', |
|---|
| 2352 | u'setiembre', u'octubre', u'noviembre', u'diciembre'] |
|---|
| 2353 | self.mensual = wx.ComboBox(panel, -1, u'enero', (120, 90), (100, -1), meses, wx.CB_DROPDOWN) |
|---|
| 2354 | self.texts = {u'Anual': self.anual, u'Mensual': self.mensual} |
|---|
| 2355 | self.mensual.Enable(False) |
|---|
| 2356 | for eachRadio in [radio1, radio2]: |
|---|
| 2357 | self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioGastos, eachRadio) |
|---|
| 2358 | self.selectedTextGastos = self.anual |
|---|
| 2359 | BtnCancelar = wx.Button(panel, wx.ID_CANCEL,pos = (100, 150)) |
|---|
| 2360 | self.Bind(wx.EVT_BUTTON, self.OnCloseGastos, BtnCancelar) |
|---|
| 2361 | BtnAceptar = wx.Button(panel, wx.ID_OK, pos = (200, 150)) |
|---|
| 2362 | self.Bind(wx.EVT_BUTTON, self.OnGastNuPerPrinc, BtnAceptar) |
|---|
| 2363 | self.GNPPer.Show(True) |
|---|
| 2364 | |
|---|
| 2365 | def OnGastNuPerPrinc(self, event): |
|---|
| 2366 | import wx.grid |
|---|
| 2367 | self.GasNuPerPr = wx.Frame(self, -1, u'Gastos por perÃodo', size=(800, 600)) |
|---|
| 2368 | self.GasNuPerPr.CenterOnScreen() |
|---|
| 2369 | self.panel = wx.Panel(self.GasNuPerPr, -1) |
|---|
| 2370 | self.mes = self.mensual.GetValue() |
|---|
| 2371 | label = wx.StaticText(self.panel, -1, u'Gastos correspondientes al perÃodo : %s' %(self.mes), |
|---|
| 2372 | pos = (20, 15)) |
|---|
| 2373 | self.grilla = wx.grid.Grid(self.panel, -1, (25, 50), (750, 400), style=wx.WANTS_CHARS) |
|---|
| 2374 | self.grilla.CreateGrid(125, 6) |
|---|
| 2375 | colLabels = [u'Fecha', u'Descripción', u'Responsable', u'In', u'Out', u'Observaciones'] |
|---|
| 2376 | for col in range (6): |
|---|
| 2377 | self.grilla.SetColLabelValue(col, colLabels[col]) |
|---|
| 2378 | self.grilla.SetColSize(0, 80) |
|---|
| 2379 | self.grilla.SetColSize(1, 210) |
|---|
| 2380 | self.grilla.SetColSize(2, 103) |
|---|
| 2381 | self.grilla.SetColSize(3, 70) |
|---|
| 2382 | self.grilla.SetColSize(4, 70) |
|---|
| 2383 | self.grilla.SetColSize(5, 110) |
|---|
| 2384 | self.GNPPer.Destroy() |
|---|
| 2385 | self.saldo = 0 |
|---|
| 2386 | self.labelsaldo = wx.StaticText(self.panel, -1, u'El saldo del perÃodo es : %s' %(str(self.saldo)), |
|---|
| 2387 | pos = (20, 500)) |
|---|
| 2388 | BtnCancelar = wx.Button(self.panel, wx.ID_CANCEL, pos = (685, 540)) |
|---|
| 2389 | BtnRefrescar = wx.Button(self.panel, wx.ID_REFRESH, pos = (250, 540)) |
|---|
| 2390 | BtnGuardar = wx.Button(self.panel, wx.ID_SAVE, pos = (350, 540)) |
|---|
| 2391 | BtnExportar = wx.Button(self.panel, wx.ID_SAVEAS, pos = (450, 540)) |
|---|
| 2392 | BtnImprimir = wx.Button(self.panel, wx.ID_PRINT, pos = (585, 540)) |
|---|
| 2393 | self.Bind(wx.EVT_BUTTON, self.OnCloseCaja, BtnCancelar) |
|---|
| 2394 | self.Bind(wx.EVT_BUTTON, self.OnCalcularCaja, BtnRefrescar) |
|---|
| 2395 | self.Bind(wx.EVT_BUTTON, self.OnGuardarPlanilla, BtnGuardar) |
|---|
| 2396 | self.GasNuPerPr.Show(True) |
|---|
| 2397 | |
|---|
| 2398 | |
|---|
| 2399 | |
|---|
| 2400 | def OnCloseGastos(self, event): |
|---|
| 2401 | self.GNPPer.Destroy() |
|---|
| 2402 | |
|---|
| 2403 | #Selección de perÃodo a crear |
|---|
| 2404 | def OnRadioGastos(self, event): |
|---|
| 2405 | if self.selectedTextGastos: |
|---|
| 2406 | self.selectedTextGastos.Enable(False) |
|---|
| 2407 | radioSelected = event.GetEventObject() |
|---|
| 2408 | textGastos = self.texts[radioSelected.GetLabel()] |
|---|
| 2409 | textGastos.Enable(True) |
|---|
| 2410 | self.selectedTextGastos = textGastos |
|---|
| 2411 | |
|---|
| 2412 | #Cancelar Planilla |
|---|
| 2413 | def OnCloseCaja(self, event): |
|---|
| 2414 | self.GasNuPerPr.Destroy() |
|---|
| 2415 | |
|---|
| 2416 | #Calcular Saldo de Caja |
|---|
| 2417 | def OnCalcularCaja(self, event): |
|---|
| 2418 | ingreso = 0 |
|---|
| 2419 | egreso = 0 |
|---|
| 2420 | for entrada in range (125): |
|---|
| 2421 | try: |
|---|
| 2422 | ingreso = ingreso + float(self.grilla.GetCellValue(entrada, 3)) |
|---|
| 2423 | except ValueError: |
|---|
| 2424 | pass |
|---|
| 2425 | try: |
|---|
| 2426 | egreso = egreso + float(self.grilla.GetCellValue(entrada, 4)) |
|---|
| 2427 | except ValueError: |
|---|
| 2428 | pass |
|---|
| 2429 | self.saldo = ingreso - egreso |
|---|
| 2430 | self.labelsaldo.SetLabel(u'El saldo del perÃodo es : %s' %(str(self.saldo))) |
|---|
| 2431 | |
|---|
| 2432 | |
|---|
| 2433 | #Guardar Planilla actual |
|---|
| 2434 | def OnGuardarPlanilla(self, event): |
|---|
| 2435 | ahora = wx.Now() |
|---|
| 2436 | anio = ahora[-4:] |
|---|
| 2437 | f=open('./planillas/%s_%s' %(self.mes, anio), 'w') |
|---|
| 2438 | for y in range (125): |
|---|
| 2439 | for x in range (6): |
|---|
| 2440 | valor = self.grilla.GetCellValue(y, x) |
|---|
| 2441 | f.write('%s;' %valor), |
|---|
| 2442 | f.write('\n') |
|---|
| 2443 | |
|---|
| 2444 | |
|---|
| 2445 | # Abrir gasto por perÃodo |
|---|
| 2446 | def OnAbrGastPer(self, evt): |
|---|
| 2447 | pass |
|---|
| 2448 | |
|---|
| 2449 | # Gastos nuevos por proyecto |
|---|
| 2450 | def OnGastNuProy(self, evt): |
|---|
| 2451 | import wx.grid |
|---|
| 2452 | # Creo el diálogo para darle al proyecto un nombre |
|---|
| 2453 | self.dlg = wx.TextEntryDialog(None, u'Nombre del proyecto', u'Nombre del proyecto', u'', style=wx.OK|wx.CANCEL, pos=(300, 300)) |
|---|
| 2454 | if self.dlg.ShowModal() == wx.ID_OK: |
|---|
| 2455 | self.proyectonuevo = self.dlg.GetValue() |
|---|
| 2456 | else: |
|---|
| 2457 | self.dlg.Destroy() |
|---|
| 2458 | return |
|---|
| 2459 | self.dlg.Destroy() |
|---|
| 2460 | self.GasNuProy = wx.Frame(self, -1, u'Gastos por proyecto', (10,10), (800, 600)) |
|---|
| 2461 | self.panel = wx.Panel(self.GasNuProy, -1) |
|---|
| 2462 | label = wx.StaticText(self.panel, -1, u'Gastos correspondientes al proyecto : %s' %(self.proyectonuevo) , pos = (20, 15)) |
|---|
| 2463 | self.grilla = wx.grid.Grid(self.panel, -1, (25, 50), (750, 400), style=wx.WANTS_CHARS) |
|---|
| 2464 | self.grilla.CreateGrid(125, 6) |
|---|
| 2465 | colLabels = [u'Fecha', u'Descripción', u'Responsable', u'In', u'Out', u'Observaciones'] |
|---|
| 2466 | for col in range (6): |
|---|
| 2467 | self.grilla.SetColLabelValue(col, colLabels[col]) |
|---|
| 2468 | self.grilla.SetColSize(0, 80) |
|---|
| 2469 | self.grilla.SetColSize(1, 210) |
|---|
| 2470 | self.grilla.SetColSize(2, 103) |
|---|
| 2471 | self.grilla.SetColSize(3, 70) |
|---|
| 2472 | self.grilla.SetColSize(4, 70) |
|---|
| 2473 | self.grilla.SetColSize(5, 110) |
|---|
| 2474 | self.saldo = 0 |
|---|
| 2475 | self.labelsaldo = wx.StaticText(self.panel, -1, u'El saldo de la caja es : %s' %(str(self.saldo)), |
|---|
| 2476 | pos = (20, 500)) |
|---|
| 2477 | BtnCancelar = wx.Button(self.panel, wx.ID_CANCEL, pos = (685, 540)) |
|---|
| 2478 | BtnRefrescar = wx.Button(self.panel, wx.ID_REFRESH, pos = (250, 540)) |
|---|
| 2479 | BtnGuardar = wx.Button(self.panel, wx.ID_SAVE, pos = (350, 540)) |
|---|
| 2480 | BtnExportar = wx.Button(self.panel, wx.ID_SAVEAS, pos = (450, 540)) |
|---|
| 2481 | BtnImprimir = wx.Button(self.panel, wx.ID_PRINT, pos = (585, 540)) |
|---|
| 2482 | self.Bind(wx.EVT_BUTTON, self.OnCloseCajaProy, BtnCancelar) |
|---|
| 2483 | self.Bind(wx.EVT_BUTTON, self.OnCalcularCajaProy, BtnRefrescar) |
|---|
| 2484 | self.Bind(wx.EVT_BUTTON, self.OnGuardarPlanillaProy, BtnGuardar) |
|---|
| 2485 | self.GasNuProy.Show(True) |
|---|
| 2486 | |
|---|
| 2487 | #Cancelar Planilla |
|---|
| 2488 | def OnCloseCajaProy(self, event): |
|---|
| 2489 | self.GasNuProy.Destroy() |
|---|
| 2490 | |
|---|
| 2491 | |
|---|
| 2492 | #Guardar Planilla actual |
|---|
| 2493 | def OnGuardarPlanillaProy(self, event): |
|---|
| 2494 | ahora = wx.Now() |
|---|
| 2495 | anio = ahora[-4:] |
|---|
| 2496 | f=open('./proyectos/%s' %(self.proyectonuevo), 'w') |
|---|
| 2497 | for y in range (125): |
|---|
| 2498 | for x in range (6): |
|---|
| 2499 | valor = self.grilla.GetCellValue(y, x) |
|---|
| 2500 | f.write('%s;' %valor), |
|---|
| 2501 | f.write('\n') |
|---|
| 2502 | |
|---|
| 2503 | |
|---|
| 2504 | # Abrir gasto por proyecto |
|---|
| 2505 | def OnAbrGastProy(self, evt): |
|---|
| 2506 | import os |
|---|
| 2507 | import wx.grid |
|---|
| 2508 | listado = os.listdir('./proyectos') |
|---|
| 2509 | dlg = wx.SingleChoiceDialog(self, u'Seleccione el proyecto a editar:', u'Abrir planilla de gastos', listado) |
|---|
| 2510 | if (dlg.ShowModal() == wx.ID_OK): |
|---|
| 2511 | self.proyecto = dlg.GetStringSelection() |
|---|
| 2512 | dlg.Destroy() |
|---|
| 2513 | self.GasAbrProy = wx.Frame(self, -1, u'Gastos por proyecto', (10,10), (800, 600)) |
|---|
| 2514 | self.panel = wx.Panel(self.GasAbrProy, -1) |
|---|
| 2515 | label = wx.StaticText(self.panel, -1, u'Gastos correspondientes al proyecto : %s' %(self.proyecto), |
|---|
| 2516 | pos = (20, 15)) |
|---|
| 2517 | self.grilla = wx.grid.Grid(self.panel, -1, (25, 50), (750, 400), style=wx.WANTS_CHARS) |
|---|
| 2518 | self.grilla.CreateGrid(125, 6) |
|---|
| 2519 | colLabels = [u'Fecha', u'Descripción', u'Responsable', u'In', u'Out', u'Observaciones'] |
|---|
| 2520 | for col in range (6): |
|---|
| 2521 | self.grilla.SetColLabelValue(col, colLabels[col]) |
|---|
| 2522 | self.grilla.SetColSize(0, 80) |
|---|
| 2523 | self.grilla.SetColSize(1, 210) |
|---|
| 2524 | self.grilla.SetColSize(2, 103) |
|---|
| 2525 | self.grilla.SetColSize(3, 70) |
|---|
| 2526 | self.grilla.SetColSize(4, 70) |
|---|
| 2527 | self.grilla.SetColSize(5, 110) |
|---|
| 2528 | self.saldo = 0 |
|---|
| 2529 | self.labelsaldo = wx.StaticText(self.panel, -1, u'El saldo de la caja es : %s' %(str(self.saldo)), |
|---|
| 2530 | pos = (20, 500)) |
|---|
| 2531 | BtnCancelar = wx.Button(self.panel, wx.ID_CANCEL, pos = (685, 540)) |
|---|
| 2532 | BtnRefrescar = wx.Button(self.panel, wx.ID_REFRESH, pos = (250, 540)) |
|---|
| 2533 | BtnGuardar = wx.Button(self.panel, wx.ID_SAVE, pos = (350, 540)) |
|---|
| 2534 | BtnExportar = wx.Button(self.panel, wx.ID_SAVEAS, pos = (450, 540)) |
|---|
| 2535 | BtnImprimir = wx.Button(self.panel, wx.ID_PRINT, pos = (585, 540)) |
|---|
| 2536 | self.Bind(wx.EVT_BUTTON, self.OnCloseCajaProyAbrProy, BtnCancelar) |
|---|
| 2537 | self.Bind(wx.EVT_BUTTON, self.OnCalcularCajaProy, BtnRefrescar) |
|---|
| 2538 | self.Bind(wx.EVT_BUTTON, self.OnGuardarPlanillaExistenteAbrProy, BtnGuardar) |
|---|
| 2539 | f = open('./proyectos/%s' %(self.proyecto), 'r') |
|---|
| 2540 | c = 0 |
|---|
| 2541 | for linea in f.readlines(): |
|---|
| 2542 | a = linea.split(';') |
|---|
| 2543 | for i in range (6): |
|---|
| 2544 | self.grilla.SetCellValue(c, i, a[i]) |
|---|
| 2545 | c = c + 1 |
|---|
| 2546 | f.close() |
|---|
| 2547 | ingreso = 0 |
|---|
| 2548 | egreso = 0 |
|---|
| 2549 | for entrada in range (125): |
|---|
| 2550 | try: |
|---|
| 2551 | ingreso = ingreso + float(self.grilla.GetCellValue(entrada, 3)) |
|---|
| 2552 | except ValueError: |
|---|
| 2553 | pass |
|---|
| 2554 | try: |
|---|
| 2555 | egreso = egreso + float(self.grilla.GetCellValue(entrada, 4)) |
|---|
| 2556 | except ValueError: |
|---|
| 2557 | pass |
|---|
| 2558 | self.saldo = ingreso - egreso |
|---|
| 2559 | self.labelsaldo.SetLabel(u'El saldo de la caja es : %s' %(str(self.saldo))) |
|---|
| 2560 | self.GasAbrProy.Show(True) |
|---|
| 2561 | |
|---|
| 2562 | #Cancelar Planilla |
|---|
| 2563 | def OnCloseCajaProyAbrProy(self, event): |
|---|
| 2564 | self.GasAbrProy.Destroy() |
|---|
| 2565 | |
|---|
| 2566 | |
|---|
| 2567 | #Guardar Planilla existente |
|---|
| 2568 | def OnGuardarPlanillaExistenteAbrProy(self, event): |
|---|
| 2569 | ahora = wx.Now() |
|---|
| 2570 | anio = ahora[-4:] |
|---|
| 2571 | f=open('./proyectos/%s' %(self.proyecto), 'w') |
|---|
| 2572 | for y in range (125): |
|---|
| 2573 | for x in range (6): |
|---|
| 2574 | valor = self.grilla.GetCellValue(y, x) |
|---|
| 2575 | f.write('%s;' %valor), |
|---|
| 2576 | f.write('\n') |
|---|
| 2577 | |
|---|
| 2578 | #Calcular Saldo de Caja |
|---|
| 2579 | def OnCalcularCajaProy(self, event): |
|---|
| 2580 | ingreso = 0 |
|---|
| 2581 | egreso = 0 |
|---|
| 2582 | for entrada in range (125): |
|---|
| 2583 | try: |
|---|
| 2584 | ingreso = ingreso + float(self.grilla.GetCellValue(entrada, 3)) |
|---|
| 2585 | except ValueError: |
|---|
| 2586 | pass |
|---|
| 2587 | try: |
|---|
| 2588 | egreso = egreso + float(self.grilla.GetCellValue(entrada, 4)) |
|---|
| 2589 | except ValueError: |
|---|
| 2590 | pass |
|---|
| 2591 | self.saldo = ingreso - egreso |
|---|
| 2592 | self.labelsaldo.SetLabel(u'El saldo de la caja es : %s' %(str(self.saldo))) |
|---|
| 2593 | |
|---|
| 2594 | |
|---|
| 2595 | # Nueva gestión |
|---|
| 2596 | def OnNuevaGestion(self, evt): |
|---|
| 2597 | import editor |
|---|
| 2598 | ventana = editor.RichTextFrame(self, -1, u'Nuevo documento de gestión', size=(700, 500), style = wx.DEFAULT_FRAME_STYLE) |
|---|
| 2599 | ventana.CenterOnScreen() |
|---|
| 2600 | ventana.Show(True) |
|---|
| 2601 | |
|---|
| 2602 | # Temario |
|---|
| 2603 | def OnTemario(self, evt): |
|---|
| 2604 | from reportlab.lib.pagesizes import legal |
|---|
| 2605 | import temario |
|---|
| 2606 | c = temario.canvas.Canvas("./planillas/temario.pdf", pagesize=legal) |
|---|
| 2607 | temario.temarios(c) |
|---|
| 2608 | c.showPage() |
|---|
| 2609 | c.save() |
|---|
| 2610 | |
|---|
| 2611 | |
|---|
| 2612 | # Acerca de |
|---|
| 2613 | def OnAbout(self, evt): |
|---|
| 2614 | try: |
|---|
| 2615 | self.frame.Close() |
|---|
| 2616 | finally: |
|---|
| 2617 | # En el about se incorpora la GPL original en inglés que es la que vale |
|---|
| 2618 | from wx.lib.wordwrap import wordwrap |
|---|
| 2619 | import gpl |
|---|
| 2620 | info = wx.AboutDialogInfo() |
|---|
| 2621 | info.Name = u'Administrador SancaBase' |
|---|
| 2622 | info.Version = u'0.8.0' |
|---|
| 2623 | info.Copyright = u'Copyleft Javier Castrillo' |
|---|
| 2624 | info.Description = u'''Esta aplicación está pensada desde el CFP 401 |
|---|
| 2625 | de Vicente López hacia todos los centros |
|---|
| 2626 | de Formación Profesional que dÃa a dÃa ponen |
|---|
| 2627 | lo mejor de sà en pos de enriquecer a la siempre |
|---|
| 2628 | olvidada y rezagada educación de los pueblos.''' |
|---|
| 2629 | info.WebSite = (u'http://www.sancayetano.esc.edu.ar', u'Sitio de nuestro centro') |
|---|
| 2630 | info.Developers = [ u'Javier Castrillo riverplatense at gmail dot com'] |
|---|
| 2631 | info.License = wordwrap(gpl.licenseText, 500, wx.ClientDC(self)) |
|---|
| 2632 | wx.AboutBox(info) |
|---|
| 2633 | |
|---|
| 2634 | # Cancelar (válido para cualquiera de los diálogos) |
|---|
| 2635 | def OnCancelar(self, event): |
|---|
| 2636 | self.frame.Close() |
|---|
| 2637 | |
|---|
| 2638 | # Clase Listado de Alumnos |
|---|
| 2639 | class ListAlumFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 2640 | def __init__(self): |
|---|
| 2641 | wx.Frame.__init__(self, None, -1, u'Listado de alumnos:', pos=(30, 120), size=(800, 490)) |
|---|
| 2642 | self.CenterOnScreen() |
|---|
| 2643 | f=open('listalum.py', 'r') |
|---|
| 2644 | imp.load_module('listalum', f, 'listalum', ('.py', 'U', 1)) |
|---|
| 2645 | import listalum as listalum |
|---|
| 2646 | f.close() |
|---|
| 2647 | panel = wx.Panel(self, -1) |
|---|
| 2648 | LblLa = wx.StaticText(panel, -1, u'Listado General de Alumnos:') |
|---|
| 2649 | LblLa.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 2650 | self.list = wx.ListCtrl(panel, -1, size=(800, 390), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 2651 | for col, text in enumerate(listalum.columns): |
|---|
| 2652 | self.list.InsertColumn(col, text.decode('utf-8')) |
|---|
| 2653 | self.itemDataMap = {} |
|---|
| 2654 | for item in listalum.rows: |
|---|
| 2655 | index = self.list.InsertStringItem(sys.maxint, str(item[0])) |
|---|
| 2656 | for col, text in enumerate(item[1:]): |
|---|
| 2657 | self.list.SetStringItem(index, col+1, text) |
|---|
| 2658 | self.list.SetItemData(index, index) |
|---|
| 2659 | self.itemDataMap[index] = item |
|---|
| 2660 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 2661 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 2662 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 2663 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 2664 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 2665 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE) |
|---|
| 2666 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 2667 | self.list.SetColumnWidth(7, wx.LIST_AUTOSIZE) |
|---|
| 2668 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(listalum.columns)) |
|---|
| 2669 | BtnImpresion = wx.Button(panel, wx.ID_PRINT) |
|---|
| 2670 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 2671 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 2672 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 2673 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 2674 | ppalSizer.Add(LblLa, 0, wx.ALL, 5) |
|---|
| 2675 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 2676 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 2677 | datosSizer.AddGrowableCol(0) |
|---|
| 2678 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 2679 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 2680 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 2681 | btnSizer.Add((20,20), 1) |
|---|
| 2682 | btnSizer.Add(BtnImpresion) |
|---|
| 2683 | btnSizer.Add((20,20), 1) |
|---|
| 2684 | btnSizer.Add(BtnCancelarImp) |
|---|
| 2685 | btnSizer.Add((20,20), 1) |
|---|
| 2686 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 2687 | panel.SetSizer(ppalSizer) |
|---|
| 2688 | ppalSizer.Fit(self) |
|---|
| 2689 | ppalSizer.SetSizeHints(self) |
|---|
| 2690 | |
|---|
| 2691 | #Función impresión del listado de alumnos |
|---|
| 2692 | def OnImpresion(self, evt): |
|---|
| 2693 | # Creo un html con el listado para su posterior impresión |
|---|
| 2694 | f = open('./html/listalum.html', 'w') |
|---|
| 2695 | f.write('<html>\n') |
|---|
| 2696 | f.write('<head>\n') |
|---|
| 2697 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 2698 | f.write('<title>Impresión de listado de alumnos</title>\n') |
|---|
| 2699 | f.write('<body>\n') |
|---|
| 2700 | f.write('<font size="2">') |
|---|
| 2701 | f.write('<h2>Listado general de alumnos</h2>\n') |
|---|
| 2702 | f.write('<br>\n') |
|---|
| 2703 | f.write('<center>\n') |
|---|
| 2704 | f.write('<table border="1">\n' ) |
|---|
| 2705 | f.write('<th>N°</th><th>Id</th><th>Apellidos</th><th>Nombres</th><th>DNI</th><th>Calle</th><th>N°</th><th>Localidad</th><th>TE</th>\n') |
|---|
| 2706 | it = 0 |
|---|
| 2707 | while it < 100000: |
|---|
| 2708 | a = self.list.GetItemText(it) |
|---|
| 2709 | if a == '': |
|---|
| 2710 | break |
|---|
| 2711 | f.write('<tr>\n') |
|---|
| 2712 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 2713 | for i in range (1, 8): |
|---|
| 2714 | a = self.GetColumnText(it, i) |
|---|
| 2715 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 2716 | f.write('</tr>\n') |
|---|
| 2717 | it = it + 1 |
|---|
| 2718 | f.write('</table>\n') |
|---|
| 2719 | f.write('</center>\n') |
|---|
| 2720 | f.write('</font>') |
|---|
| 2721 | f.write('</body>\n') |
|---|
| 2722 | f.write('</html>') |
|---|
| 2723 | f.close() |
|---|
| 2724 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 2725 | import wx.html as htm |
|---|
| 2726 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 2727 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 2728 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 2729 | self.html.LoadPage('./html/listalum.html') |
|---|
| 2730 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 2731 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 2732 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 2733 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 2734 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 2735 | self.frame.Show() |
|---|
| 2736 | |
|---|
| 2737 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 2738 | def GetColumnText(self, index, col): |
|---|
| 2739 | item = self.list.GetItem(index, col) |
|---|
| 2740 | return item.GetText() |
|---|
| 2741 | |
|---|
| 2742 | def OnCancelarImp(self, evt): |
|---|
| 2743 | self.Close() |
|---|
| 2744 | |
|---|
| 2745 | def OnCanc (self, evt): |
|---|
| 2746 | self.frame.Destroy() |
|---|
| 2747 | self.Close() |
|---|
| 2748 | |
|---|
| 2749 | def GetListCtrl (self): |
|---|
| 2750 | return self.list |
|---|
| 2751 | |
|---|
| 2752 | def OnImp (self,evt): |
|---|
| 2753 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 2754 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 2755 | self.Close() |
|---|
| 2756 | |
|---|
| 2757 | class ListCursosFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 2758 | def __init__(self): |
|---|
| 2759 | wx.Frame.__init__(self, None, -1, u'Listado de cursos:', pos=(30, 120), size=(800, 490)) |
|---|
| 2760 | self.CenterOnScreen() |
|---|
| 2761 | panel = wx.Panel(self, -1) |
|---|
| 2762 | import listcursos as listcursos |
|---|
| 2763 | LblLc = wx.StaticText(panel, -1, u'Listado de cursos:') |
|---|
| 2764 | LblLc.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 2765 | self.list = wx.ListCtrl(panel, -1, size=(800, 400), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 2766 | for col, text in enumerate(listcursos.columns): |
|---|
| 2767 | self.list.InsertColumn(col, text.decode('utf-8')) |
|---|
| 2768 | self.itemDataMap = {} |
|---|
| 2769 | for item in listcursos.rows: |
|---|
| 2770 | index = self.list.InsertStringItem(sys.maxint, item[0]) |
|---|
| 2771 | for col, text in enumerate(item[1:]): |
|---|
| 2772 | self.list.SetStringItem(index, col+1, text) |
|---|
| 2773 | self.list.SetItemData(index, index) |
|---|
| 2774 | self.itemDataMap[index] = item |
|---|
| 2775 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 2776 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 2777 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 2778 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 2779 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 2780 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 2781 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 2782 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(listcursos.columns)) |
|---|
| 2783 | BtnImpresion = wx.Button(panel, wx.ID_PRINT, pos=(520, 440)) |
|---|
| 2784 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL, pos=(620, 440)) |
|---|
| 2785 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 2786 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 2787 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 2788 | ppalSizer.Add(LblLc, 0, wx.ALL, 5) |
|---|
| 2789 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 2790 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 2791 | datosSizer.AddGrowableCol(0) |
|---|
| 2792 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 2793 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 2794 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 2795 | btnSizer.Add((20,20), 1) |
|---|
| 2796 | btnSizer.Add(BtnImpresion) |
|---|
| 2797 | btnSizer.Add((20,20), 1) |
|---|
| 2798 | btnSizer.Add(BtnCancelarImp) |
|---|
| 2799 | btnSizer.Add((20,20), 1) |
|---|
| 2800 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 2801 | panel.SetSizer(ppalSizer) |
|---|
| 2802 | ppalSizer.Fit(self) |
|---|
| 2803 | ppalSizer.SetSizeHints(self) |
|---|
| 2804 | |
|---|
| 2805 | |
|---|
| 2806 | #Función impresión del listado cursos |
|---|
| 2807 | def OnImpresion(self, evt): |
|---|
| 2808 | # Creo un html con el listado para su posterior impresión |
|---|
| 2809 | f = open('./html/listcursos.html', 'w') |
|---|
| 2810 | f.write('<html>\n') |
|---|
| 2811 | f.write('<head>\n') |
|---|
| 2812 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 2813 | f.write('<title>Impresión de listado de cursos</title>\n') |
|---|
| 2814 | f.write('<body>\n') |
|---|
| 2815 | f.write('<font size="2">') |
|---|
| 2816 | f.write('<h2>Listado completo de cursos.</h2>\n') |
|---|
| 2817 | f.write('<br>\n') |
|---|
| 2818 | f.write('<center>\n') |
|---|
| 2819 | f.write('<table border="1">\n' ) |
|---|
| 2820 | f.write('<th>Orden</th><th>N° Curso</th><th>Tipo</th><th>Especialidad</th><th>Instructor</th><th>Horas</th><th>Establecimiento</th>\n') |
|---|
| 2821 | it = 0 |
|---|
| 2822 | while it < 10000: |
|---|
| 2823 | a = self.list.GetItemText(it) |
|---|
| 2824 | if a == '': |
|---|
| 2825 | break |
|---|
| 2826 | f.write('<tr>\n') |
|---|
| 2827 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 2828 | for i in range (1, 6): |
|---|
| 2829 | a = self.GetColumnText(it, i) |
|---|
| 2830 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 2831 | f.write('</tr>\n') |
|---|
| 2832 | it = it + 1 |
|---|
| 2833 | f.write('</table>\n') |
|---|
| 2834 | f.write('</center>\n') |
|---|
| 2835 | f.write('</font>') |
|---|
| 2836 | f.write('</body>\n') |
|---|
| 2837 | f.write('</html>') |
|---|
| 2838 | f.close() |
|---|
| 2839 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 2840 | import wx.html as htm |
|---|
| 2841 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 2842 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 2843 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 2844 | self.html.LoadPage('./html/listcursos.html') |
|---|
| 2845 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 2846 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 2847 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 2848 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 2849 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 2850 | self.frame.Show() |
|---|
| 2851 | |
|---|
| 2852 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 2853 | def GetColumnText(self, index, col): |
|---|
| 2854 | item = self.list.GetItem(index, col) |
|---|
| 2855 | return item.GetText() |
|---|
| 2856 | |
|---|
| 2857 | |
|---|
| 2858 | def OnCancelarImp(self, evt): |
|---|
| 2859 | self.Close() |
|---|
| 2860 | |
|---|
| 2861 | def OnCanc (self, evt): |
|---|
| 2862 | self.frame.Destroy() |
|---|
| 2863 | self.Close() |
|---|
| 2864 | |
|---|
| 2865 | def GetListCtrl (self): |
|---|
| 2866 | return self.list |
|---|
| 2867 | |
|---|
| 2868 | def OnImp (self,evt): |
|---|
| 2869 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 2870 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 2871 | self.Close() |
|---|
| 2872 | |
|---|
| 2873 | # Clase Listados Cursos por número |
|---|
| 2874 | class ListCurNumFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 2875 | def __init__(self): |
|---|
| 2876 | wx.Frame.__init__(self, None, -1, u'Listado de curso por número:', pos=(30, 120), size=(800, 490)) |
|---|
| 2877 | panel = wx.Panel(self, -1) |
|---|
| 2878 | import list_curso_num as list_curso_num |
|---|
| 2879 | self.num_curso = list_curso_num.num_curso |
|---|
| 2880 | LblLcn = wx.StaticText(panel, -1, u'Listado de curso Número %s:' %(self.num_curso)) |
|---|
| 2881 | LblLcn.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 2882 | self.list = wx.ListCtrl(panel, -1, size=(800, 400), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 2883 | for col, text in enumerate(list_curso_num.columns): |
|---|
| 2884 | self.list.InsertColumn(col, text.decode('utf-8')) |
|---|
| 2885 | self.itemDataMap = {} |
|---|
| 2886 | for item in list_curso_num.rows: |
|---|
| 2887 | index = self.list.InsertStringItem(sys.maxint, item[0]) |
|---|
| 2888 | for col, text in enumerate(item[1:]): |
|---|
| 2889 | self.list.SetStringItem(index, col+1, text) |
|---|
| 2890 | self.list.SetItemData(index, index) |
|---|
| 2891 | self.itemDataMap[index] = item |
|---|
| 2892 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 2893 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 2894 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 2895 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 2896 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 2897 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE) |
|---|
| 2898 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 2899 | self.list.SetColumnWidth(7, wx.LIST_AUTOSIZE) |
|---|
| 2900 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(list_curso_num.columns)) |
|---|
| 2901 | #self.checkListCur = wx.CheckBox (panel, -1, u'Formato ficha de curso', pos=(210, 440)) |
|---|
| 2902 | BtnImpresion = wx.Button(panel, wx.ID_PRINT) |
|---|
| 2903 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 2904 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 2905 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 2906 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 2907 | ppalSizer.Add(LblLcn, 0, wx.ALL, 5) |
|---|
| 2908 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 2909 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 2910 | datosSizer.AddGrowableCol(0) |
|---|
| 2911 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 2912 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 2913 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 2914 | btnSizer.Add((20,20), 1) |
|---|
| 2915 | #btnSizer.Add(self.checkListCur) |
|---|
| 2916 | btnSizer.Add((20,20), 1) |
|---|
| 2917 | btnSizer.Add(BtnImpresion) |
|---|
| 2918 | btnSizer.Add((20,20), 1) |
|---|
| 2919 | btnSizer.Add(BtnCancelarImp) |
|---|
| 2920 | btnSizer.Add((20,20), 1) |
|---|
| 2921 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 2922 | panel.SetSizer(ppalSizer) |
|---|
| 2923 | ppalSizer.Fit(self) |
|---|
| 2924 | ppalSizer.SetSizeHints(self) |
|---|
| 2925 | |
|---|
| 2926 | |
|---|
| 2927 | #Función impresión del listado cursos por número |
|---|
| 2928 | def OnImpresion(self, evt): |
|---|
| 2929 | # Creo un html con el listado para su posterior impresión |
|---|
| 2930 | f = open('./html/listcursonum.html', 'w') |
|---|
| 2931 | f.write('<html>\n') |
|---|
| 2932 | f.write('<head>\n') |
|---|
| 2933 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 2934 | f.write('<title>Impresión de listado de curso N° %s</title>\n' %(self.num_curso)) |
|---|
| 2935 | f.write('<body>\n') |
|---|
| 2936 | f.write('<font size="2">') |
|---|
| 2937 | f.write('<h2>Listado de curso N° %s.</h2>\n' %(self.num_curso)) |
|---|
| 2938 | f.write('<br>\n') |
|---|
| 2939 | f.write('<center>\n') |
|---|
| 2940 | f.write('<table border="1">\n' ) |
|---|
| 2941 | f.write('<th>N°</th><th>Apellidos</th><th>Nombres</th><th>DNI</th><th>Calle</th><th>N°</th><th>Localidad</th><th>TE</th><th>C@rreo</th>\n') |
|---|
| 2942 | it = 0 |
|---|
| 2943 | while it < 10000: |
|---|
| 2944 | a = self.list.GetItemText(it) |
|---|
| 2945 | if a == '': |
|---|
| 2946 | break |
|---|
| 2947 | f.write('<tr>\n') |
|---|
| 2948 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 2949 | for i in range (1, 8): |
|---|
| 2950 | a = self.GetColumnText(it, i) |
|---|
| 2951 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 2952 | f.write('</tr>\n') |
|---|
| 2953 | it = it + 1 |
|---|
| 2954 | f.write('</table>\n') |
|---|
| 2955 | f.write('</center>\n') |
|---|
| 2956 | f.write('</font>') |
|---|
| 2957 | f.write('</body>\n') |
|---|
| 2958 | f.write('</html>') |
|---|
| 2959 | f.close() |
|---|
| 2960 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 2961 | import wx.html as htm |
|---|
| 2962 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 2963 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 2964 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 2965 | self.html.LoadPage('./html/listcursonum.html') |
|---|
| 2966 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 2967 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 2968 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 2969 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 2970 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 2971 | self.frame.Show() |
|---|
| 2972 | |
|---|
| 2973 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 2974 | def GetColumnText(self, index, col): |
|---|
| 2975 | item = self.list.GetItem(index, col) |
|---|
| 2976 | return item.GetText() |
|---|
| 2977 | |
|---|
| 2978 | |
|---|
| 2979 | def OnCancelarImp(self, evt): |
|---|
| 2980 | self.Close() |
|---|
| 2981 | |
|---|
| 2982 | def OnCanc (self, evt): |
|---|
| 2983 | self.frame.Destroy() |
|---|
| 2984 | self.Close() |
|---|
| 2985 | |
|---|
| 2986 | def GetListCtrl (self): |
|---|
| 2987 | return self.list |
|---|
| 2988 | |
|---|
| 2989 | def OnImp (self,evt): |
|---|
| 2990 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 2991 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 2992 | self.Close() |
|---|
| 2993 | |
|---|
| 2994 | # Clase Listados Cursos por Instructor |
|---|
| 2995 | class ListCurInsFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 2996 | def __init__(self): |
|---|
| 2997 | wx.Frame.__init__(self, None, -1, u'Listado de curso por instructor:', size=(800, 490)) |
|---|
| 2998 | panel = wx.Panel(self, -1) |
|---|
| 2999 | self.CenterOnScreen() |
|---|
| 3000 | import list_curso_ins as list_curso_ins |
|---|
| 3001 | self.instructor = list_curso_ins.instructor |
|---|
| 3002 | LblLcn = wx.StaticText(panel, -1, u'Listado de curso del instructor %s:' %(self.instructor)) |
|---|
| 3003 | LblLcn.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 3004 | self.list = wx.ListCtrl(panel, -1, size=(800, 400), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 3005 | for col, text in enumerate(list_curso_ins.columns): |
|---|
| 3006 | self.list.InsertColumn(col, text.decode('UTF-8')) |
|---|
| 3007 | self.itemDataMap = {} |
|---|
| 3008 | for item in list_curso_ins.rows: |
|---|
| 3009 | index = self.list.InsertStringItem(sys.maxint, item[0]) |
|---|
| 3010 | for col, text in enumerate(item[1:]): |
|---|
| 3011 | self.list.SetStringItem(index, col+1, text) |
|---|
| 3012 | self.list.SetItemData(index, index) |
|---|
| 3013 | self.itemDataMap[index] = item |
|---|
| 3014 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 3015 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 3016 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 3017 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 3018 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 3019 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(list_curso_ins.columns)) |
|---|
| 3020 | BtnImpresion = wx.Button(panel, wx.ID_PRINT) |
|---|
| 3021 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL) |
|---|
| 3022 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 3023 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 3024 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 3025 | ppalSizer.Add(LblLcn, 0, wx.ALL, 5) |
|---|
| 3026 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 3027 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 3028 | datosSizer.AddGrowableCol(0) |
|---|
| 3029 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 3030 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 3031 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 3032 | btnSizer.Add((20,20), 1) |
|---|
| 3033 | btnSizer.Add(BtnImpresion) |
|---|
| 3034 | btnSizer.Add((20,20), 1) |
|---|
| 3035 | btnSizer.Add(BtnCancelarImp) |
|---|
| 3036 | btnSizer.Add((20,20), 1) |
|---|
| 3037 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 3038 | panel.SetSizer(ppalSizer) |
|---|
| 3039 | ppalSizer.Fit(self) |
|---|
| 3040 | ppalSizer.SetSizeHints(self) |
|---|
| 3041 | |
|---|
| 3042 | |
|---|
| 3043 | #Función impresión del listado cursos por Instructor |
|---|
| 3044 | def OnImpresion(self, evt): |
|---|
| 3045 | # Creo un html con el listado para su posterior impresión |
|---|
| 3046 | f = open('./html/listcursoinst.html', 'w') |
|---|
| 3047 | f.write('<html>\n') |
|---|
| 3048 | f.write('<head>\n') |
|---|
| 3049 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 3050 | f.write('<title>Impresión de listado de curso por instructor - %s</title>\n' %(self.instructor.encode('UTF-8'))) |
|---|
| 3051 | f.write('<body>\n') |
|---|
| 3052 | f.write('<font size="2">') |
|---|
| 3053 | f.write('<h2>Listado de curso por instructor - %s.</h2>\n' %(self.instructor.encode('UTF-8'))) |
|---|
| 3054 | f.write('<br>\n') |
|---|
| 3055 | f.write('<center>\n') |
|---|
| 3056 | f.write('<th>Orden</th><th>N° Curso</th><th>Especialidad</th><th>Ciclo</th><th>Establecimiento</th>\n') |
|---|
| 3057 | f.write('<table border="1">\n' ) |
|---|
| 3058 | it = 0 |
|---|
| 3059 | while it < 10000: |
|---|
| 3060 | a = self.list.GetItemText(it) |
|---|
| 3061 | if a == '': |
|---|
| 3062 | break |
|---|
| 3063 | f.write('<tr>\n') |
|---|
| 3064 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 3065 | for i in range (2, 5): |
|---|
| 3066 | a = self.GetColumnText(it, i) |
|---|
| 3067 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 3068 | f.write('</tr>\n') |
|---|
| 3069 | it = it + 1 |
|---|
| 3070 | f.write('</table>\n') |
|---|
| 3071 | f.write('</center>\n') |
|---|
| 3072 | f.write('</font>') |
|---|
| 3073 | f.write('</body>\n') |
|---|
| 3074 | f.write('</html>') |
|---|
| 3075 | f.close() |
|---|
| 3076 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 3077 | import wx.html as htm |
|---|
| 3078 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 3079 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 3080 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 3081 | self.html.LoadPage('./html/listcursoinst.html') |
|---|
| 3082 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 3083 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 3084 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 3085 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 3086 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 3087 | self.frame.Show() |
|---|
| 3088 | |
|---|
| 3089 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 3090 | def GetColumnText(self, index, col): |
|---|
| 3091 | item = self.list.GetItem(index, col) |
|---|
| 3092 | return item.GetText() |
|---|
| 3093 | |
|---|
| 3094 | |
|---|
| 3095 | def OnCancelarImp(self, evt): |
|---|
| 3096 | self.Close() |
|---|
| 3097 | |
|---|
| 3098 | def OnCanc (self, evt): |
|---|
| 3099 | self.frame.Destroy() |
|---|
| 3100 | self.Close() |
|---|
| 3101 | |
|---|
| 3102 | def GetListCtrl (self): |
|---|
| 3103 | return self.list |
|---|
| 3104 | |
|---|
| 3105 | def OnImp (self,evt): |
|---|
| 3106 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 3107 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 3108 | self.Close() |
|---|
| 3109 | |
|---|
| 3110 | #Clase Listado de Instructores |
|---|
| 3111 | class ListInstFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 3112 | def __init__(self): |
|---|
| 3113 | f=open('listinstruc.py', 'r') |
|---|
| 3114 | imp.load_module('listinstruc', f, 'listinstruc', ('.py', 'U', 1)) |
|---|
| 3115 | import listinstruc as listinstruc |
|---|
| 3116 | f.close() |
|---|
| 3117 | wx.Frame.__init__(self, None, -1, u'Listado de Instructores:', pos=(30, 120), size=(800, 490)) |
|---|
| 3118 | panel = wx.Panel(self, -1) |
|---|
| 3119 | LblLi = wx.StaticText(panel, -1, u'Listado General de Instructores:', (30, 20)) |
|---|
| 3120 | LblLi.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 3121 | self.list = wx.ListCtrl(panel, -1, size=(790, 390), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 3122 | for col, text in enumerate(listinstruc.columns): |
|---|
| 3123 | self.list.InsertColumn(col, text) |
|---|
| 3124 | self.itemDataMap = {} |
|---|
| 3125 | for item in listinstruc.rows: |
|---|
| 3126 | index = self.list.InsertStringItem(sys.maxint, str(item[0])) |
|---|
| 3127 | for col, text in enumerate(item[1:]): |
|---|
| 3128 | self.list.SetStringItem(index, col+1, text) |
|---|
| 3129 | self.list.SetItemData(index, index) |
|---|
| 3130 | self.itemDataMap[index] = item |
|---|
| 3131 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 3132 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 3133 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 3134 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 3135 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 3136 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 3137 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 3138 | self.list.SetColumnWidth(7, wx.LIST_AUTOSIZE) |
|---|
| 3139 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(listinstruc.columns)) |
|---|
| 3140 | BtnImpresion = wx.Button(panel, wx.ID_PRINT, pos=(520, 440)) |
|---|
| 3141 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL, pos=(620, 440)) |
|---|
| 3142 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 3143 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 3144 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 3145 | ppalSizer.Add(LblLi, 0, wx.ALL, 5) |
|---|
| 3146 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 3147 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 3148 | datosSizer.AddGrowableCol(0) |
|---|
| 3149 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 3150 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 3151 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 3152 | btnSizer.Add((20,20), 1) |
|---|
| 3153 | btnSizer.Add(BtnImpresion) |
|---|
| 3154 | btnSizer.Add((20,20), 1) |
|---|
| 3155 | btnSizer.Add(BtnCancelarImp) |
|---|
| 3156 | btnSizer.Add((20,20), 1) |
|---|
| 3157 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 3158 | panel.SetSizer(ppalSizer) |
|---|
| 3159 | ppalSizer.Fit(self) |
|---|
| 3160 | ppalSizer.SetSizeHints(self) |
|---|
| 3161 | |
|---|
| 3162 | |
|---|
| 3163 | #Función impresión del listado de Instructores |
|---|
| 3164 | def OnImpresion(self, evt): |
|---|
| 3165 | # Creo un html con el listado para su posterior impresión |
|---|
| 3166 | f = open('./html/listinstruc.html', 'w') |
|---|
| 3167 | f.write('<html>\n') |
|---|
| 3168 | f.write('<head>\n') |
|---|
| 3169 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 3170 | f.write('<title>Impresión de listado de instructores</title>\n') |
|---|
| 3171 | f.write('<body>\n') |
|---|
| 3172 | f.write('<font size="2">') |
|---|
| 3173 | f.write('<h2>Listado general de instructores</h2>\n') |
|---|
| 3174 | f.write('<br>\n') |
|---|
| 3175 | f.write('<center>\n') |
|---|
| 3176 | f.write('<table border="1">\n' ) |
|---|
| 3177 | f.write('<th>N°</th><th>Id</th><th>Apellidos</th><th>Nombres</th><th>TE</th><th>Dirección</th><th>Correo-e</th>\n') |
|---|
| 3178 | it = 0 |
|---|
| 3179 | while it < 10000: |
|---|
| 3180 | a = self.list.GetItemText(it) |
|---|
| 3181 | if a == '': |
|---|
| 3182 | break |
|---|
| 3183 | f.write('<tr>\n') |
|---|
| 3184 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 3185 | for i in range (1, 6): |
|---|
| 3186 | a = self.getColumnText(it, i) |
|---|
| 3187 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 3188 | f.write('</tr>\n') |
|---|
| 3189 | it = it + 1 |
|---|
| 3190 | f.write('</table>\n') |
|---|
| 3191 | f.write('</center>\n') |
|---|
| 3192 | f.write('</font>') |
|---|
| 3193 | f.write('</body>\n') |
|---|
| 3194 | f.write('</html>') |
|---|
| 3195 | f.close() |
|---|
| 3196 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 3197 | import wx.html as htm |
|---|
| 3198 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 3199 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 3200 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 3201 | self.html.LoadPage('./html/listinstruc.html') |
|---|
| 3202 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 3203 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 3204 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 3205 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 3206 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 3207 | self.frame.Show() |
|---|
| 3208 | |
|---|
| 3209 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 3210 | def getColumnText(self, index, col): |
|---|
| 3211 | item = self.list.GetItem(index, col) |
|---|
| 3212 | return item.GetText() |
|---|
| 3213 | |
|---|
| 3214 | def OnCancelarImp(self, evt): |
|---|
| 3215 | self.Close() |
|---|
| 3216 | |
|---|
| 3217 | def OnCanc (self, evt): |
|---|
| 3218 | self.frame.Destroy() |
|---|
| 3219 | self.Close() |
|---|
| 3220 | |
|---|
| 3221 | def GetListCtrl (self): |
|---|
| 3222 | return self.list |
|---|
| 3223 | |
|---|
| 3224 | def OnImp (self,evt): |
|---|
| 3225 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 3226 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 3227 | self.Close() |
|---|
| 3228 | |
|---|
| 3229 | class ListCoordFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 3230 | def __init__(self): |
|---|
| 3231 | wx.Frame.__init__(self, None, -1, u'Listado de Coordinadores:', pos=(30, 120), size=(800, 490)) |
|---|
| 3232 | f=open('listcoord.py', 'r') |
|---|
| 3233 | imp.load_module('listcoord', f, 'listcoord', ('.py', 'U', 1)) |
|---|
| 3234 | import listcoord as listcoord |
|---|
| 3235 | f.close() |
|---|
| 3236 | panel = wx.Panel(self, -1) |
|---|
| 3237 | LblLc = wx.StaticText(panel, -1, u'Listado General de Coordinadores:', (30, 20)) |
|---|
| 3238 | LblLc.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 3239 | self.list = wx.ListCtrl(panel, -1, size=(790, 390), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 3240 | for col, text in enumerate(listcoord.columns): |
|---|
| 3241 | self.list.InsertColumn(col, text) |
|---|
| 3242 | self.itemDataMap = {} |
|---|
| 3243 | for item in listcoord.rows: |
|---|
| 3244 | index = self.list.InsertStringItem(sys.maxint, str(item[0])) |
|---|
| 3245 | for col, text in enumerate(item[1:]): |
|---|
| 3246 | self.list.SetStringItem(index, col+1, text) |
|---|
| 3247 | self.list.SetItemData(index, index) |
|---|
| 3248 | self.itemDataMap[index] = item |
|---|
| 3249 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 3250 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 3251 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 3252 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 3253 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 3254 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE_USEHEADER) |
|---|
| 3255 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 3256 | self.list.SetColumnWidth(7, wx.LIST_AUTOSIZE) |
|---|
| 3257 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(listcoord.columns)) |
|---|
| 3258 | BtnImpresion = wx.Button(panel, wx.ID_PRINT, pos=(520, 440)) |
|---|
| 3259 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL, pos=(620, 440)) |
|---|
| 3260 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 3261 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 3262 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 3263 | ppalSizer.Add(LblLc, 0, wx.ALL, 5) |
|---|
| 3264 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 3265 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 3266 | datosSizer.AddGrowableCol(0) |
|---|
| 3267 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 3268 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 3269 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 3270 | btnSizer.Add((20,20), 1) |
|---|
| 3271 | btnSizer.Add(BtnImpresion) |
|---|
| 3272 | btnSizer.Add((20,20), 1) |
|---|
| 3273 | btnSizer.Add(BtnCancelarImp) |
|---|
| 3274 | btnSizer.Add((20,20), 1) |
|---|
| 3275 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 3276 | panel.SetSizer(ppalSizer) |
|---|
| 3277 | ppalSizer.Fit(self) |
|---|
| 3278 | ppalSizer.SetSizeHints(self) |
|---|
| 3279 | |
|---|
| 3280 | |
|---|
| 3281 | #Función impresión del listado de Coordinadores |
|---|
| 3282 | def OnImpresion(self, evt): |
|---|
| 3283 | # Creo un html con el listado para su posterior impresión |
|---|
| 3284 | f = open('./html/listcoord.html', 'w') |
|---|
| 3285 | f.write('<html>\n') |
|---|
| 3286 | f.write('<head>\n') |
|---|
| 3287 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 3288 | f.write('<title>Impresión de listado de coordinadores</title>\n') |
|---|
| 3289 | f.write('<body>\n') |
|---|
| 3290 | f.write('<font size="2">') |
|---|
| 3291 | f.write('<h2>Listado general de coordinadores</h2>\n') |
|---|
| 3292 | f.write('<br>\n') |
|---|
| 3293 | f.write('<center>\n') |
|---|
| 3294 | f.write('<table border="1">\n' ) |
|---|
| 3295 | f.write('<th>N°</th><th>Id</th><th>Apellidos</th><th>Nombres</th><th>TE</th><th>Domicilio</th><th>Correo-e</th>\n') |
|---|
| 3296 | it = 0 |
|---|
| 3297 | while it < 10000: |
|---|
| 3298 | a = self.list.GetItemText(it) |
|---|
| 3299 | if a == '': |
|---|
| 3300 | break |
|---|
| 3301 | f.write('<tr>\n') |
|---|
| 3302 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 3303 | for i in range (1, 6): |
|---|
| 3304 | a = self.getColumnText(it, i) |
|---|
| 3305 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 3306 | f.write('</tr>\n') |
|---|
| 3307 | it = it + 1 |
|---|
| 3308 | f.write('</table>\n') |
|---|
| 3309 | f.write('</center>\n') |
|---|
| 3310 | f.write('</font>') |
|---|
| 3311 | f.write('</body>\n') |
|---|
| 3312 | f.write('</html>') |
|---|
| 3313 | f.close() |
|---|
| 3314 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 3315 | import wx.html as htm |
|---|
| 3316 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 3317 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 3318 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 3319 | self.html.LoadPage('./html/listcoord.html') |
|---|
| 3320 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 3321 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 3322 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 3323 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 3324 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 3325 | self.frame.Show() |
|---|
| 3326 | |
|---|
| 3327 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 3328 | def getColumnText(self, index, col): |
|---|
| 3329 | item = self.list.GetItem(index, col) |
|---|
| 3330 | return item.GetText() |
|---|
| 3331 | |
|---|
| 3332 | def OnCancelarImp(self, evt): |
|---|
| 3333 | self.Close() |
|---|
| 3334 | |
|---|
| 3335 | def OnCanc (self, evt): |
|---|
| 3336 | self.frame.Destroy() |
|---|
| 3337 | self.Close() |
|---|
| 3338 | |
|---|
| 3339 | def GetListCtrl (self): |
|---|
| 3340 | return self.list |
|---|
| 3341 | |
|---|
| 3342 | def OnImp (self,evt): |
|---|
| 3343 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 3344 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 3345 | self.Close() |
|---|
| 3346 | |
|---|
| 3347 | # Clase listado de administrativos |
|---|
| 3348 | class ListAdmFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 3349 | def __init__(self): |
|---|
| 3350 | wx.Frame.__init__(self, None, -1, u'Listado de Administrativos:', pos=(30, 120), size=(800, 490)) |
|---|
| 3351 | f=open('listadm.py', 'r') |
|---|
| 3352 | imp.load_module('listadm', f, 'listadm', ('.py', 'U', 1)) |
|---|
| 3353 | import listadm as listadm |
|---|
| 3354 | f.close() |
|---|
| 3355 | panel = wx.Panel(self, -1) |
|---|
| 3356 | LblLad = wx.StaticText(panel, -1, u'Listado General de Administrativos:', (30, 20)) |
|---|
| 3357 | LblLad.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 3358 | self.list = wx.ListCtrl(panel, -1, size=(790, 390), style=wx.LC_REPORT | wx.LC_SORT_ASCENDING) |
|---|
| 3359 | for col, text in enumerate(listadm.columns): |
|---|
| 3360 | self.list.InsertColumn(col, text.decode('UTF-8')) |
|---|
| 3361 | self.itemDataMap = {} |
|---|
| 3362 | for item in listadm.rows: |
|---|
| 3363 | index = self.list.InsertStringItem(sys.maxint, str(item[0])) |
|---|
| 3364 | for col, text in enumerate(item[1:]): |
|---|
| 3365 | self.list.SetStringItem(index, col+1, text) |
|---|
| 3366 | self.list.SetItemData(index, index) |
|---|
| 3367 | self.itemDataMap[index] = item |
|---|
| 3368 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 3369 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 3370 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 3371 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 3372 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 3373 | self.list.SetColumnWidth(5, wx.LIST_AUTOSIZE) |
|---|
| 3374 | self.list.SetColumnWidth(6, wx.LIST_AUTOSIZE) |
|---|
| 3375 | self.list.SetColumnWidth(7, wx.LIST_AUTOSIZE) |
|---|
| 3376 | self.list.SetColumnWidth(8, wx.LIST_AUTOSIZE) |
|---|
| 3377 | wx.lib.mixins.listctrl.ColumnSorterMixin.__init__(self, len(listadm.columns)) |
|---|
| 3378 | BtnImpresion = wx.Button(panel, wx.ID_PRINT, pos=(520, 440)) |
|---|
| 3379 | BtnCancelarImp = wx.Button(panel, wx.ID_CANCEL, pos=(620, 440)) |
|---|
| 3380 | self.Bind(wx.EVT_BUTTON, self.OnImpresion, BtnImpresion) |
|---|
| 3381 | self.Bind(wx.EVT_BUTTON, self.OnCancelarImp, BtnCancelarImp) |
|---|
| 3382 | ppalSizer = wx.BoxSizer(wx.VERTICAL) |
|---|
| 3383 | ppalSizer.Add(LblLad, 0, wx.ALL, 5) |
|---|
| 3384 | ppalSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) |
|---|
| 3385 | datosSizer = wx.FlexGridSizer(cols=1, hgap=5, vgap=5) |
|---|
| 3386 | datosSizer.AddGrowableCol(0) |
|---|
| 3387 | datosSizer.Add(self.list, 1, wx.EXPAND) |
|---|
| 3388 | ppalSizer.Add(datosSizer, 0, wx.EXPAND|wx.ALL, 10) |
|---|
| 3389 | btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
|---|
| 3390 | btnSizer.Add((20,20), 1) |
|---|
| 3391 | btnSizer.Add(BtnImpresion) |
|---|
| 3392 | btnSizer.Add((20,20), 1) |
|---|
| 3393 | btnSizer.Add(BtnCancelarImp) |
|---|
| 3394 | btnSizer.Add((20,20), 1) |
|---|
| 3395 | ppalSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10) |
|---|
| 3396 | panel.SetSizer(ppalSizer) |
|---|
| 3397 | ppalSizer.Fit(self) |
|---|
| 3398 | ppalSizer.SetSizeHints(self) |
|---|
| 3399 | |
|---|
| 3400 | |
|---|
| 3401 | #Función impresión del listado de administrativos |
|---|
| 3402 | def OnImpresion(self, evt): |
|---|
| 3403 | # Creo un html con el listado para su posterior impresión |
|---|
| 3404 | f = open('./html/listadm.html', 'w') |
|---|
| 3405 | f.write('<html>\n') |
|---|
| 3406 | f.write('<head>\n') |
|---|
| 3407 | f.write('<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n') |
|---|
| 3408 | f.write('<title>Impresión de listado de administrativos</title>\n') |
|---|
| 3409 | f.write('<body>\n') |
|---|
| 3410 | f.write('<font size="2">') |
|---|
| 3411 | f.write('<h2>Listado general de administrativos</h2>\n') |
|---|
| 3412 | f.write('<br>\n') |
|---|
| 3413 | f.write('<center>\n') |
|---|
| 3414 | f.write('<table border="1">\n' ) |
|---|
| 3415 | f.write('<th>N°</th><th>Cargo</th><th>Apellidos</th><th>Nombres</th><th>Calle</th><th>N°</th><th>Localidad</th><th>CP</th><th>Teléfono</th><th>C@rreo</th>\n') |
|---|
| 3416 | it = 0 |
|---|
| 3417 | while it < 10000: |
|---|
| 3418 | a = self.list.GetItemText(it) |
|---|
| 3419 | if a == '': |
|---|
| 3420 | break |
|---|
| 3421 | f.write('<tr>\n') |
|---|
| 3422 | f.write(' <td>%s</td><td>%s</td>\n' % (it, a.encode('utf-8'))) |
|---|
| 3423 | for i in range (1, 9): |
|---|
| 3424 | a = self.getColumnText(it, i) |
|---|
| 3425 | f.write(' <td>%s</td>\n' % (a.encode('utf-8'))) |
|---|
| 3426 | f.write('</tr>\n') |
|---|
| 3427 | it = it + 1 |
|---|
| 3428 | f.write('</table>\n') |
|---|
| 3429 | f.write('</center>\n') |
|---|
| 3430 | f.write('</font>') |
|---|
| 3431 | f.write('</body>\n') |
|---|
| 3432 | f.write('</html>') |
|---|
| 3433 | f.close() |
|---|
| 3434 | #Una vez creado el html con el listado lo muestro en un frame como vista previa |
|---|
| 3435 | import wx.html as htm |
|---|
| 3436 | self.frame = wx.Frame(self, -1, u'Vista previa de la impresión', (20, 20), (800, 600)) |
|---|
| 3437 | self.panel = wx.Panel(self.frame, -1) |
|---|
| 3438 | self.html = htm.HtmlWindow(self.panel, -1, (5,5), (790, 500)) |
|---|
| 3439 | self.html.LoadPage('./html/listadm.html') |
|---|
| 3440 | self.printer = htm.HtmlEasyPrinting() |
|---|
| 3441 | BtnImpresion = wx.Button(self.panel, wx.ID_PRINT, pos=(520, 540)) |
|---|
| 3442 | BtnCancelarImp = wx.Button(self.panel, wx.ID_CANCEL, pos=(620, 540)) |
|---|
| 3443 | self.Bind(wx.EVT_BUTTON, self.OnImp, BtnImpresion) |
|---|
| 3444 | self.Bind(wx.EVT_BUTTON, self.OnCanc, BtnCancelarImp) |
|---|
| 3445 | self.frame.Show() |
|---|
| 3446 | |
|---|
| 3447 | # Dado el ID y la columna traigo el item deseado. |
|---|
| 3448 | def getColumnText(self, index, col): |
|---|
| 3449 | item = self.list.GetItem(index, col) |
|---|
| 3450 | return item.GetText() |
|---|
| 3451 | |
|---|
| 3452 | def OnCancelarImp(self, evt): |
|---|
| 3453 | self.Close() |
|---|
| 3454 | |
|---|
| 3455 | def OnCanc (self, evt): |
|---|
| 3456 | self.frame.Destroy() |
|---|
| 3457 | self.Close() |
|---|
| 3458 | |
|---|
| 3459 | def GetListCtrl (self): |
|---|
| 3460 | return self.list |
|---|
| 3461 | |
|---|
| 3462 | def OnImp (self,evt): |
|---|
| 3463 | self.printer.GetPrintData().SetPaperId(wx.PAPER_LETTER) |
|---|
| 3464 | self.printer.PrintFile(self.html.GetOpenedPage()) |
|---|
| 3465 | self.Close() |
|---|
| 3466 | |
|---|
| 3467 | |
|---|
| 3468 | # Clase Listado de Centros |
|---|
| 3469 | class ListCentrosFrame(wx.Frame, wx.lib.mixins.listctrl.ColumnSorterMixin): |
|---|
| 3470 | def __init__(self): |
|---|
| 3471 | wx.Frame.__init__(self, None, -1, u'Listado de Centros:', pos=(30, 120), size=(800, 490)) |
|---|
| 3472 | f=open('listcentros.py', 'r') |
|---|
| 3473 | imp.load_module('listcentros', f, 'listcentros', ('.py', 'U', 1)) |
|---|
| 3474 | import listcentros as listcentros |
|---|
| 3475 | f.close() |
|---|
| 3476 | panel = wx.Panel(self, -1) |
|---|
| 3477 | LblLgc = wx.StaticText(panel, -1, u'Listado General de Centros:') |
|---|
| 3478 | LblLgc.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) |
|---|
| 3479 | self.list = wx.ListCtrl(panel, -1, size=(800, 400), |
|---|
| 3480 | style=wx.LC_REPORT | wx.LC_SORT_ASCENDING | wx.HSCROLL) |
|---|
| 3481 | for col, text in enumerate(listcentros.columns): |
|---|
| 3482 | self.list.InsertColumn(col, text) |
|---|
| 3483 | self.itemDataMap = {} |
|---|
| 3484 | for item in listcentros.rows: |
|---|
| 3485 | index = self.list.InsertStringItem(sys.maxint, str(item[0])) |
|---|
| 3486 | for col, text in enumerate(item[1:]): |
|---|
| 3487 | self.list.SetStringItem(index, col+1, text) |
|---|
| 3488 | self.list.SetItemData(index, index) |
|---|
| 3489 | self.itemDataMap[index] = item |
|---|
| 3490 | self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) |
|---|
| 3491 | self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE) |
|---|
| 3492 | self.list.SetColumnWidth(2, wx.LIST_AUTOSIZE) |
|---|
| 3493 | self.list.SetColumnWidth(3, wx.LIST_AUTOSIZE) |
|---|
| 3494 | self.list.SetColumnWidth(4, wx.LIST_AUTOSIZE) |
|---|
| 3495 | |
|---|