Compare commits

..

20 Commits

Author SHA1 Message Date
c18b49149f Add new builds 2019-06-20 16:39:50 +02:00
7016c2e665 Update version string 2019-06-20 16:32:26 +02:00
72d228de52 Update instructions in .cfg files 2019-06-20 16:31:44 +02:00
c31868d320 Update README to include build instructions 2019-06-20 16:30:58 +02:00
8a42245e4f Upgraded python and modules 2019-06-20 14:55:29 +02:00
655d61ea84 Merge branch 'dev' 2019-06-20 11:36:12 +02:00
b9561ef60f Del builds 2019-06-20 10:55:43 +02:00
962977774b Add licence information and link 2019-06-20 10:29:48 +02:00
0d94358f10 Print more informations about processing 2019-06-20 10:21:42 +02:00
461d969f92 Merge branch 'dev' 2019-04-02 17:22:49 +02:00
ff1a88c85b Fix print number of days since expired. 2019-04-02 17:22:06 +02:00
3e35e6fb05 New builds 2019-04-02 12:09:54 +02:00
48465446ec Increment version to 3.1-1 2019-04-02 12:05:21 +02:00
971bf846ab Merge branch 'dev' 2019-04-02 12:03:37 +02:00
d879cf389d Fixed bug change date 2019-04-02 12:03:07 +02:00
8138ebd95c Add builds 2019-03-25 09:49:35 +01:00
483d7e2f6f Fixed con files 2019-03-22 13:02:15 +01:00
e7f78e6e39 Increment version to 3.1 2019-03-22 12:51:33 +01:00
622ad63e0a Merge branch 'dev' 2019-03-22 12:27:09 +01:00
a93c05bcc3 Allow to choose date manually 2019-03-22 12:23:55 +01:00
6 changed files with 79 additions and 35 deletions

View File

