Exemplo n.º 1
0
    def timerEvent(self, e):
        if self.step >= 100:
            self.timer.stop()
            self.CxTexto.insertPlainText(
                strftime('[%H:%M:%S]') + " Arquivo salvo com sucesso!!!\n")
            self.BtnConverter.setEnabled(True)

        if self.dadosArquivo != [] and self.step < 50:
            self.tamanho = self.dadosArquivo[0] * self.controlador[1]
            if self.controlador[0] <= (self.dadosArquivo[0] *
                                       self.controlador[1]):
                self.step = (
                    (len(self.dadosArquivo) - 1) * 50) // self.dadosArquivo[0]
                self.progressBar.setValue(self.step)

        if self.step >= 50:
            if self.controlador[2] <= (self.tamanho):
                self.step = (self.controlador[2] * 50) / self.tamanho + 50
                self.progressBar.setValue(self.step)

        if self.step == 50:
            self.CxTexto.insertPlainText(
                strftime('[%H:%M:%S]') +
                " Conversão concluida com sucesso!!!\n")
            self.CxTexto.insertPlainText(
                strftime('[%H:%M:%S]') + " Salvando arquivo...\n")
            Conversor.starThreadGravadora(self.nome_arquivoDestino,
                                          self.dadosArquivo, self.controlador)
Exemplo n.º 2
0
 def abreArquivoXlsx(self):
     try:
         arquivoXlsx = open(self.nome_arquivoOrigem, "rt")
         arquivoXlsx.close()
         Conversor.starThreadConversora(self.dadosArquivo, self.nome_arquivoOrigem, self.controlador)
         self.creatProgressBar()
         self.progressBar.setValue(self.step)
         self.doAction()
     except:
         if (self.LayoutConversao.count() == 2):
             self.progressBar.close()
             self.LayoutConversao.removeWidget(self.progressBar)
         self.CxTexto.setTextColor(QtGui.QColor("red"))
         self.CxTexto.insertPlainText(strftime('[%H:%M:%S]') + " ERRO: ARQUIVO NÃO EXISTENTE\n")
         self.BtnConverter.setEnabled(True)
         self.CxTexto.setTextColor(QtGui.QColor("black"))
Exemplo n.º 3
0
 def abreArquivoXlsx(self):
     try:
         arquivoXlsx = open(self.nome_arquivoOrigem, "rt")
         arquivoXlsx.close()
         Conversor.starThreadConversora(self.dadosArquivo,
                                        self.nome_arquivoOrigem,
                                        self.controlador)
         self.creatProgressBar()
         self.progressBar.setValue(self.step)
         self.doAction()
     except:
         if (self.LayoutConversao.count() == 2):
             self.progressBar.close()
             self.LayoutConversao.removeWidget(self.progressBar)
         self.CxTexto.setTextColor(QtGui.QColor("red"))
         self.CxTexto.insertPlainText(
             strftime('[%H:%M:%S]') + " ERRO: ARQUIVO NÃO EXISTENTE\n")
         self.BtnConverter.setEnabled(True)
         self.CxTexto.setTextColor(QtGui.QColor("black"))
Exemplo n.º 4
0
    def timerEvent(self, e):
        if self.step >= 100:
            self.timer.stop()
            self.CxTexto.insertPlainText(strftime('[%H:%M:%S]') + " Arquivo salvo com sucesso!!!\n")
            self.BtnConverter.setEnabled(True)

        if self.dadosArquivo != [] and self.step < 50:
            self.tamanho = self.dadosArquivo[0] * self.controlador[1]
            if self.controlador[0] <= (self.dadosArquivo[0] * self.controlador[1]):
                self.step = ((len(self.dadosArquivo)-1)*50)//self.dadosArquivo[0]
                self.progressBar.setValue(self.step)

        if self.step >= 50:
            if self.controlador[2] <= (self.tamanho):
                self.step = (self.controlador[2]*50)/self.tamanho + 50
                self.progressBar.setValue(self.step)

        if self.step == 50:
            self.CxTexto.insertPlainText(strftime('[%H:%M:%S]') + " Conversão concluida com sucesso!!!\n")
            self.CxTexto.insertPlainText(strftime('[%H:%M:%S]') + " Salvando arquivo...\n")
            Conversor.starThreadGravadora(self.nome_arquivoDestino, self.dadosArquivo, self.controlador)