11
11
12
12
# >> VARIÁVEIS <<
13
13
14
- # - NOMES DE ARQUIVOS -
15
- # Nome do arquivo em PDF formatado sem a extensão
14
+ # - NOMES
15
+ # Nome do arquivo PDF que vai ser convertido ( sem a extensão)
16
16
fileName = ""
17
17
18
18
# - CAMINHOS
19
- # Caminho atual
19
+ # Caminho atual para a raiz do projeto (outros caminhos vão se
20
+ # basear nele)
20
21
currentPath = ""
21
- # Caminhos baseados no currentPath
22
- pathOutputFile = ""
23
- # Arquivo raíz exportado
22
+ # Caminho para o arquivo do terminal
23
+ txtOutputFilePath = ""
24
+ # Caminho do arquivo PDF que vai ser convertido
24
25
txtFilePath = ""
25
26
26
- # - ARQUIVOS DE SAÍDA
27
- # Saída do Terminal
28
- outputFile = ""
27
+ # - ARQUIVOS
28
+ # Arquivo de saída do Terminal
29
+ txtOutputFile = ""
29
30
30
31
# - CONTADORES
31
32
# Índice do Data Frame
32
33
indexDataFrame = 0
33
34
34
-
35
- # Linha gigante que vai ficar disposta em
36
- # alguns lugares como divisão no terminal
35
+ # Linha gigante que vai ficar disposta em alguns lugares como
36
+ # divisão no terminal
37
37
strGiantLine = (
38
38
"_____________________________________________________________"
39
39
"_____________________________________________________________"
@@ -61,7 +61,7 @@ def Main():
61
61
global indexDataFrame
62
62
63
63
# - CONTADORES
64
- # Índice do arquivo
64
+ # Índice de arquivos
65
65
indexFile = 1
66
66
67
67
# ---------------------------------------------------------------------- #
@@ -85,7 +85,7 @@ def Main():
85
85
strGiantLine + "\n "
86
86
"\n \n \n \n \n \n \n \n \n " ,
87
87
88
- file = outputFile
88
+ file = txtOutputFile
89
89
)
90
90
setTerminalFile ("closed" )
91
91
@@ -107,7 +107,7 @@ def Main():
107
107
" O arquivo '" + fileName + "' foi lido e está pronto pra ser convertido\n \n "
108
108
" ----- + -----\n \n \n \n " ,
109
109
110
- file = outputFile
110
+ file = txtOutputFile
111
111
)
112
112
setTerminalFile ("closed" )
113
113
@@ -169,7 +169,7 @@ def Main():
169
169
strGiantLine + "\n " +
170
170
strGiantLine ,
171
171
172
- file = outputFile
172
+ file = txtOutputFile
173
173
)
174
174
setTerminalFile ("closed" )
175
175
# Se até o término da operação nenhum PDF foi convertido ainda
@@ -195,7 +195,7 @@ def setCurrentPath():
195
195
196
196
# - Globais
197
197
global currentPath
198
- global pathOutputFile
198
+ global txtOutputFilePath
199
199
200
200
# ---------------------------------------------------------------------- #
201
201
@@ -210,7 +210,7 @@ def setCurrentPath():
210
210
# (pdfconverter\bin\Debug\netcoreapp3.1)
211
211
# \___[a diminuição de caracteres faz voltar até a pasta 'pdfconverter']
212
212
213
- pathOutputFile = currentPath + "\\ resultados\\ output.txt"
213
+ txtOutputFilePath = currentPath + "\\ resultados\\ output.txt"
214
214
except Exception as err :
215
215
showError (
216
216
"Não foi possível achar o diretório atual. Provável problema na hora de encurtar o "
@@ -275,7 +275,7 @@ def setProjectStructure():
275
275
276
276
# Cria arquivo para exibir a saída do terminal,
277
277
# se já existir o arquivo, limpa o mesmo
278
- outputClear = open (pathOutputFile , "w" , encoding = "UTF-8" )
278
+ outputClear = open (txtOutputFilePath , "w" , encoding = "UTF-8" )
279
279
outputClear .close ()
280
280
281
281
# >> CONFIGURAÇÕES DO PANDAS <<
@@ -307,14 +307,14 @@ def setTerminalFile(setState):
307
307
# >> VARIÁVEIS <<
308
308
309
309
# - GLOBAIS
310
- global outputFile
310
+ global txtOutputFile
311
311
312
312
# ---------------------------------------------------------------------- #
313
313
314
314
if (setState == "open" ):
315
- outputFile = open (pathOutputFile , "a" , encoding = "UTF-8" )
315
+ txtOutputFile = open (txtOutputFilePath , "a" , encoding = "UTF-8" )
316
316
elif (setState == "closed" ):
317
- outputFile .close ()
317
+ txtOutputFile .close ()
318
318
else :
319
319
showError ("O terminal só pode ser aberto ou fechado. Tenha certeza que atribuiu 'open' para aberto ou 'close' para fechado pro método 'terminal'." , "" )
320
320
exit ()
@@ -324,31 +324,31 @@ def setTerminalFile(setState):
324
324
# Função responsável por exibir mensagens de erros disponíveis nas Exceptions.
325
325
def showError (errorMessage , err ):
326
326
# Limpa o terminal para exibir melhor o erro
327
- open (pathOutputFile , "w" ).close ()
327
+ open (txtOutputFilePath , "w" ).close ()
328
328
329
- outputFile = open (pathOutputFile , "a" , encoding = "UTF-8" )
329
+ txtOutputFile = open (txtOutputFilePath , "a" , encoding = "UTF-8" )
330
330
print (
331
331
"**********************************************************************\n "
332
332
"--- MENSAGEM ---\n "
333
333
"\n "
334
334
"ERRO\n "
335
335
"Descrição: " + errorMessage + "\n " ,
336
336
337
- file = outputFile
337
+ file = txtOutputFile
338
338
)
339
339
340
340
# Caso tenha uma exception, ele exibe
341
341
if (err != "" ):
342
- print ("EXCEPTION" , file = outputFile )
343
- print (str (err ), file = outputFile )
342
+ print ("EXCEPTION" , file = txtOutputFile )
343
+ print (str (err ), file = txtOutputFile )
344
344
345
345
# Fecha o layout
346
346
print (
347
347
"**********************************************************************" ,
348
348
349
- file = outputFile
349
+ file = txtOutputFile
350
350
)
351
- outputFile .close ()
351
+ txtOutputFile .close ()
352
352
353
353
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SAÍDAS DE AVISOS - FIM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
354
354
@@ -432,10 +432,10 @@ def conversionStart(conversionMethod, tableDataFrame):
432
432
"\________________________________________________________________________________/\n " +
433
433
"Search this (Ctrl + F): '" + fileName + " " + conversionMethod + " tbl" + str (indexDataFrame ) + "'\n " ,
434
434
435
- file = outputFile
435
+ file = txtOutputFile
436
436
)
437
437
# Imprime o DataFrame
438
- print (pandas .DataFrame (tableDataFrame ), file = outputFile )
438
+ print (pandas .DataFrame (tableDataFrame ), file = txtOutputFile )
439
439
setTerminalFile ("closed" )
440
440
441
441
indexDataFrame = indexDataFrame + 1
0 commit comments