Fix Annuler button; Add exceptions errors
This commit is contained in:
parent
283e6c47c5
commit
c652bc97c2
10
paiements.py
10
paiements.py
|
@ -44,6 +44,11 @@ if not dunikey or not node:
|
|||
sys.exit(1)
|
||||
|
||||
def ProceedPaiement(recipient, amount, comment):
|
||||
if not recipient:
|
||||
raise ValueError("Veuillez indiquer un destinataire de paiement")
|
||||
elif not amount:
|
||||
raise ValueError("Veuillez indiquer le montant de la transaction")
|
||||
|
||||
print("Paiement en cours vers", recipient)
|
||||
trans = Transaction(dunikey, node, recipient, amount, comment)
|
||||
trans.send()
|
||||
|
@ -64,9 +69,10 @@ window = sg.Window('Paiement Ḡ1 - GVA', layout)
|
|||
while True:
|
||||
try:
|
||||
event, values = window.read()
|
||||
if event == sg.WIN_CLOSED or event == 'Cancel':
|
||||
if event == sg.WIN_CLOSED or event == 'Annuler':
|
||||
break
|
||||
ProceedPaiement(values[0], values[1], values[2])
|
||||
if event == 'Envoyer':
|
||||
ProceedPaiement(values[0], values[1], values[2])
|
||||
except Exception as e:
|
||||
sg.popup(f'Une erreur est survenu', e, title="Erreur")
|
||||
else:
|
||||
|
|
Reference in New Issue