proiect finalizat
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import json
|
||||
import tkinter as tk
|
||||
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):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.title("Messenger App")
|
||||
|
||||
screen_height = self.winfo_screenheight()
|
||||
self.geometry(f"{screen_height // 2}x{screen_height // 2}")
|
||||
|
||||
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):
|
||||
self.change_view(InitialView(self))
|
||||
|
||||
def change_to_sing_in_view(self):
|
||||
self.change_view(SignupView(self))
|
||||
|
||||
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()
|
||||
|
||||
self.current_view = view
|
||||
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