def converter(): if self.nomeFicheiros is None: QMessageBox.critical( self.ferramentas, "Erro", "Selecione as imagens antes de continuar e tente novamente.." ) procurar_imagens() else: try: inicio = time() QMessageBox.warning( self.ferramentas, 'Aviso', 'Selecione aonde salvar e o nome do arquivo..') dirSalvar = QFileDialog.getSaveFileName( self.ferramentas, filter='PDF (*.pdf)', initialFilter='PDF (*.pdf)', caption="Selecione aonde salvar e o nome do arquivo.." )[0] ImagEditor(_dir_salvar=dirSalvar).convertendo_pdf( _images=self.nomeFicheiros) QMessageBox.information( self.ferramentas, "Sucedido", f"Operação Concluida em {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical( self.ferramentas, "Erro", f"Durante o processamento do pedido ocorreu o seguinte erro:\n-{erro}" )
def converter(): if nomeImagemCI.text() == "" or nomeImagemCI.text().isspace(): QMessageBox.critical( self.ferramentas, "Erro", "Selecione a imagem antes de continuar e tente novamente.." ) procurar_imagem() else: try: inicio = time() QMessageBox.information( self.ferramentas, 'Aviso', 'Selecione aonde salvar o arquivo..') dirSalvar = QFileDialog.getExistingDirectory( self.ferramentas, caption="Selecione aonde salvar o arquivo") ImagEditor(_dir_salvar=dirSalvar).convertendo_icone( _size=int(tamanhos.currentText()), _nome_imagem=nomeImagemCI.text()) QMessageBox.information( self.ferramentas, "Sucedido", f"Operação Concluida em {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical( self.ferramentas, "Erro", f"Durante o processamento do pedido ocorreu o seguinte erro:\n-{erro}" )
def procurar_directorio(): if nomeLogo.text() != "": try: inicio = time() nomeDirectorio = QFileDialog.getExistingDirectory( self.ferramentas, caption="Selecione a Imagem") dirImagem.setText(nomeDirectorio) QMessageBox.information( self.ferramentas, 'Aviso', 'Selecione aonde salvar o arquivo..') dirSalvar = QFileDialog.getExistingDirectory( self.ferramentas, caption="Selecione aonde salvar o arquivo") ImagEditor(_dir_salvar=dirSalvar).add_logo( _nome_logotipo=nomeLogo.text(), _dir_imagens=dirImagem.text()) QMessageBox.information( self.ferramentas, "Sucedido", f"Operação Concluida em {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical( self.ferramentas, "Erro", f"Durante o processamento do pedido ocorreu o seguinte erro:\n-{erro}" ) else: QMessageBox.critical( self.ferramentas, "Erro", "Selecione o logotipo antes de continuar e tente novamente.." ) procurar_logo()
def converter(): if self.nomeFicheiros is None: QMessageBox.critical(self.ferramentas, "Error", "Select the images before to proceed and try again..") procurar_imagens() else: try: inicio = time() QMessageBox.warning(self.ferramentas, 'Warning', 'Select where to save and the name of the file..') dirSalvar = QFileDialog.getSaveFileName( self.ferramentas, filter='GIF (*.gif)', caption='Select where to save and the name of the file..' )[0] ImagEditor(_dir_salvar=dirSalvar).convertendo_gif(_images=self.nomeFicheiros) QMessageBox.information(self.ferramentas, "Successful", f"Operation Concluded in {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical(self.ferramentas, "Error", f"While processing the request the following error occured:\n-{erro}")
def add_logo_imagem(): if nomeLogo.text() != "": try: inicio = time() QMessageBox.information(self.ferramentas, 'Warning', 'Select where to save the file..') dirSalvar = QFileDialog.getExistingDirectory(self.ferramentas, caption="Select where to save the file") ImagEditor(_dir_salvar=dirSalvar).add_logo( _nome_logotipo=nomeLogo.text(), _nome_imagem=nomeImagemAL.text() ) QMessageBox.information(self.ferramentas, "Successful", f"Operation Concluded in {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical(self.ferramentas, "Error", f"While processing the request the following error occured:\n-{erro}") else: QMessageBox.critical(self.ferramentas, "Error", "Select the logo before to proceed and try again..") procurar_logo()
def converter(): if nomeImagemCI.text() == "" or nomeImagemCI.text().isspace(): QMessageBox.critical(self.ferramentas, "Error", "Select the image before to proceed and try again..") procurarImagem() else: try: inicio = time() QMessageBox.information(self.ferramentas, 'Warning', 'Select where to save the file..') dirSalvar = QFileDialog.getExistingDirectory( self.ferramentas, caption="Select where to save the file" ) ImagEditor(_dir_salvar=dirSalvar).convertendo_icone( _size=int(tamanhos.currentText()), _nome_imagem=nomeImagemCI.text() ) QMessageBox.information(self.ferramentas, "Successful", f"Operation Concluded in {int(time() - inicio)}s..") except Exception as erro: QMessageBox.critical(self.ferramentas, "Error", f"While processing the request the following error occured:\n-{erro}")