GUI: Use Ḡ1 now, no cents anymore; Fill own pubkey as recipient as default

This commit is contained in:
poka 2020-11-25 09:46:58 +01:00
parent c652bc97c2
commit c633fba6a2
1 changed files with 10 additions and 5 deletions

View File

@ -17,6 +17,7 @@ from shutil import copyfile
from os.path import join, dirname
from dotenv import load_dotenv
from lib.natools import get_privkey
import requests
class StdoutRedirector(object):
def __init__(self, text_widget):
@ -28,7 +29,7 @@ class StdoutRedirector(object):
def flush(self):
pass
# Get variables environment
if not os.path.isfile('.env'):
@ -49,6 +50,7 @@ def ProceedPaiement(recipient, amount, comment):
elif not amount:
raise ValueError("Veuillez indiquer le montant de la transaction")
amount = int(float(amount.replace(',','.'))*100)
print("Paiement en cours vers", recipient)
trans = Transaction(dunikey, node, recipient, amount, comment)
trans.send()
@ -59,13 +61,14 @@ sg.theme('DarkGrey2')
layout = [ [sg.Text('Noeud utilisé: ' + node)],
[sg.Text('Votre clé publique: ' + issuer)],
[sg.Text('')],
[sg.Text('Destinataire: '), sg.InputText(size=(50, None))],
[sg.Text('Montant: '), sg.InputText(size=(7, None))],
[sg.Text('Destinataire: '), sg.InputText(size=(50, None),default_text=issuer)],
[sg.Text('Montant: '), sg.InputText(size=(7, None)), sg.Text('Ḡ1')],
[sg.Text('Commentaire:'), sg.InputText(size=(50, None))],
[sg.Button('Envoyer'), sg.Button('Annuler')] ]
# Create the Window
window = sg.Window('Paiement Ḡ1 - GVA', layout)
# availablePubkeys = requests.get('https://g1-stats.axiom-team.fr/data/wallets-g1.txt')
while True:
try:
event, values = window.read()
@ -74,9 +77,11 @@ while True:
if event == 'Envoyer':
ProceedPaiement(values[0], values[1], values[2])
except Exception as e:
sg.popup(f'Une erreur est survenu', e, title="Erreur")
loc = window.CurrentLocation()
sg.popup(f'Une erreur est survenu', e, title="Erreur", location=(loc))
else:
sg.popup(f'Transaction effectué avec succès !', title="Envoyé")
loc = window.CurrentLocation()
sg.popup(f'Transaction effectué avec succès !', title="Envoyé", location=(loc))
window.close()