Fix various bugs

This commit is contained in:
Jordan ERNST 2019-03-01 15:19:40 +01:00
parent f3f86c43a6
commit a1beec5cd1

View File

@ -15,7 +15,7 @@ from pywinauto.findwindows import find_window
from pywinauto.win32functions import SetForegroundWindow
from PIL import Image, ImageDraw, ImageFont
from PyPDF2 import PdfFileReader, PdfFileWriter
import fitz
import fitz # = PyMuPDF : To convert pdf to png
import subprocess
from shutil import copyfile, move
from pyfiglet import Figlet
@ -117,12 +117,13 @@ def get_fullname(**kwargs): # **kwargs => Optionnal arguments
surname = newsurname
else:
while "Empty surname":
surname = input("Nom : ").upper().strip()
surname = input("Nom : ").strip()
if len(surname) == 0:
os.system('cls')
print(colored("\nLe Nom ne peut pas être vide.", 'red'))
else:
break
surname = surname.upper()
docteur = yes_or_no('Est-ce un Docteur ?')
if docteur:
titre = 'Dr.'
@ -438,7 +439,8 @@ def memberdo(choix, member):
picture = getpic()
else:
# We crop pic from the previous card
pdf = fitz.open('PDF.pdf')
cartefilename = os.path.join(imgdir, clientID + '.pdf')
pdf = fitz.open(cartefilename)
page = pdf.loadPage(0)
mat = fitz.Matrix(4.165, 4.165) # To obtain good resolution
pix = page.getPixmap(matrix=mat)
@ -448,7 +450,7 @@ def memberdo(choix, member):
barcode = barcode_gen(clientID)
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
cartefilename = mergepdf()
cartefilename = mergepdf(clientID)
if version not in ('dev', 'devnocam'):
bkpdb()
printcard(cartefilename)