Example #1
0
 def _descargar_y_mostrar_acta(self, respuesta):
     """ Descarga el acta del servidor y lo muestra al usuario """
     if not ACTA_DESGLOSADA:
         path_destino = join(get_desktop_path(), respuesta["file_name"])
         url_acta = "%s://%s/%s" % (PROTOCOLO, self.config.HOST, respuesta["url"])
         self._conexion.descargar(url_acta, path_destino)
         self._mostrar_acta(path_destino)
Example #2
0
 def _descargar_y_mostrar_acta(self, respuesta):
     """ Descarga el acta del servidor y lo muestra al usuario """
     if not ACTA_DESGLOSADA:
         path_destino = join(get_desktop_path(), respuesta['file_name'])
         url_acta = '%s://%s/%s' % (PROTOCOLO, self.config.HOST,
                                    respuesta['url'])
         self._conexion.descargar(url_acta, path_destino)
         self._mostrar_acta(path_destino)
Example #3
0
    def _generar_y_mostrar_acta(self, datos_tag):
        self._elimimar_vista_acta()
        recuento = Recuento.desde_tag(datos_tag)
        self.set_mensaje(MSG_GENERANDO_IMG)

        imagen = recuento.a_imagen(svg=True, de_muestra=True, tipo=(CIERRE_TRANSMISION, recuento.cod_categoria))
        path_destino = join(get_desktop_path(), "%s_%s.svg" % (recuento.mesa.numero, recuento.cod_categoria))
        file_destino = open(path_destino, "w")
        file_destino.write(imagen)
        file_destino.close()
        self._mostrar_acta(path_destino)
        self.set_mensaje(MSG_RESTO_ACTAS)
Example #4
0
    def _generar_y_mostrar_acta(self, datos_tag):
        self._elimimar_vista_acta()
        recuento = Recuento.desde_tag(datos_tag)
        self.set_mensaje(MSG_GENERANDO_IMG)

        imagen = recuento.a_imagen(svg=True,
                                   de_muestra=True,
                                   tipo=(CIERRE_TRANSMISION,
                                         recuento.cod_categoria))
        path_destino = join(
            get_desktop_path(),
            "%s_%s.svg" % (recuento.mesa.numero, recuento.cod_categoria))
        file_destino = open(path_destino, 'w')
        file_destino.write(imagen)
        file_destino.close()
        self._mostrar_acta(path_destino)
        self.set_mensaje(MSG_RESTO_ACTAS)
Example #5
0
    def agregar_acta(self, data):
        recuento = Recuento.desde_tag(data)

        data_mesa = None
        for mesa in self._estados_mesas:
            if mesa[0][2] == recuento.mesa.numero and mesa[0][1] \
               not in (ESTADO_OK, ESTADO_PUBLICADA):

                data_mesa = mesa
                break

        if data_mesa is not None:
            dict_actas = self._actas.get(recuento.mesa.codigo)
            if dict_actas is None:
                self._actas[recuento.mesa.codigo] = {}
                dict_actas = self._actas.get(recuento.mesa.codigo)
            dict_actas[recuento.cod_categoria] = recuento
            recopiladas = []
            for categoria in data_mesa[1:]:
                if categoria[0] == recuento.cod_categoria:
                    categoria[3] = True
                    gobject.idle_add(self._update_estados_mesas)
                recopiladas.append(categoria[3])

            self._elimimar_vista_acta()
            self.set_mensaje(MSG_GENERANDO_IMG)

            imagen = recuento.a_imagen(svg=True,
                                       de_muestra=True,
                                       tipo=(CIERRE_TRANSMISION,
                                             recuento.cod_categoria))
            path_destino = join(
                get_desktop_path(),
                "%s_%s.svg" % (recuento.mesa.numero, recuento.cod_categoria))
            file_destino = open(path_destino, 'w')
            file_destino.write(imagen)
            file_destino.close()
            self._mostrar_acta(path_destino)
            self.set_mensaje(MSG_RESTO_ACTAS)

            if all(recopiladas):
                actas = dict_actas.values()
                recuento_ = Recuento(actas[0].mesa)
                campos_especiales = [
                    "votos_emitidos", "votos_impugnados", "votos_nulos",
                    "votos_recurridos", "votos_observados",
                    "cantidad_ciudadanos", "certificados_impresos"
                ]
                primer_acta = actas[0]
                for campo in campos_especiales:
                    if hasattr(primer_acta, campo):
                        setattr(recuento_, campo, getattr(primer_acta, campo))
                for acta in actas:
                    for key, value in acta._resultados.items():
                        if key[0] == acta.cod_categoria:
                            recuento_._resultados[key] = value
                datos_tag = recuento_.a_tag()
                thread.start_new_thread(self.__enviar_recuento, (datos_tag, ))
                if multi_test:
                    self._ultimo_recuento = datos_tag
                if len(self._vbox_acta.children()) == 1:
                    botsi = BotonColor(MSG_BIG_SI, "#00cc00", "#ffffff")
                    botno = BotonColor(MSG_BIG_NO, "#ff0000", "#000000")
                    botsi.set_size_request(80, 70)
                    botno.set_size_request(80, 70)
                    botsi.connect("button-release-event",
                                  self._confirmar_transmision, datos_tag)
                    botno.connect("button-release-event",
                                  self._cancelar_confirmacion)
                    _hbox = gtk.HBox(False)
                    _hbox.set_border_width(10)
                    _hbox.pack_start(botno, padding=100)
                    sep = gtk.VSeparator()
                    sep.set_size_request(80, -1)
                    _hbox.pack_start(sep, True, True)
                    _hbox.pack_start(botsi, padding=100)

                    self._vbox_acta.pack_end(_hbox, False, True)
                    # Descargo y muestro el borrador nuevamente
                    self._vbox_acta.show_all()
                    #self.set_mensaje(MSG_BOLD % respuesta['mensaje'],
                    #                    idle=True, color=self.COLOR_OK,
                    #                    alerta=alerta)
        else:
            # la mesa no esta para transm
            self.set_mensaje(MSG_MESA_NO_HABILITADA)
