@@ -39,12 +39,14 @@ def login_released(self,usnm, passw):
39
39
print (f"password = { passw .text } " )
40
40
result = db .un_login (usnm .text ,passw .text )
41
41
if result == True :
42
-
43
-
42
+ # set global username
43
+ global current_user
44
44
current_user = UserData (usnm .text )
45
+
45
46
# clear text fields
46
47
usnm .text = ""
47
48
passw .text = ""
49
+
48
50
#set window to profile
49
51
kivy_app .root .current = "profile"
50
52
self .manager .transition .direction = "left"
@@ -58,18 +60,25 @@ def login_released(self,usnm, passw):
58
60
pass
59
61
60
62
class ProfileWindow (Screen ):
61
- def display_userdata (self ,* args ):
63
+ def display_userdata (self , usnm , first_name , last_name , email , interests ):
64
+
65
+ # get user profile
62
66
user_profiles = db .profile_get (current_user .UserName )
63
- assert len (user_profiles )
67
+ assert len (user_profiles ) > 0 #assert if user profile does not exist
64
68
69
+ # update stored current user data
65
70
user_data = user_profiles [0 ]
66
71
current_user .update (user_data )
67
- for i in range (len (args )):
68
- args [i ].text = user_data [i + 1 ]
69
- pass
70
72
73
+ # update text on-screen
74
+ usnm .text = current_user .UserName
75
+ first_name .text = current_user .FirstName
76
+ last_name .text = current_user .LastName
77
+ email .text = current_user .Email
78
+ interests .text = current_user .Interests
71
79
72
80
pass
81
+
73
82
pass
74
83
75
84
class ProfileCreateWindow (Screen ):
0 commit comments