messenger finalizat
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import json
|
||||
import tkinter as tk
|
||||
from PIL import Image, ImageTk
|
||||
from app.views.login import LoginView
|
||||
from app.views.initial import InitialView
|
||||
from app.views.signup import SignupView
|
||||
from app.views.main_page import MainPageView
|
||||
|
||||
|
||||
class MainApplication(tk.Tk):
|
||||
@@ -12,8 +15,13 @@ class MainApplication(tk.Tk):
|
||||
|
||||
screen_height = self.winfo_screenheight()
|
||||
self.geometry(f"{screen_height // 2}x{screen_height // 2}")
|
||||
self.current_view = None
|
||||
|
||||
icon_path = "/home/andrei/Documents/messenger/messenger_gui/resources/message-icon-png-17.png"
|
||||
self.iconphoto(True, tk.PhotoImage(file=icon_path))
|
||||
|
||||
self.current_logged_user = {}
|
||||
|
||||
self.current_view = None
|
||||
self.change_to_initial_view()
|
||||
|
||||
def change_to_initial_view(self):
|
||||
@@ -25,6 +33,12 @@ class MainApplication(tk.Tk):
|
||||
def change_to_login_view(self):
|
||||
self.change_view(LoginView(self))
|
||||
|
||||
def change_to_main_page_view(self):
|
||||
self.change_view(MainPageView(self))
|
||||
|
||||
def change_to_profile_view(self):
|
||||
pass
|
||||
|
||||
def change_view(self, view: tk.Frame):
|
||||
if self.current_view:
|
||||
self.current_view.destroy()
|
||||
@@ -33,5 +47,11 @@ class MainApplication(tk.Tk):
|
||||
self.current_view.pack(expand=True, fill=tk.BOTH)
|
||||
self.current_view.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
|
||||
|
||||
def get_user_information(self, credentials):
|
||||
data = json.loads(credentials)
|
||||
self.current_logged_user['id'] = data['info']['id']
|
||||
self.current_logged_user['username'] = data['info']['username']
|
||||
self.current_logged_user['email'] = data['info']['email']
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user