Example #6
0
    def agregar_acta(self, data):
        recuento = Recuento.desde_tag(data)

        data_mesa = None
        for mesa in self._estados_mesas:
            if mesa[0][2] == recuento.mesa.numero and mesa[0][1] not in (ESTADO_OK, ESTADO_PUBLICADA):

                data_mesa = mesa
                break

        if data_mesa is not None:
            dict_actas = self._actas.get(recuento.mesa.codigo)
            if dict_actas is None:
                self._actas[recuento.mesa.codigo] = {}
                dict_actas = self._actas.get(recuento.mesa.codigo)
            dict_actas[recuento.cod_categoria] = recuento
            recopiladas = []
            for categoria in data_mesa[1:]:
                if categoria[0] == recuento.cod_categoria:
                    categoria[3] = True
                    gobject.idle_add(self._update_estados_mesas)
                recopiladas.append(categoria[3])

            self._elimimar_vista_acta()
            self.set_mensaje(MSG_GENERANDO_IMG)

            imagen = recuento.a_imagen(svg=True, de_muestra=True, tipo=(CIERRE_TRANSMISION, recuento.cod_categoria))
            path_destino = join(get_desktop_path(), "%s_%s.svg" % (recuento.mesa.numero, recuento.cod_categoria))
            file_destino = open(path_destino, "w")
            file_destino.write(imagen)
            file_destino.close()
            self._mostrar_acta(path_destino)
            self.set_mensaje(MSG_RESTO_ACTAS)

            if all(recopiladas):
                actas = dict_actas.values()
                recuento_ = Recuento(actas[0].mesa)
                campos_especiales = [
                    "votos_emitidos",
                    "votos_impugnados",
                    "votos_nulos",
                    "votos_recurridos",
                    "votos_observados",
                    "cantidad_ciudadanos",
                    "certificados_impresos",
                ]
                primer_acta = actas[0]
                for campo in campos_especiales:
                    if hasattr(primer_acta, campo):
                        setattr(recuento_, campo, getattr(primer_acta, campo))
                for acta in actas:
                    for key, value in acta._resultados.items():
                        if key[0] == acta.cod_categoria:
                            recuento_._resultados[key] = value
                datos_tag = recuento_.a_tag()
                thread.start_new_thread(self.__enviar_recuento, (datos_tag,))
                if multi_test:
                    self._ultimo_recuento = datos_tag
                if len(self._vbox_acta.children()) == 1:
                    botsi = BotonColor(MSG_BIG_SI, "#00cc00", "#ffffff")
                    botno = BotonColor(MSG_BIG_NO, "#ff0000", "#000000")
                    botsi.set_size_request(80, 70)
                    botno.set_size_request(80, 70)
                    botsi.connect("button-release-event", self._confirmar_transmision, datos_tag)
                    botno.connect("button-release-event", self._cancelar_confirmacion)
                    _hbox = gtk.HBox(False)
                    _hbox.set_border_width(10)
                    _hbox.pack_start(botno, padding=100)
                    sep = gtk.VSeparator()
                    sep.set_size_request(80, -1)
                    _hbox.pack_start(sep, True, True)
                    _hbox.pack_start(botsi, padding=100)

                    self._vbox_acta.pack_end(_hbox, False, True)
                    # Descargo y muestro el borrador nuevamente
                    self._vbox_acta.show_all()
                    # self.set_mensaje(MSG_BOLD % respuesta['mensaje'],
                    #                    idle=True, color=self.COLOR_OK,
                    #                    alerta=alerta)
        else:
            # la mesa no esta para transm
            self.set_mensaje(MSG_MESA_NO_HABILITADA)