From 9d4b1a6c2831d2130d9260cd21e123fbe6a5dc75 Mon Sep 17 00:00:00 2001 From: Katsuhi-Dev Date: Mon, 28 Feb 2022 21:59:46 +0100 Subject: [PATCH] Ajout connection rapide ( Front End ) --- data/users.json | 8 +++++-- source/app/BasePage/homeframe.py | 15 ++++++++----- source/app/OnConnexion/connexion.py | 34 ++++++++++++++++++++++++++++- source/app/main.py | 1 + 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/data/users.json b/data/users.json index 89ada98..e12888e 100644 --- a/data/users.json +++ b/data/users.json @@ -1,12 +1,16 @@ { "Alban": { "id": "Alban", - "email": "alban@gmail.com", + "email": "albanurt@gmail.com", "mdp": "000000", "money": "20" }, + "Admin": { "id": "", - "mdp": "" + "email": "Admin@gmail.com", + "mdp": "", + "money": "20" } + } \ No newline at end of file diff --git a/source/app/BasePage/homeframe.py b/source/app/BasePage/homeframe.py index b752ea1..96e1851 100644 --- a/source/app/BasePage/homeframe.py +++ b/source/app/BasePage/homeframe.py @@ -1,26 +1,29 @@ import tkinter as tk + from source.app.Sys import set_color class HomeFrame(tk.Frame): def __init__(self, window): - super().__init__(window, width=599, height=584) + super().__init__(window, width=853, height=584) self.window = window self.history_canvas = tk.Canvas(self, height=853, width=853, background=set_color('lightgreen'), highlightthickness=0) - self.history_canvas.create_rectangle(100, 50, 500, 504, fill=set_color('green'), width=5) - - self.history_canvas.create_text(300, 50, text="Historique des transactions", font=('Roboto', 20, 'bold'), + self.history_canvas.create_text(555, 50, text="Historique des transactions", font=('Roboto', 20, 'bold'), fill=set_color("darkgreen")) self.left_widgets() - self.history_canvas.place(x=254, y=0) + self.history_canvas.pack() def left_widgets(self): canvas = tk.Canvas(self, width=257, height=585, bg=set_color("entrycolor"), highlightthickness=0) canvas.create_line(1000, 0, -10, 0, fill=set_color("lightgreen")) canvas.create_line(1000, 520, -10, 520, fill=set_color("lightgreen")) - canvas.place(x=0, y=0) \ No newline at end of file + + canvas.create_text(128.5, 555, text=self.window.user_connected, font=('Roboto', 13), + fill="white") + + canvas.place(x=0,y=0) \ No newline at end of file diff --git a/source/app/OnConnexion/connexion.py b/source/app/OnConnexion/connexion.py index 4736c7c..e33e929 100644 --- a/source/app/OnConnexion/connexion.py +++ b/source/app/OnConnexion/connexion.py @@ -1,6 +1,6 @@ import json import tkinter as tk -from source.app.Sys import set_color +from source.app.Sys import set_color, select_image class ConnectionFrame(tk.Frame): @@ -55,6 +55,37 @@ def __init__(self, window): command=lambda: self.window.switch_frame('InscriptionFrame'), cursor='hand2') inscription_button.place(x=474, y=245, width=122, height=30) + # Rapid connection + + rapid_connect_text = tk.Label(self, text="Reconnecte-toi rapidement...", background=set_color("lightgreen"), + foreground=set_color("darkgreen"), font=('Roboto', 11, 'bold')) + rapid_connect_text.place(x=20, y=245) + + profile_img = tk.PhotoImage(file=select_image("profile-base.png")).subsample(16) + + # One + + profile_one = tk.Button(self, image=profile_img, background=set_color('lightgreen'), cursor='hand2', bd=0, + activebackground=set_color('lightgreen'), command= lambda: print("1")) + profile_one.photo = profile_img + profile_one.place(x=20, y=280) + + # Two + + profile_two = tk.Button(self, image=profile_img, background=set_color('lightgreen'), cursor='hand2', bd=0, + activebackground=set_color('lightgreen'), command=lambda: print("2")) + profile_two.photo = profile_img + profile_two.place(x=105, y=280) + + # Three + + profile_three = tk.Button(self, image=profile_img, background=set_color('lightgreen'), cursor='hand2', bd=0, + activebackground=set_color('lightgreen'), command=lambda: print("3")) + profile_three.photo = profile_img + profile_three.place(x=190, y=280) + + + # Copyright copyright_text = tk.Label(self, text="© 2022 GestMoney", background=set_color("lightgreen"), @@ -82,6 +113,7 @@ def connect(self): for user in users.values(): if user['id'] == entry_id and user['mdp'] == mdp: + self.window.user_connected = user['email'] self.window.switch_frame('BasePage') return diff --git a/source/app/main.py b/source/app/main.py index ddb66c3..926f11b 100644 --- a/source/app/main.py +++ b/source/app/main.py @@ -21,6 +21,7 @@ def __init__(self, window): self.wm_overrideredirect(True) self.x, self.y = None, None self.title_frame = None + self.user_connected = None self.main_frame = None self.active_frame = None