mirror of
https://github.com/Noettore/fattureCCSR.git
synced 2025-10-15 03:36:39 +02:00
Refactored LogDialog. Added btn to open pdf
Signed-off-by: Ettore Dreucci <ettore.dreucci@gmail.com>
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
"""ask for an input file (.xlsx) and an output file (.pdf) and downloads and unite every invoice"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
import tempfile
|
||||
import openpyxl
|
||||
@@ -32,14 +29,6 @@ def get_invoices_info(input_file_path: str) -> tuple:
|
||||
invoices_info = (owner_name, invoices)
|
||||
return invoices_info
|
||||
|
||||
def open_file(file_path):
|
||||
"""open a file with the default software"""
|
||||
if sys.platform == "win32":
|
||||
os.startfile(file_path) # pylint: disable=maybe-no-member
|
||||
else:
|
||||
opener = "open" if sys.platform == "darwin" else "xdg-open"
|
||||
subprocess.call([opener, file_path])
|
||||
|
||||
def download_invoices(parent):
|
||||
"""download invoices from CCSR"""
|
||||
output_file_path = None
|
||||
@@ -91,8 +80,6 @@ def download_invoices(parent):
|
||||
merger.append(PyPDF2.PdfFileReader(open(invoice["path"], "rb")))
|
||||
merger.write(output_file_path)
|
||||
|
||||
open_file(output_file_path)
|
||||
|
||||
shutil.rmtree(tmp_dir, ignore_errors=True)
|
||||
|
||||
parent.log_dialog.log_text.AppendText("Download terminato.\nIl pdf contenente le fatture si trova in %s\n" % output_file_path)
|
||||
|
Reference in New Issue
Block a user