@ -23,7 +23,7 @@ from colorama import init
from termcolor import colored from termcolor import colored
version = '3.0-1' # dev/devnocam version = '3.2' # dev/devnocam
configdir = os.path.join(os.getenv('PROGRAMDATA'), 'IFPass') configdir = os.path.join(os.getenv('PROGRAMDATA'), 'IFPass')
config = os.path.join(configdir, 'IFPass.conf') config = os.path.join(configdir, 'IFPass.conf')
@ -248,7 +248,7 @@ def bkpdb():
def fillcard(clientID, titrename, firstname, dateexp, barcode, picture): def fillcard(clientID, titrename, firstname, dateexp, barcode, picture):
print("Création de la carte avec les informations...", end='') print("Création du verso de la carte avec les informations...", end='')
try: try:
im = Image.open(pngtemplate) im = Image.open(pngtemplate)
except FileNotFoundError: except FileNotFoundError:
@ -287,6 +287,7 @@ def fillcard(clientID, titrename, firstname, dateexp, barcode, picture):
def mergepdf(clientID): def mergepdf(clientID):
print("Fusion du recto et du verso de la carte...", end='')
cartefilename = os.path.join(imgdir, clientID + '.pdf') cartefilename = os.path.join(imgdir, clientID + '.pdf')
output = PdfFileWriter() output = PdfFileWriter()
@ -302,6 +303,7 @@ def mergepdf(clientID):
output.write(f) output.write(f)
os.remove(imgdir + clientID + '_Front.pdf') os.remove(imgdir + clientID + '_Front.pdf')
print(colored('[OK]', 'green'))
return cartefilename return cartefilename
@ -311,6 +313,17 @@ def printcard(cartefilename):
subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' ' + printername, shell=False) subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' ' + printername, shell=False)
def getdateexp():
while True:
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
if match:
break
else:
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
return dateexp
def newmember(): def newmember():
while "the informations are incorrect": # Loop Filling informations while "the informations are incorrect": # Loop Filling informations
os.system('cls') os.system('cls')
@ -322,13 +335,7 @@ def newmember():
dateexp = dateexp.strftime('%d/%m/%Y') dateexp = dateexp.strftime('%d/%m/%Y')
changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?") changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
if changeexp: if changeexp:
while True: dateexp = getdateexp()
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
if match:
break
else:
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
os.system('cls') os.system('cls')
print("Titre : ", colored(titre, 'green')) print("Titre : ", colored(titre, 'green'))
@ -400,11 +407,11 @@ def membersearch():
if diff > 0: if diff > 0:
print(colored(f"L'abonnement est encore valable {diff} jours.", 'green', attrs=['bold'])) print(colored(f"L'abonnement est encore valable {diff} jours.", 'green', attrs=['bold']))
elif diff < 0: elif diff < 0:
print(colored("L'abonnement est expiré depuis {abs(diff)} jours.", 'red', attrs=['bold'])) # abs() to remove minus sign print(colored(f"L'abonnement est expiré depuis {abs(diff)} jours.", 'red', attrs=['bold'])) # abs() to remove minus sign
elif diff == 0: elif diff == 0:
print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold'])) print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold']))
print('\n1 - Modifier', "2 - Renouveller l'abonnement", '3 - Imprimer la carte', '0 - Menu principal', sep='\n') print('\n1 - Modifier', "2 - Renouveller l'abonnement / Choisir un nouvelle date d'expiration", '3 - Imprimer la carte', '0 - Menu principal', sep='\n')
choix = input('Choix : ') choix = input('Choix : ')
if choix == '0': if choix == '0':
os.system('cls') os.system('cls')
@ -431,13 +438,17 @@ def memberdo(choix, member):
titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp) titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp)
elif choix == '2': # Renew subscription elif choix == '2': # Renew subscription
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date() changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
diff = (dateexp - date.today()).days if changeexp:
if diff >= 0: dateexp = getdateexp()
dateexp = dateexp + timedelta(days=365) else:
elif diff < 0: dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
dateexp = date.today() + timedelta(days=365) diff = (dateexp - date.today()).days
dateexp = dateexp.strftime('%d/%m/%Y') if diff >= 0:
dateexp = dateexp + timedelta(days=365)
elif diff < 0:
dateexp = date.today() + timedelta(days=365)
dateexp = dateexp.strftime('%d/%m/%Y')
if titre == 'Dr.': if titre == 'Dr.':
titrename = titre + ' ' + surname titrename = titre + ' ' + surname
@ -533,6 +544,7 @@ def main():
if version in ('dev', 'devnocam'): if version in ('dev', 'devnocam'):
print(colored("\nATTENTION : Il s'agit d'une version en cours de développement, potentiellement instable !", 'red')) print(colored("\nATTENTION : Il s'agit d'une version en cours de développement, potentiellement instable !", 'red'))
print("\nCe programme est developpé par par Jordan ERNST pour l'Institut Français en Hongrie.") print("\nCe programme est developpé par par Jordan ERNST pour l'Institut Français en Hongrie.")
print("Il est disponible sou licence MIT à cette addresse : https://framagit.org/SecT0uch/IFPass\n")
print('Pour toute question, problème ou requête contactez-moi à pro.ernst@gmail.com.\n') print('Pour toute question, problème ou requête contactez-moi à pro.ernst@gmail.com.\n')
print('1 - Nouveau membre', '2 - Rechercher un membre', '0 - Quitter', sep='\n') print('1 - Nouveau membre', '2 - Rechercher un membre', '0 - Quitter', sep='\n')
choix = input('Choix : ') choix = input('Choix : ')

View File

