Moved conf in ProgramData and auto-detection Acrobat Reader.
This commit is contained in:
parent
bc0ccd1c93
commit
5db8255843
21
IFPass.py
21
IFPass.py
@ -24,7 +24,8 @@ from termcolor import colored
|
||||
|
||||
version = 'dev' # dev/devnocam
|
||||
|
||||
config = 'IFPass.conf'
|
||||
configdir = os.path.join(os.getenv('PROGRAMDATA'), 'IFPass')
|
||||
config = os.path.join(configdir, 'IFPass.conf')
|
||||
|
||||
|
||||
def initialisation():
|
||||
@ -35,8 +36,22 @@ def initialisation():
|
||||
print('Fichier de configuration introuvable.')
|
||||
IFPassDBdir = input(r'Quel est le répertoire de la base de données IFPass ? (Ex : \\192.168.1.1\IFPass) : ')
|
||||
printername = input("Quel est le nom de l'imprimante à cartes ? : ")
|
||||
AcrobatReader = input(r"Quel est le chemain vers Acrobat Reader ? ( Ex : C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe) : ")
|
||||
adobex86 = os.path.join(os.getenv('PROGRAMFILES(x86)'), 'Adobe', "Acrobat Reader DC", "Reader", "AcroRd32.exe")
|
||||
adobex64 = os.path.join(os.getenv('PROGRAMFILES'), 'Adobe', "Acrobat Reader DC", "Reader", "AcroRd32.exe")
|
||||
if os.path.exists(adobex86):
|
||||
AcrobatReader = adobex86
|
||||
elif os.path.exists(adobex64):
|
||||
AcrobatReader = adobex64
|
||||
else:
|
||||
acrinstalled = yes_or_no("Acrobat Reader est nécessaire pour imprimer les cartes. Est il installé ?")
|
||||
if acrinstalled:
|
||||
AcrobatReader = input(r"Quel est le chemin vers Acrobat Reader ? ( Ex : C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe) : ")
|
||||
else:
|
||||
print(colored('\nInstallez Acrobat Reader, puis relancez IFPass.', 'red'))
|
||||
os.system("pause")
|
||||
sys.exit()
|
||||
conf['DEFAULT'] = {'IFPassDBdir': IFPassDBdir, 'printername': printername, 'AcrobatReader': AcrobatReader}
|
||||
os.makedirs(configdir, 0o777)
|
||||
with open(config, 'w') as configfile:
|
||||
conf.write(configfile)
|
||||
else:
|
||||
@ -54,7 +69,7 @@ def initialisation():
|
||||
fonttemplate = os.path.join(templatesdir, 'Templates', 'Roboto-Bold.ttf')
|
||||
|
||||
if not os.path.exists(imgdir): # Cartes dir creation if it doesn't exist
|
||||
os.makedirs(imgdir)
|
||||
os.makedirs(imgdir, 0o777)
|
||||
if not os.path.exists(clientsfile): # Creation Clients_File if it doesn't exist
|
||||
with open(clientsfile, 'w', newline='', encoding='utf-8') as csvfile:
|
||||
writer = csv.writer(csvfile, delimiter=';')
|
||||
|
Loading…
Reference in New Issue
Block a user