@ -1,4 +1,12 @@
# IFPass # IFPass
IFPass is a python project developped for the "Institut Français en Hongrie" and published under MIT license. IFPass is a python project developped for the "Institut Français en Hongrie" and published under [MIT license](https://framagit.org/SecT0uch/IFPass/blob/master/LICENSE).
It allows to manage a subscriber database and print member cards. It allows to manage a subscriber database and print member cards.
## Build
1. Install [NSIS](http://nsis.sourceforge.net/Download).
2. Install python 3 and pip.
3. Install the modules with `sudo -H pip install pynsist PyPDF2 termcolor`
4. If pynsist version < 2.4, replace `/usr/lib/python3.*/site-packages/nsist/__init__.py` with https://raw.githubusercontent.com/takluyver/pynsist/master/nsist/__init__.py
5. Run `./build.sh`

View File

@ -1,31 +1,43 @@
[Application] [Application]
name=IFPass name=IFPass
version=3.0-1 version=3.2
entry_point=IFPass:main entry_point=IFPass:main
icon=IF.ico icon=IF.ico
console=true console=true
license_file=LICENSE license_file=LICENSE
[Python] [Python]
version=3.7.1 version=3.7.3
bitness=64 bitness=64
[Include] [Include]
# Packages from PyPI that your application requires, one per line # Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI: # These must have wheels on PyPI:
# https://pypi.org/project/code128/
# https://pypi.org/project/colorama/
# https://pypi.org/project/pyfiglet/
# https://pypi.org/project/numpy/
# https://pypi.org/project/opencv-python/
# https://pypi.org/project/Pillow/
# https://pypi.org/project/pywin32/
# https://pypi.org/project/six/
# https://pypi.org/project/setuptools/
# https://pypi.org/project/PyMuPDF/
# https://pypi.org/project/pywinauto/
pypi_wheels=code128==0.3 pypi_wheels=code128==0.3
colorama==0.4.1 colorama==0.4.1
pyfiglet==0.8.post1 pyfiglet==0.8.post1
numpy==1.16.2 numpy==1.16.4
opencv-python==4.0.0.21 opencv-python==4.1.0.25
Pillow==5.4.1 Pillow==6.0.0
pywin32==224 pywin32==224
six==1.12.0 six==1.12.0
setuptools==40.8.0 setuptools==41.0.1
PyMuPDF==1.14.8 PyMuPDF==1.14.16
pywinauto==0.6.6 pywinauto==0.6.6
# Must check if future updates of the following packages provide .whl files # Must check if future updates of the following packages provide .whl files
# pywinauto needs to be downloaded manually and edit setup to match platform=win32
# Packages without wheels (Must be installed locally): # Packages without wheels (Must be installed locally):
packages=PyPDF2 packages=PyPDF2
termcolor termcolor

View File

@ -1,31 +1,43 @@
[Application] [Application]
name=IFPass name=IFPass
version=3.0-1 version=3.2
entry_point=IFPass:main entry_point=IFPass:main
icon=IF.ico icon=IF.ico
console=true console=true
license_file=LICENSE license_file=LICENSE
[Python] [Python]
version=3.7.1 version=3.7.3
bitness=32 bitness=32
[Include] [Include]
# Packages from PyPI that your application requires, one per line # Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI: # These must have wheels on PyPI:
# https://pypi.org/project/code128/
# https://pypi.org/project/colorama/
# https://pypi.org/project/pyfiglet/
# https://pypi.org/project/numpy/
# https://pypi.org/project/opencv-python/
# https://pypi.org/project/Pillow/
# https://pypi.org/project/pywin32/
# https://pypi.org/project/six/
# https://pypi.org/project/setuptools/
# https://pypi.org/project/PyMuPDF/
# https://pypi.org/project/pywinauto/
pypi_wheels=code128==0.3 pypi_wheels=code128==0.3
colorama==0.4.1 colorama==0.4.1
pyfiglet==0.8.post1 pyfiglet==0.8.post1
numpy==1.16.2 numpy==1.16.4
opencv-python==4.0.0.21 opencv-python==4.1.0.25
Pillow==5.4.1 Pillow==6.0.0
pywin32==224 pywin32==224
six==1.12.0 six==1.12.0
setuptools==40.8.0 setuptools==41.0.1
PyMuPDF==1.14.8 PyMuPDF==1.14.16
pywinauto==0.6.6 pywinauto==0.6.6
# Must check if future updates of the following packages provide .whl files # Must check if future updates of the following packages provide .whl files
# pywinauto needs to be downloaded manually and edit setup to match platform=win32
# Packages without wheels (Must be installed locally): # Packages without wheels (Must be installed locally):
packages=PyPDF2 packages=PyPDF2
termcolor termcolor